Skip to content

Commit af19af2

Browse files
author
tamat
committed
fixes in mouse events
1 parent f3f60fc commit af19af2

8 files changed

Lines changed: 568 additions & 549 deletions

File tree

build/litegraph.core.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5800,14 +5800,15 @@ LGraphNode.prototype.executeAction = function(action)
58005800
var skip_dragging = false;
58015801
var skip_action = false;
58025802
var now = LiteGraph.getTime();
5803-
var is_double_click = (now - this.last_mouseclick < 300) && (e.isPrimary!==undefined && e.isPrimary);
5803+
var is_primary = (e.isPrimary === undefined || !e.isPrimary);
5804+
var is_double_click = (now - this.last_mouseclick < 300) && is_primary;
58045805
this.mouse[0] = e.clientX;
58055806
this.mouse[1] = e.clientY;
58065807
this.graph_mouse[0] = e.canvasX;
58075808
this.graph_mouse[1] = e.canvasY;
58085809
this.last_click_position = [this.mouse[0],this.mouse[1]];
58095810

5810-
if (this.pointer_is_down && e.isPrimary!==undefined && !e.isPrimary){
5811+
if (this.pointer_is_down && is_primary ){
58115812
this.pointer_is_double = true;
58125813
//console.log("pointerevents: pointer_is_double start");
58135814
}else{
@@ -6503,8 +6504,10 @@ LGraphNode.prototype.executeAction = function(action)
65036504
**/
65046505
LGraphCanvas.prototype.processMouseUp = function(e) {
65056506

6507+
var is_primary = ( e.isPrimary === undefined || e.isPrimary );
6508+
65066509
//early exit for extra pointer
6507-
if(e.isPrimary!==undefined && !e.isPrimary){
6510+
if(!is_primary){
65086511
/*e.stopPropagation();
65096512
e.preventDefault();*/
65106513
//console.log("pointerevents: processMouseUp pointerN_stop "+e.pointerId+" "+e.isPrimary);
@@ -6789,11 +6792,12 @@ LGraphNode.prototype.executeAction = function(action)
67896792
}
67906793

67916794
/*
6792-
if((this.dirty_canvas || this.dirty_bgcanvas) && this.rendering_timer_id == null)
6793-
this.draw();
6794-
*/
6795+
if((this.dirty_canvas || this.dirty_bgcanvas) && this.rendering_timer_id == null)
6796+
this.draw();
6797+
*/
67956798

6796-
if (e.isPrimary!==undefined && e.isPrimary){
6799+
if (is_primary)
6800+
{
67976801
this.pointer_is_down = false;
67986802
this.pointer_is_double = false;
67996803
}

build/litegraph.core.min.js

Lines changed: 123 additions & 123 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/litegraph.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5800,14 +5800,15 @@ LGraphNode.prototype.executeAction = function(action)
58005800
var skip_dragging = false;
58015801
var skip_action = false;
58025802
var now = LiteGraph.getTime();
5803-
var is_double_click = (now - this.last_mouseclick < 300) && (e.isPrimary!==undefined && e.isPrimary);
5803+
var is_primary = (e.isPrimary === undefined || !e.isPrimary);
5804+
var is_double_click = (now - this.last_mouseclick < 300) && is_primary;
58045805
this.mouse[0] = e.clientX;
58055806
this.mouse[1] = e.clientY;
58065807
this.graph_mouse[0] = e.canvasX;
58075808
this.graph_mouse[1] = e.canvasY;
58085809
this.last_click_position = [this.mouse[0],this.mouse[1]];
58095810

5810-
if (this.pointer_is_down && e.isPrimary!==undefined && !e.isPrimary){
5811+
if (this.pointer_is_down && is_primary ){
58115812
this.pointer_is_double = true;
58125813
//console.log("pointerevents: pointer_is_double start");
58135814
}else{
@@ -6503,8 +6504,10 @@ LGraphNode.prototype.executeAction = function(action)
65036504
**/
65046505
LGraphCanvas.prototype.processMouseUp = function(e) {
65056506

6507+
var is_primary = ( e.isPrimary === undefined || e.isPrimary );
6508+
65066509
//early exit for extra pointer
6507-
if(e.isPrimary!==undefined && !e.isPrimary){
6510+
if(!is_primary){
65086511
/*e.stopPropagation();
65096512
e.preventDefault();*/
65106513
//console.log("pointerevents: processMouseUp pointerN_stop "+e.pointerId+" "+e.isPrimary);
@@ -6789,11 +6792,12 @@ LGraphNode.prototype.executeAction = function(action)
67896792
}
67906793

67916794
/*
6792-
if((this.dirty_canvas || this.dirty_bgcanvas) && this.rendering_timer_id == null)
6793-
this.draw();
6794-
*/
6795+
if((this.dirty_canvas || this.dirty_bgcanvas) && this.rendering_timer_id == null)
6796+
this.draw();
6797+
*/
67956798

6796-
if (e.isPrimary!==undefined && e.isPrimary){
6799+
if (is_primary)
6800+
{
67976801
this.pointer_is_down = false;
67986802
this.pointer_is_double = false;
67996803
}
@@ -17399,6 +17403,7 @@ if (typeof exports != "undefined") {
1739917403
};
1740017404

1740117405
LiteGraph.registerNodeType("input/gamepad", GamepadInput);
17406+
1740217407
})(this);
1740317408

1740417409
(function(global) {

build/litegraph.min.js

Lines changed: 132 additions & 132 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/litegraph_mini.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5800,14 +5800,15 @@ LGraphNode.prototype.executeAction = function(action)
58005800
var skip_dragging = false;
58015801
var skip_action = false;
58025802
var now = LiteGraph.getTime();
5803-
var is_double_click = (now - this.last_mouseclick < 300) && (e.isPrimary!==undefined && e.isPrimary);
5803+
var is_primary = (e.isPrimary === undefined || !e.isPrimary);
5804+
var is_double_click = (now - this.last_mouseclick < 300) && is_primary;
58045805
this.mouse[0] = e.clientX;
58055806
this.mouse[1] = e.clientY;
58065807
this.graph_mouse[0] = e.canvasX;
58075808
this.graph_mouse[1] = e.canvasY;
58085809
this.last_click_position = [this.mouse[0],this.mouse[1]];
58095810

5810-
if (this.pointer_is_down && e.isPrimary!==undefined && !e.isPrimary){
5811+
if (this.pointer_is_down && is_primary ){
58115812
this.pointer_is_double = true;
58125813
//console.log("pointerevents: pointer_is_double start");
58135814
}else{
@@ -6503,8 +6504,10 @@ LGraphNode.prototype.executeAction = function(action)
65036504
**/
65046505
LGraphCanvas.prototype.processMouseUp = function(e) {
65056506

6507+
var is_primary = ( e.isPrimary === undefined || e.isPrimary );
6508+
65066509
//early exit for extra pointer
6507-
if(e.isPrimary!==undefined && !e.isPrimary){
6510+
if(!is_primary){
65086511
/*e.stopPropagation();
65096512
e.preventDefault();*/
65106513
//console.log("pointerevents: processMouseUp pointerN_stop "+e.pointerId+" "+e.isPrimary);
@@ -6789,11 +6792,12 @@ LGraphNode.prototype.executeAction = function(action)
67896792
}
67906793

67916794
/*
6792-
if((this.dirty_canvas || this.dirty_bgcanvas) && this.rendering_timer_id == null)
6793-
this.draw();
6794-
*/
6795+
if((this.dirty_canvas || this.dirty_bgcanvas) && this.rendering_timer_id == null)
6796+
this.draw();
6797+
*/
67956798

6796-
if (e.isPrimary!==undefined && e.isPrimary){
6799+
if (is_primary)
6800+
{
67976801
this.pointer_is_down = false;
67986802
this.pointer_is_double = false;
67996803
}
@@ -16600,6 +16604,7 @@ if (typeof exports != "undefined") {
1660016604
};
1660116605

1660216606
LiteGraph.registerNodeType("input/gamepad", GamepadInput);
16607+
1660316608
})(this);
1660416609

1660516610
(function(global) {

0 commit comments

Comments
 (0)