From 7403fa72c7ab1e9bbdee1b9dbfbfb13c9b9bdb89 Mon Sep 17 00:00:00 2001 From: YouWei Zhao Date: Fri, 16 Mar 2018 00:25:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=BB=9A=E8=BD=AE?= =?UTF-8?q?=E8=A1=8C=E4=B8=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/editor_blockly.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index c949f620..b9d5ef45 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -214,6 +214,7 @@ var workspace = Blockly.inject(blocklyDiv,{ zoom:{ controls: true, wheel: true,//false + //滚轮改为上下(shift:左右)翻滚 startScale: 1.0, maxScale: 3, minScale: 0.3, @@ -230,6 +231,14 @@ window.addEventListener('resize', onresize, false); onresize(); Blockly.svgResize(workspace); +//Blockly.bindEventWithChecks_(editor_blockly.workspace.svgGroup_,"wheel",editor_blockly.workspace,function(e){}); +document.getElementById('blocklyDiv').onmousewheel = function(e){ + console.log(e); + e.preventDefault(); + var hvScroll = e.shiftKey?'hScroll':'vScroll'; + editor_blockly.workspace.scrollbar[hvScroll].handlePosition_+=( ((e.deltaY||0)+(e.detail||0)) >0?20:-20); + editor_blockly.workspace.scrollbar[hvScroll].onScroll_(); +} var doubleClickCheck=[[0,'abc']]; function omitedcheckUpdateFunction(event) { From e1786c40eb6d783e32a6350d0a56782ac63204d3 Mon Sep 17 00:00:00 2001 From: YouWei Zhao Date: Fri, 16 Mar 2018 00:45:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=BC=80=E5=90=AFlint=E5=92=8C=E8=87=AA=E5=8A=A8=E8=A1=A5?= =?UTF-8?q?=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/editor_blockly.js | 2 +- _server/editor_multi.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index 769031f0..716c7a28 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -232,7 +232,7 @@ Blockly.svgResize(workspace); //Blockly.bindEventWithChecks_(editor_blockly.workspace.svgGroup_,"wheel",editor_blockly.workspace,function(e){}); document.getElementById('blocklyDiv').onmousewheel = function(e){ - console.log(e); + //console.log(e); e.preventDefault(); var hvScroll = e.shiftKey?'hScroll':'vScroll'; editor_blockly.workspace.scrollbar[hvScroll].handlePosition_+=( ((e.deltaY||0)+(e.detail||0)) >0?20:-20); diff --git a/_server/editor_multi.js b/_server/editor_multi.js index a72d28be..4a735402 100644 --- a/_server/editor_multi.js +++ b/_server/editor_multi.js @@ -28,8 +28,14 @@ codeEditor.on("keyup", function (cm, event) { editor_multi.id=''; editor_multi.isString=false; +editor_multi.lintAutocomplete=false; -editor_multi.show = function(){document.getElementById('left7').style='';} +editor_multi.show = function(){ + if(codeEditor.getValue().slice(0,8)==='function')editor_multi.lintAutocomplete=true; + codeEditor.setOption("lint", editor_multi.lintAutocomplete); + codeEditor.setOption("autocomplete", editor_multi.lintAutocomplete); + document.getElementById('left7').style=''; +} editor_multi.hide = function(){document.getElementById('left7').style='z-index:-1;opacity: 0;';} editor_multi.indent = function(field){ @@ -42,9 +48,12 @@ editor_multi.import = function(id_){ if(!thisTr)return false; var input = thisTr.children[2].children[0].children[0]; var field = thisTr.children[0].getAttribute('title'); + var comment = thisTr.children[1].getAttribute('title'); if(!input.type || input.type!=='textarea')return false; editor_multi.id=id_; editor_multi.isString=false; + editor_multi.lintAutocomplete=false; + if(field.indexOf('Effect') !== -1)editor_multi.lintAutocomplete=true; if(input.value.slice(0,1)==='"'){ editor_multi.isString=true; codeEditor.setValue(JSON.parse(input.value)||''); @@ -106,6 +115,7 @@ editor_multi.multiLineEdit = function(value,b,f,callback){ multiLineArgs[0]=b; multiLineArgs[1]=f; multiLineArgs[2]=callback; + editor_multi.lintAutocomplete=false; editor_multi.show(); } editor_multi.multiLineDone = function(){