Merge pull request #63 from InventivetalentDev/master

Fixes & variable scroll speed
This commit is contained in:
Javi Agenjo
2019-01-12 17:26:16 +01:00
committed by GitHub
3 changed files with 17246 additions and 9897 deletions

File diff suppressed because it is too large Load Diff

9278
build/litegraph.min.js vendored

File diff suppressed because it is too large Load Diff

View File

@@ -2653,7 +2653,7 @@ LGraphNode.prototype.computeSize = function( minHeight, out )
* Allows to pass * Allows to pass
* *
* @method addWidget * @method addWidget
* @return {Float32Array[4]} the total size * @return {Object} the created widget
*/ */
LGraphNode.prototype.addWidget = function( type, name, value, callback, options ) LGraphNode.prototype.addWidget = function( type, name, value, callback, options )
{ {
@@ -4094,7 +4094,7 @@ LGraphCanvas.prototype.processMouseDown = function(e)
{ {
//double click node //double click node
if( node.onDblClick) if( node.onDblClick)
node.onDblClick(e,[e.canvasX - node.pos[0], e.canvasY - node.pos[1]],graphcanvas); node.onDblClick(e,[e.canvasX - node.pos[0], e.canvasY - node.pos[1]], this);
this.processNodeDblClicked( node ); this.processNodeDblClicked( node );
block_drag_node = true; block_drag_node = true;
} }
@@ -8002,11 +8002,14 @@ function ContextMenu( values, options )
function on_mouse_wheel(e) function on_mouse_wheel(e)
{ {
var pos = parseInt( root.style.top ); var pos = parseInt( root.style.top );
root.style.top = (pos + e.deltaY * 0.1).toFixed() + "px"; root.style.top = (pos + e.deltaY * options.scroll_speed).toFixed() + "px";
e.preventDefault(); e.preventDefault();
return true; return true;
} }
if(!options.scroll_speed)
options.scroll_speed = 0.1;
root.addEventListener("wheel", on_mouse_wheel, true); root.addEventListener("wheel", on_mouse_wheel, true);
root.addEventListener("mousewheel", on_mouse_wheel, true); root.addEventListener("mousewheel", on_mouse_wheel, true);