diff --git a/build/litegraph.js b/build/litegraph.js index 619aaedc7..d1b8b195c 100644 --- a/build/litegraph.js +++ b/build/litegraph.js @@ -5871,7 +5871,7 @@ LGraphCanvas.prototype.drawGroups = function(canvas, ctx) var size = group._size; ctx.globalAlpha = 0.25; ctx.beginPath(); - ctx.rect( pos[0], pos[1], size[0], size[1] ); + ctx.rect( pos[0] + 0.5, pos[1] + 0.5, size[0], size[1] ); ctx.fill(); ctx.globalAlpha = 1; ctx.stroke(); @@ -6680,7 +6680,7 @@ LGraphCanvas.onMenuNodeColors = function( value, options, e, menu, node ) delete node.color; delete node.bgcolor; } - node.setDirtyCanvas(true); + node.setDirtyCanvas(true,true); } return false; diff --git a/build/litegraph.min.js b/build/litegraph.min.js index 9e5643972..d427c281a 100755 --- a/build/litegraph.min.js +++ b/build/litegraph.min.js @@ -144,7 +144,7 @@ h.options.min);b.fillStyle=d==h?"#89A":"#678";b.fillRect(10,m,q*(f-20),k);b.stro 26,c+k-5),b.fill(),e&&(b.fillStyle="#999",b.fillText(h.name,30,m+0.7*k),b.fillStyle="#DDD",b.textAlign="right","number"==h.type?b.fillText(Number(h.value).toFixed(void 0!==h.options.precision?h.options.precision:3),f-40,m+0.7*k):b.fillText(h.value,f-40,m+0.7*k))}c+=k+4}b.textAlign="left"};d.prototype.processNodeWidgets=function(a,c,b,d){if(!a.widgets||!a.widgets.length)return null;for(var f=c[0]-a.pos[0],k=c[1]-a.pos[1],e=a.size[0],n=this,h=0;hm.last_y&&km.options.max&&(m.value=m.options.max)):"mousedown"==b.type&&(b=40>f?-1:f>e-40?1:0,"number"==m.type?(m.value+=0.1*b*(m.options.step||1),null!=m.options.min&&m.valuem.options.max&&(m.value=m.options.max)):b&&(b=m.options.values.indexOf(m.value)+b,b>=m.options.values.length&&(b=0),0>b&&(b=m.options.values.length-1),m.value=m.options.values[b])),m.callback&& -setTimeout(function(){m.callback(m.value,n,a,c)},20),this.dirty_canvas=!0}return m}}return null};d.prototype.drawGroups=function(a,c){if(this.graph){var b=this.graph._groups;c.save();c.globalAlpha=0.5;c.font="24px Arial";for(var d=0;db&&0.01>c.editor_alpha&&(clearInterval(d),1>b&&(c.live_mode=!0));1"+e.values[ q.addEventListener("click",function(a){f(!!q.checked)});else if(q=m.querySelector("input"))q.value=void 0!==a.properties[c]?a.properties[c]:"",q.addEventListener("keydown",function(a){13==a.keyCode&&(d(),a.preventDefault(),a.stopPropagation())});m.querySelector("button").addEventListener("click",d)}};d.prototype.createDialog=function(a,c){c=c||{};var b=document.createElement("div");b.className="graphdialog";b.innerHTML=a;var d=this.canvas.getBoundingClientRect(),f=-20,k=-20;d&&(f-=d.left,k-=d.top); c.position?(f+=c.position[0],k+=c.position[1]):c.event?(f+=c.event.pageX,k+=c.event.pageY):(f+=0.5*this.canvas.width,k+=0.5*this.canvas.height);b.style.left=f+"px";b.style.top=k+"px";this.canvas.parentNode.appendChild(b);b.close=function(){this.parentNode&&this.parentNode.removeChild(this)};return b};d.onMenuNodeCollapse=function(a,c,b,d,f){f.collapse()};d.onMenuNodePin=function(a,c,b,d,f){f.pin()};d.onMenuNodeMode=function(a,c,b,d,f){new l.ContextMenu(["Always","On Event","On Trigger","Never"],{event:b, callback:function(a){if(f)switch(a){case "On Event":f.mode=l.ON_EVENT;break;case "On Trigger":f.mode=l.ON_TRIGGER;break;case "Never":f.mode=l.NEVER;break;default:f.mode=l.ALWAYS}},parentMenu:d,node:f});return!1};d.onMenuNodeColors=function(a,c,b,e,f){if(!f)throw"no node for color";c=[];c.push({value:null,content:"No color"});for(var k in d.node_colors)a=d.node_colors[k],a={value:k,content:""+k+""},c.push(a);new l.ContextMenu(c,{event:b,callback:function(a){f&&((a=a.value?d.node_colors[a.value]:null)?f.constructor===l.LGraphGroup?f.color=a.groupcolor:(f.color=a.color,f.bgcolor=a.bgcolor):(delete f.color,delete f.bgcolor),f.setDirtyCanvas(!0))},parentMenu:e,node:f});return!1};d.onMenuNodeShapes=function(a,c,b,d,f){if(!f)throw"no node passed";new l.ContextMenu(l.VALID_SHAPES,{event:b,callback:function(a){f&&(f.shape=a,f.setDirtyCanvas(!0))}, +a.color+"; background-color:"+a.bgcolor+"'>"+k+""},c.push(a);new l.ContextMenu(c,{event:b,callback:function(a){f&&((a=a.value?d.node_colors[a.value]:null)?f.constructor===l.LGraphGroup?f.color=a.groupcolor:(f.color=a.color,f.bgcolor=a.bgcolor):(delete f.color,delete f.bgcolor),f.setDirtyCanvas(!0,!0))},parentMenu:e,node:f});return!1};d.onMenuNodeShapes=function(a,c,b,d,f){if(!f)throw"no node passed";new l.ContextMenu(l.VALID_SHAPES,{event:b,callback:function(a){f&&(f.shape=a,f.setDirtyCanvas(!0))}, parentMenu:d,node:f});return!1};d.onMenuNodeRemove=function(a,c,b,d,f){if(!f)throw"no node passed";!1!==f.removable&&(f.graph.remove(f),f.setDirtyCanvas(!0,!0))};d.onMenuNodeClone=function(a,c,b,d,f){!1!=f.clonable&&(a=f.clone())&&(a.pos=[f.pos[0]+5,f.pos[1]+5],f.graph.add(a),f.setDirtyCanvas(!0,!0))};d.node_colors={red:{color:"#322",bgcolor:"#533",groupcolor:"#A88"},brown:{color:"#332922",bgcolor:"#593930",groupcolor:"#b06634"},green:{color:"#232",bgcolor:"#353",groupcolor:"#8A8"},blue:{color:"#223", bgcolor:"#335",groupcolor:"#88A"},pale_blue:{color:"#2a363b",bgcolor:"#3f5159",groupcolor:"#3f789e"},cyan:{color:"#233",bgcolor:"#355",groupcolor:"#8AA"},purple:{color:"#323",bgcolor:"#535",groupcolor:"#a1309b"},yellow:{color:"#432",bgcolor:"#653",groupcolor:"#b58b2a"},black:{color:"#222",bgcolor:"#000",groupcolor:"#444"}};d.prototype.getCanvasMenuOptions=function(){var a=null;this.getMenuOptions?a=this.getMenuOptions():(a=[{content:"Add Node",has_submenu:!0,callback:d.onMenuAdd},{content:"Add Group", callback:d.onGroupAdd}],this._graph_stack&&0