From 6b431f498720923148ea785e42b7931b0a7256b6 Mon Sep 17 00:00:00 2001 From: vivid Date: Tue, 21 Jun 2016 11:33:59 +0900 Subject: [PATCH 01/31] chrome working version --- dist/entry.js | 71 ++++++++++++++++++++++++++--- src/workspace/block_view.js | 90 ++++++++++++++++++++++++++++++++++++- 2 files changed, 152 insertions(+), 9 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index f83ebbe29a..0f972a1cf4 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -722,7 +722,7 @@ Entry.Arduino = {name:"arduino", setZero:function() { Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a0:{name:Lang.Hw.port_en + " A0 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a1:{name:Lang.Hw.port_en + " A1 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a2:{name:Lang.Hw.port_en + " A2 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a3:{name:Lang.Hw.port_en + " A3 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a4:{name:Lang.Hw.port_en + " A4 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a5:{name:Lang.Hw.port_en + " A5 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}}, mode:"both"}}; Entry.SensorBoard = {name:"sensorBoard", setZero:Entry.Arduino.setZero}; -Entry.dplay = {name:"dplay", vel_value:255, setZero:Entry.Arduino.setZero, timeouts:[], removeTimeout:function(b) { +Entry.dplay = {name:"dplay", vel_value:255, Left_value:255, Right_value:255, setZero:Entry.Arduino.setZero, timeouts:[], removeTimeout:function(b) { clearTimeout(b); var a = this.timeouts; b = a.indexOf(b); @@ -856,8 +856,8 @@ Blockly.Blocks.arduino_toggle_led = {init:function() { this.setNextStatement(!0); }}; Entry.block.arduino_toggle_led = function(b, a) { - var c = a.getNumberValue("VALUE"), d = "on" == a.getField("OPERATOR") ? 255 : 0; - Entry.hw.setDigitalPortValue(c, d); + var c = a.getNumberValue("VALUE"), d = a.getField("OPERATOR"); + Entry.hw.setDigitalPortValue(c, "on" == d ? 255 : 0); return a.callReturn(); }; Blockly.Blocks.arduino_toggle_pwm = {init:function() { @@ -1057,8 +1057,8 @@ Blockly.Blocks.dplay_select_led = {init:function() { Entry.block.dplay_select_led = function(b, a) { var c = a.getField("PORT"), d = 7; "7" == c ? d = 7 : "8" == c ? d = 8 : "9" == c ? d = 9 : "10" == c && (d = 10); - c = "on" == a.getField("OPERATOR") ? 255 : 0; - Entry.hw.setDigitalPortValue(d, c); + c = a.getField("OPERATOR"); + Entry.hw.setDigitalPortValue(d, "on" == c ? 255 : 0); return a.callReturn(); }; Blockly.Blocks.dplay_get_switch_status = {init:function() { @@ -2068,10 +2068,10 @@ Entry.block.wait_second = function(b, a) { } a.isStart = !0; a.timeFlag = 1; - var c = a.getNumberValue("SECOND", a), c = 60 / (Entry.FPS || 60) * c * 1E3; + var c = a.getNumberValue("SECOND", a); setTimeout(function() { a.timeFlag = 0; - }, c); + }, 60 / (Entry.FPS || 60) * c * 1E3); return a; }; Blockly.Blocks.repeat_basic = {init:function() { @@ -16176,6 +16176,63 @@ Entry.BlockView.DRAG_RADIUS = 5; b.getParam = function(a) { return this._paramMap[a]; }; + b.getDataUrl = function() { + function a() { + f = f.replace("(svgGroup)", (new XMLSerializer).serializeToString(g)).replace("(defs)", (new XMLSerializer).serializeToString(k[0])).replace(/>\s+/g, ">").replace(/\s+\s+/g, ">").replace(/\s+ Date: Wed, 22 Jun 2016 11:10:09 +0900 Subject: [PATCH 02/31] thread to png --- dist/entry.js | 140 ++++++++++++++++--------------- src/workspace/block_entry.js | 2 +- src/workspace/block_view.js | 67 +++++++++++---- src/workspace/field/dropdown.js | 3 +- src/workspace/field/text.js | 4 +- src/workspace/field/textInput.js | 2 +- 6 files changed, 128 insertions(+), 90 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 0f972a1cf4..636c8b98cb 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -9847,40 +9847,40 @@ Entry.Painter.prototype.generateView = function(b) { this.attrLineArea = Entry.createElement("div", "painterAttrLineStyle"); this.attrLineArea.addClass("entryPlaygroundPainterAttrLineStyle"); g.appendChild(this.attrLineArea); - var u = Entry.createElement("div"); - u.addClass("entryPlaygroundPainterAttrLineStyleLine"); - this.attrLineArea.appendChild(u); var t = Entry.createElement("div"); - t.addClass("entryPlaygroundPaitnerAttrLineArea"); + t.addClass("entryPlaygroundPainterAttrLineStyleLine"); this.attrLineArea.appendChild(t); + var u = Entry.createElement("div"); + u.addClass("entryPlaygroundPaitnerAttrLineArea"); + this.attrLineArea.appendChild(u); d = Entry.createElement("div"); d.addClass("entryPlaygroundPainterAttrLineStyleLine1"); - t.appendChild(d); + u.appendChild(d); d.value = "line"; var v = Entry.createElement("div"); v.addClass("painterAttrLineStyleBackgroundLine"); - u.bindOnClick(function(a) { - t.removeClass("entryRemove"); + t.bindOnClick(function(a) { + u.removeClass("entryRemove"); }); - t.blur = function(a) { + u.blur = function(a) { this.addClass("entryRemove"); }; - t.onmouseleave = function(a) { + u.onmouseleave = function(a) { this.addClass("entryRemove"); }; d.bindOnClick(function(a) { - this.attrLineArea.removeClass(u); + this.attrLineArea.removeClass(t); this.attrLineArea.appendChild(v); this.attrLineArea.onchange(a); - t.blur(); + u.blur(); }); v.bindOnClick(function(a) { - t.removeClass("entryRemove"); + u.removeClass("entryRemove"); }); this.attrLineArea.onchange = function(b) { a.stroke.style = b.target.value; }; - t.blur(); + u.blur(); } }; Entry.Painter.prototype.restoreHandle = function() { @@ -11664,8 +11664,8 @@ Entry.BlockDriver = function() { return d; } for (var e = 0;e < a.length;e++) { - var f = a[e], g = f.tagName, h = $(f).children()[0], u = f.getAttribute("name"); - "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(b(h)), d.index[u] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[u] = d.params.length - 1); + var f = a[e], g = f.tagName, h = $(f).children()[0], t = f.getAttribute("name"); + "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(b(h)), d.index[t] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[t] = d.params.length - 1); } return d; } @@ -16176,62 +16176,66 @@ Entry.BlockView.DRAG_RADIUS = 5; b.getParam = function(a) { return this._paramMap[a]; }; - b.getDataUrl = function() { - function a() { - f = f.replace("(svgGroup)", (new XMLSerializer).serializeToString(g)).replace("(defs)", (new XMLSerializer).serializeToString(k[0])).replace(/>\s+/g, ">").replace(/\s+\s+/g, ">").replace(/\s+', '<', '=', '+', '-', 'x', '/']; + + for (var i=0; i -1) { + text.setAttribute('font-weight', 'bold'); + text.setAttribute('font-size', (size) + 'px'); + } + + if (notResizeTypes.indexOf(content) > -1) + text.setAttribute('font-size', (size) + 'px'); + else text.setAttribute('font-size', (size * 0.95) + 'px'); + })(texts[i]); + } - if (images.length === 0) process(); + var counts = 0; + if (images.length === 0) processSvg(); else { for (var i=0; i\s+/g, ">").replace(/\s+ Date: Wed, 22 Jun 2016 15:00:37 +0900 Subject: [PATCH 03/31] getDataUrl --- dist/entry.js | 50 ++++++++++++++++------------ dist/entry.min.js | 41 +++++++++++++---------- src/workspace/block_view.js | 21 +++++++++--- src/workspace/field/keyboardInput.js | 2 +- 4 files changed, 69 insertions(+), 45 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 617bd1dfbd..bab6ace7eb 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -16181,43 +16181,51 @@ Entry.BlockView.DRAG_RADIUS = 5; function b() { g = g.replace("(svgGroup)", (new XMLSerializer).serializeToString(h)).replace("(defs)", (new XMLSerializer).serializeToString(l[0])).replace(/>\s+/g, ">").replace(/\s+d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}; Blockly.Blocks.dplay_select_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([["7","7"],["8","8"],["9","9"],["10","10"]]),"PORT");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_select_led=function(b,a){var c=a.getField("PORT"),d=7;"7"==c?d=7:"8"==c?d=8:"9"==c?d=9:"10"==c&&(d=10);c="on"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(d,c);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_select_led=function(b,a){var c=a.getField("PORT"),d=7;"7"==c?d=7:"8"==c?d=8:"9"==c?d=9:"10"==c&&(d=10);c=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(d,"on"==c?255:0);return a.callReturn()}; Blockly.Blocks.dplay_get_switch_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ub514\uc9c0\ud138 ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["2","2"],["4","4"]]),"PORT");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.dplay_string_5,"ON"],[Lang.Blocks.dplay_string_6,"OFF"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; Entry.block.dplay_get_switch_status=function(b,a){var c=a.getField("PORT"),d=2;"2"==c?d=2:"4"==c&&(d=4);return"OFF"==a.getField("STATUS")?1==Entry.hw.getDigitalPortValue(d)?1:0:0==Entry.hw.getDigitalPortValue(d)?1:0}; Blockly.Blocks.dplay_get_light_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.dplay_light).appendField(new Blockly.FieldDropdown([[Lang.Blocks.dplay_string_3,"BRIGHT"],[Lang.Blocks.dplay_string_4,"DARK"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; @@ -232,7 +232,7 @@ Entry.block.quotient_and_mod=function(b,a){var c=a.getNumberValue("LEFTHAND",a), Blockly.Blocks.choose_project_timer_action={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_choose_project_timer_action_1,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_choose_project_timer_action_sub_1,"START"],[Lang.Blocks.CALC_choose_project_timer_action_sub_2,"STOP"],[Lang.Blocks.CALC_choose_project_timer_action_sub_3,"RESET"]],null,!0,calcArrowColor),"ACTION").appendField(Lang.Blocks.CALC_choose_project_timer_action_2, calcFontColor).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/calc_01.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)},whenAdd:function(){Entry.engine&&Entry.engine.showProjectTimer()},whenRemove:function(b){Entry.engine&&Entry.engine.hideProjectTimer(b)}}; Entry.block.choose_project_timer_action=function(b,a){var c=a.getField("ACTION"),d=Entry.engine,e=d.projectTimer;"START"==c?e.isInit?e.isInit&&e.isPaused&&(e.pauseStart&&(e.pausedTime+=(new Date).getTime()-e.pauseStart),delete e.pauseStart,e.isPaused=!1):d.startProjectTimer():"STOP"==c?e.isInit&&!e.isPaused&&(e.isPaused=!0,e.pauseStart=(new Date).getTime()):"RESET"==c&&e.isInit&&(e.setValue(0),e.start=(new Date).getTime(),e.pausedTime=0,delete e.pauseStart);return a.callReturn()};Blockly.Blocks.wait_second={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_1);this.appendValueInput("SECOND").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.wait_second=function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;var c=a.getNumberValue("SECOND",a),c=60/(Entry.FPS||60)*c*1E3;setTimeout(function(){a.timeFlag=0},c);return a}; +Entry.block.wait_second=function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;var c=a.getNumberValue("SECOND",a);setTimeout(function(){a.timeFlag=0},60/(Entry.FPS||60)*c*1E3);return a}; Blockly.Blocks.repeat_basic={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_basic_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_basic_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.repeat_basic=function(b,a){var c;if(!a.isLooped){a.isLooped=!0;c=a.getNumberValue("VALUE",a);if(0>c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(c)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}; Blockly.Blocks.repeat_inf={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_inf).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_inf=function(b,a){a.isLooped=!0;return a.getStatement("DO")}; @@ -979,8 +979,8 @@ g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPa "entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(b){a.font.style=b.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;dd.style.opacity&&(clearInterval(a),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryRemove");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.BlockDriver=function(){}; -(function(b){b.convert=function(){var a=new Date,b;for(b in Entry.block)"function"===typeof Entry.block[b]&&this._convertBlock(b);console.log((new Date).getTime()-a.getTime())};b._convertBlock=function(a){function b(a){var d={type:a.getAttribute("type"),index:{}};a=$(a).children();if(!a)return d;for(var e=0;ee)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f, c);return Math.round(c)}},sensorBoard_get_named_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["\uc18c\ub9ac","0"],["\ube5b \uac10\uc9c0","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc628\ub3c4","3"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"sensorBoard_get_named_sensor_value"},paramsKeyMap:{PORT:0},"class":"sensorBoard",isNotFor:["sensorBoard"],func:function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT", @@ -1522,7 +1522,7 @@ null,null],type:"quotient_and_mod"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3,OPERATO "START"],[Lang.Blocks.CALC_choose_project_timer_action_sub_2,"STOP"],[Lang.Blocks.CALC_choose_project_timer_action_sub_3,"RESET"]],value:"START",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_2,color:"#3D3D3D"},{type:"Indicator",img:"block_icon/calc_01.png",size:12}],events:{viewAdd:[function(){Entry.engine&&Entry.engine.showProjectTimer()}],dataDestroy:[function(b){Entry.engine&&Entry.engine.hideProjectTimer(b)}]},def:{params:[null, "START",null,null],type:"choose_project_timer_action"},paramsKeyMap:{ACTION:1},"class":"calc_timer",isNotFor:[],func:function(b,a){var c=a.getField("ACTION"),d=Entry.engine,e=d.projectTimer;"START"==c?e.isInit?e.isInit&&e.isPaused&&(e.pauseStart&&(e.pausedTime+=(new Date).getTime()-e.pauseStart),delete e.pauseStart,e.isPaused=!1):d.startProjectTimer():"STOP"==c?e.isInit&&!e.isPaused&&(e.isPaused=!0,e.pauseStart=(new Date).getTime()):"RESET"==c&&e.isInit&&(e.setValue(0),e.start=(new Date).getTime(), e.pausedTime=0,delete e.pauseStart);return a.callReturn()}},wait_second:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null],type:"wait_second"},paramsKeyMap:{SECOND:0},"class":"delay",isNotFor:[],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0; -a.timeFlag=1;var c=a.getNumberValue("SECOND",a),c=60/(Entry.FPS||60)*c*1E3;setTimeout(function(){a.timeFlag=0},c);return a}},repeat_basic:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"repeat_basic"},paramsKeyMap:{VALUE:0},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c;if(!a.isLooped){a.isLooped= +a.timeFlag=1;var c=a.getNumberValue("SECOND",a);setTimeout(function(){a.timeFlag=0},60/(Entry.FPS||60)*c*1E3);return a}},repeat_basic:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"repeat_basic"},paramsKeyMap:{VALUE:0},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c;if(!a.isLooped){a.isLooped= !0;c=a.getNumberValue("VALUE",a);if(0>c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(c)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[], func:function(b,a){a.isLooped=!0;return a.getStatement("DO")}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(b,a){return this.executor.breakLoop()}},wait_until_true:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"}, null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(b,a){return a.getBooleanValue("BOOL",a)?a.callReturn():a}},_if:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(b,a){return a.isCondition?(delete a.isCondition, @@ -1846,7 +1846,7 @@ arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null,null],type:" params:[{type:"Dropdown",options:[["2","2"],["4","4"]],value:"2",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["\uc67c\ucabd","LEFT"],["\uc624\ub978\ucabd","LIGHT"]],value:"LEFT",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null,null],type:"dplay_get_tilt"},paramsKeyMap:{PORT:0,STATUS:1},"class":"dplay_get",isNotFor:["dplay"],func:function(b,a){var c=a.getField("PORT"),d=2;"2"==c?d=2:"4"==c&&(d=4);return"LIGHT"==a.getField("STATUS")?1== Entry.hw.getDigitalPortValue(d)?1:0:0==Entry.hw.getDigitalPortValue(d)?1:0}},dplay_toggle_led:{parent:"arduino_toggle_led",isNotFor:["dplay"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"dplay_toggle_led"},"class":"dplay_set"},dplay_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["dplay"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"dplay_toggle_pwm"},"class":"dplay_set"},dplay_select_led:{color:"#00979D",fontColor:"#FFF",skeleton:"basic", statements:[],template:"\ub514\uc9c0\ud138 %1 LED \uc0c1\ud0dc\ub97c %2 %3",params:[{type:"Dropdown",options:[["7","7"],["8","8"],["12","12"],["13","13"]],value:"7",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["\ucf1c\uae30","ON"],["\ub044\uae30","OFF"]],value:"ON",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"dplay_select_led"},paramsKeyMap:{PORT:0,OPERATOR:1}, -"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){var c=a.getField("PORT"),d=7;"7"==c?d=7:"8"==c?d=8:"12"==c?d=12:"13"==c&&(d=13);c="ON"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(d,c);return a.callReturn()}},dplay_DCmotor:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"%1 DC\ubaa8\ud130 \uc0c1\ud0dc\ub97c %2 %3",params:[{type:"Dropdown",options:[["\uc67c\ucabd","1"],["\uc624\ub978\ucabd","2"],["\uc591\ucabd","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}, +"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){var c=a.getField("PORT"),d=7;"7"==c?d=7:"8"==c?d=8:"12"==c?d=12:"13"==c&&(d=13);c=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(d,"ON"==c?255:0);return a.callReturn()}},dplay_DCmotor:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"%1 DC\ubaa8\ud130 \uc0c1\ud0dc\ub97c %2 %3",params:[{type:"Dropdown",options:[["\uc67c\ucabd","1"],["\uc624\ub978\ucabd","2"],["\uc591\ucabd","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}, {type:"Dropdown",options:[["\uc815\ubc29\ud5a5","FRONT"],["\uc5ed\ubc29\ud5a5","REAR"],["\uc815\uc9c0","OFF"]],value:"FRONT",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"dplay_DCmotor"},paramsKeyMap:{PORT:0,OPERATOR:1},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){var c=a.getField("PORT"),d=0,e=0,f=0,g=0;"1"==c?(d=3,e=5):"2"==c?(d=6,e=11):"3"==c&&(d=3,e=5,f=11,g=6);var c=Entry.dplay.vel_value, h=a.getField("OPERATOR"),k=0,l=0;"FRONT"==h?(k=c,l=0):"REAR"==h?(k=0,l=c):"OFF"==h&&(l=k=0);Entry.hw.setDigitalPortValue(d,l);Entry.hw.setDigitalPortValue(e,k);Entry.hw.setDigitalPortValue(f,l);Entry.hw.setDigitalPortValue(g,k);return a.callReturn()}},dplay_DCmotor_speed:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"%1 DC\ubaa8\ud130 \uc18d\ub3c4\ub97c %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",params:[{type:"Dropdown",options:[["\uc67c\ucabd","1"],["\uc624\ub978\ucabd", "2"],["\uc591\ucabd","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"dplay_DCmotor_speed"},paramsKeyMap:{PORT:0,VALUE:1},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,h=0,k=0,k=a.getField("PORT");"1"==k?(c=3,d=5):"2"==k?(c=11,d=6):"3"==k&&(c=3,d=5,e=11,f=6);k=a.getNumberValue("VALUE", @@ -1934,7 +1934,12 @@ b.removeSelected=function(){this.svgGroup.removeClass("selected")};b.getSkeleton a=a||15;b?window.setTimeout(function(){d._moveBy(a,a,!1)},b):d._moveBy(a,a,!1)};b.bindPrev=function(a){if(a){if(this._toLocalCoordinate(a.view._nextGroup),(a=a.getNextBlock())&&a!==this.block){var b=this.block.getLastBlock();b.view.magnet.next?a.view._toLocalCoordinate(b.view._nextGroup):(a.view._toGlobalCoordinate(),a.separate(),a.view.bumpAway(null,100))}}else if(a=this.block.getPrevBlock())this._toLocalCoordinate(a.view._nextGroup),(a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)}; b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y;return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()};b._updateColor=function(){var a=this._schema.color;this.block.deletable=== Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g,">").replace(/\s+(svgGroup)(defs)', +h=this.svgGroup.cloneNode(!0),k=this._skeleton.box(this);h.setAttribute("transform","scale(1.5) translate(%X,%Y)".replace("%X",-k.offsetX).replace("%Y",-k.offsetY));for(var l=this.getBoard().svgDom.find("defs"),n=this.svgGroup.getBoundingClientRect(),m=h.getElementsByTagName("image"),k=h.getElementsByTagName("text"),q=["\u2265","\u2264"],r="\u2265\u2264-><=+-x/".split(""),t=0;te||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;f -1) + if (content == 'q') { + var y = parseInt(text.getAttribute('y')); + text.setAttribute('y', y-1); + } + + if (notResizeTypes.indexOf(content) > -1) { text.setAttribute('font-size', (size) + 'px'); - else text.setAttribute('font-size', (size * 0.95) + 'px'); + } else text.setAttribute('font-size', (size * 0.95) + 'px'); + + text.setAttribute('alignment-baseline', 'baseline'); })(texts[i]); } @@ -1068,7 +1075,7 @@ Entry.BlockView.DRAG_RADIUS = 5; height: bBox.height }); } else { - loadImage( src, bBox.width, bBox.height) + loadImage( src, bBox.width, bBox.height, 1.5) .then(function(src) { //var download = document.createElement('a'); //download.href = '(src)'.replace('(src)', src); @@ -1086,11 +1093,14 @@ Entry.BlockView.DRAG_RADIUS = 5; } } - function loadImage(src, width, height) { + function loadImage(src, width, height, multiplier) { var deferred = $.Deferred(); + if (!multiplier) multiplier = 1; if (pngMap[src] !== undefined) deferred.resolve(pngMap[src]); + width *= multiplier; + height *= multiplier; //float point cropped width = Math.ceil(width); height = Math.ceil(height); @@ -1098,6 +1108,7 @@ Entry.BlockView.DRAG_RADIUS = 5; var img = document.createElement( "img" ); img.crossOrigin = 'Anonymous'; var canvas = document.createElement( "canvas" ); + canvas.width = width; canvas.height = height; var ctx = canvas.getContext( "2d" ); diff --git a/src/workspace/field/keyboardInput.js b/src/workspace/field/keyboardInput.js index 8a9b62f396..fa476523fe 100644 --- a/src/workspace/field/keyboardInput.js +++ b/src/workspace/field/keyboardInput.js @@ -48,7 +48,7 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldKeyboard); this.svgGroup.elem('text').attr({ x: X_PADDING/2, y: TEXT_Y_PADDING, - 'font-size' : '9pt' + 'font-size' : '11px' }); this.textElement.textContent = Entry.getKeyCodeMap()[this.getValue()]; From cd083d12bb3a28daa0167c7175f36615e38276bf Mon Sep 17 00:00:00 2001 From: vivid Date: Wed, 22 Jun 2016 15:17:44 +0900 Subject: [PATCH 04/31] bold to 500 --- dist/entry.js | 2 +- dist/entry.min.js | 2 +- src/workspace/block_view.js | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index bab6ace7eb..25b3e65653 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -16219,7 +16219,7 @@ Entry.BlockView.DRAG_RADIUS = 5; (function(a) { a.setAttribute("font-family", "'nanumBarunRegular', 'NanumGothic', '\ub098\ub214\uace0\ub515','NanumGothicWeb', '\ub9d1\uc740 \uace0\ub515', 'Malgun Gothic', Dotum"); var b = parseInt(a.getAttribute("font-size")), c = $(a).text(); - -1 < q.indexOf(c) && (a.setAttribute("font-weight", "bold"), a.setAttribute("font-size", b + "px")); + -1 < q.indexOf(c) && a.setAttribute("font-weight", "500"); if ("q" == c) { var d = parseInt(a.getAttribute("y")); a.setAttribute("y", d - 1); diff --git a/dist/entry.min.js b/dist/entry.min.js index 8dcc9ece6d..91163550a6 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1938,7 +1938,7 @@ e="url(#blockHoverPattern_"+this.getBoard().suffix+")");d.attr({fill:e})}};b.add b.getDataUrl=function(a){function b(){g=g.replace("(svgGroup)",(new XMLSerializer).serializeToString(h)).replace("(defs)",(new XMLSerializer).serializeToString(l[0])).replace(/>\s+/g,">").replace(/\s+(svgGroup)(defs)', h=this.svgGroup.cloneNode(!0),k=this._skeleton.box(this);h.setAttribute("transform","scale(1.5) translate(%X,%Y)".replace("%X",-k.offsetX).replace("%Y",-k.offsetY));for(var l=this.getBoard().svgDom.find("defs"),n=this.svgGroup.getBoundingClientRect(),m=h.getElementsByTagName("image"),k=h.getElementsByTagName("text"),q=["\u2265","\u2264"],r="\u2265\u2264-><=+-x/".split(""),t=0;te||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;f -1) { - text.setAttribute('font-weight', 'bold'); - text.setAttribute('font-size', (size) + 'px'); + text.setAttribute('font-weight', '500'); } if (content == 'q') { From ad1bb0b097c0c9f4134bcd4c9e44722de7f328ce Mon Sep 17 00:00:00 2001 From: vivid Date: Thu, 23 Jun 2016 10:37:45 +0900 Subject: [PATCH 05/31] enable function render --- dist/entry.js | 13 +++++++++---- dist/entry.min.js | 10 +++++----- src/function.js | 3 ++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 25b3e65653..b2071a676b 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -12528,8 +12528,10 @@ Entry.Func = function(b) { }; Entry.Func.threads = {}; Entry.Func.registerFunction = function(b) { - var a = Entry.playground.mainWorkspace; - a && (this._targetFuncBlock = a.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_" + b.id}]), b.blockMenuBlock = this._targetFuncBlock); + if (Entry.playground) { + var a = Entry.playground.mainWorkspace; + a && (this._targetFuncBlock = a.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_" + b.id}]), b.blockMenuBlock = this._targetFuncBlock); + } }; Entry.Func.executeFunction = function(b) { var a = this.threads[b]; @@ -12676,8 +12678,11 @@ Entry.Func.createParamBlock = function(b, a, c) { return Entry.block[b] = d; }; Entry.Func.updateMenu = function() { - var b = Entry.playground.mainWorkspace; - b && (b = b.getBlockMenu(), this.targetFunc ? (this.menuCode || this.setupMenuCode(), b.banClass("functionInit"), b.unbanClass("functionEdit")) : (b.unbanClass("functionInit"), b.banClass("functionEdit")), b.reDraw()); + if (Entry.playground && Entry.playground.mainWorkspace) { + var b = Entry.playground.mainWorkspace.getBlockMenu(); + this.targetFunc ? (this.menuCode || this.setupMenuCode(), b.banClass("functionInit"), b.unbanClass("functionEdit")) : (b.unbanClass("functionInit"), b.banClass("functionEdit")); + b.reDraw(); + } }; Entry.Func.prototype.edit = function() { Entry.Func.isEdit || (Entry.Func.isEdit = !0, Entry.Func.svg ? this.parentView.appendChild(this.svg) : Entry.Func.initEditView()); diff --git a/dist/entry.min.js b/dist/entry.min.js index 91163550a6..427fe702da 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1160,10 +1160,10 @@ Entry.Utils.stopProjectWithToast=function(b,a){a=a||"\ub7f0\ud0c0\uc784 \uc5d0\u (function(b){b.generateSchema=function(a){var b=a.schema;if(void 0!==b){b=JSON.parse(JSON.stringify(b));a.data={};for(var d in b)(function(d){a.data[d]=b[d];Object.defineProperty(a,d,{get:function(){return a.data[d]}})})(d);a._toJSON=this._toJSON}};b.generateSetter=function(a){a.set=this.set};b.set=function(a,b){var d={},e;for(e in this.data)void 0!==a[e]&&(a[e]===this.data[e]?delete a[e]:(d[e]=this.data[e],this.data[e]=a[e]instanceof Array?a[e].concat():a[e]));b||this.notify(Object.keys(a),d)};b.generateObserve= function(a){a.observers=[];a.observe=this.observe;a.unobserve=this.unobserve;a.notify=this.notify};b.observe=function(a,b,d,e){d=new Entry.Observer(this.observers,a,b,d);if(!1!==e)a[b]([]);return d};b.unobserve=function(a){a.destroy()};b.notify=function(a,b){"string"===typeof a&&(a=[a]);var d=this;d.observers.map(function(e){var f=a;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,a));if(f.length)e.object[e.funcName](f.map(function(a){return{name:a,object:d,oldValue:b[a]}}))})};b._toJSON=function(){var a= {},b;for(b in this.data)a[b]=this.data[b];return a}})(Entry.Model);Entry.Func=function(b){this.id=b?b.id:Entry.generateHash();this.content=b?new Entry.Code(b.content):new Entry.Code([[{type:"function_create",copyable:!1,deletable:!1,x:40,y:40}]]);this.blockMenuBlock=this.block=null;this.hashMap={};this.paramMap={};var a=function(){};a.prototype=Entry.block.function_general;a=new a;a.changeEvent=new Entry.Event;a.template=Lang.template.function_general;Entry.block["func_"+this.id]=a;if(b){b=this.content._blockMap;for(var c in b)Entry.Func.registerParamBlock(b[c].type); -Entry.Func.generateWsBlock(this)}Entry.Func.registerFunction(this);Entry.Func.updateMenu()};Entry.Func.threads={};Entry.Func.registerFunction=function(b){var a=Entry.playground.mainWorkspace;a&&(this._targetFuncBlock=a.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_"+b.id}]),b.blockMenuBlock=this._targetFuncBlock)};Entry.Func.executeFunction=function(b){var a=this.threads[b];if(a=Entry.Engine.computeThread(a.entity,a))return this.threads[b]=a,!0;delete this.threads[b];return!1}; -Entry.Func.clearThreads=function(){this.threads={}};Entry.Func.prototype.init=function(b){this.id=b.id;this.content=Blockly.Xml.textToDom(b.content);this.block=Blockly.Xml.textToDom(""+b.block+"").childNodes[0]};Entry.Func.prototype.destroy=function(){this.blockMenuBlock.destroy()};Entry.Func.edit=function(b){this.cancelEdit();this.targetFunc=b;this.initEditView(b.content);this.bindFuncChangeEvent();this.updateMenu()}; -Entry.Func.initEditView=function(b){this.menuCode||this.setupMenuCode();var a=Entry.playground.mainWorkspace;a.setMode(Entry.Workspace.MODE_OVERLAYBOARD);a.changeOverlayBoardCode(b);this._workspaceStateEvent=a.changeEvent.attach(this,this.endEdit)};Entry.Func.endEdit=function(b){this.unbindFuncChangeEvent();this._workspaceStateEvent.destroy();delete this._workspaceStateEvent;switch(b){case "save":this.save();case "cancelEdit":this.cancelEdit()}}; -Entry.Func.save=function(){this.targetFunc.generateBlock(!0);Entry.variableContainer.saveFunction(this.targetFunc)}; +Entry.Func.generateWsBlock(this)}Entry.Func.registerFunction(this);Entry.Func.updateMenu()};Entry.Func.threads={};Entry.Func.registerFunction=function(b){if(Entry.playground){var a=Entry.playground.mainWorkspace;a&&(this._targetFuncBlock=a.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_"+b.id}]),b.blockMenuBlock=this._targetFuncBlock)}}; +Entry.Func.executeFunction=function(b){var a=this.threads[b];if(a=Entry.Engine.computeThread(a.entity,a))return this.threads[b]=a,!0;delete this.threads[b];return!1};Entry.Func.clearThreads=function(){this.threads={}};Entry.Func.prototype.init=function(b){this.id=b.id;this.content=Blockly.Xml.textToDom(b.content);this.block=Blockly.Xml.textToDom(""+b.block+"").childNodes[0]};Entry.Func.prototype.destroy=function(){this.blockMenuBlock.destroy()}; +Entry.Func.edit=function(b){this.cancelEdit();this.targetFunc=b;this.initEditView(b.content);this.bindFuncChangeEvent();this.updateMenu()};Entry.Func.initEditView=function(b){this.menuCode||this.setupMenuCode();var a=Entry.playground.mainWorkspace;a.setMode(Entry.Workspace.MODE_OVERLAYBOARD);a.changeOverlayBoardCode(b);this._workspaceStateEvent=a.changeEvent.attach(this,this.endEdit)}; +Entry.Func.endEdit=function(b){this.unbindFuncChangeEvent();this._workspaceStateEvent.destroy();delete this._workspaceStateEvent;switch(b){case "save":this.save();case "cancelEdit":this.cancelEdit()}};Entry.Func.save=function(){this.targetFunc.generateBlock(!0);Entry.variableContainer.saveFunction(this.targetFunc)}; Entry.Func.syncFuncName=function(b){var a=0,c=[],c=b.split(" "),d="";b=[];b=Blockly.mainWorkspace.getAllBlocks();for(var e=0;e Date: Thu, 23 Jun 2016 14:15:52 +0900 Subject: [PATCH 06/31] fix bug --- dist/entry.js | 7 +++++-- dist/entry.min.js | 16 ++++++++-------- src/container.js | 2 ++ src/workspace/block_view.js | 4 ++-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index b2071a676b..c11f7ae41a 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -6451,6 +6451,7 @@ Entry.Container.prototype.moveElementByBlock = function(b, a) { this.updateListView(); }; Entry.Container.prototype.getDropdownList = function(b) { + Entry.playground && Entry.playground.object || (b = null); var a = []; switch(b) { case "sprites": @@ -15715,7 +15716,8 @@ Entry.BlockView = function(b, a, c) { this._observers.push(a.code.observe(this, "_setBoard", ["board"], !1)); this.dragMode = Entry.DRAG_MODE_NONE; Entry.Utils.disableContextmenu(this.svgGroup.node); - (a = b.events.viewAdd) && !this.isInBlockMenu && a.forEach(function(a) { + a = b.events.viewAdd; + "workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) { Entry.Utils.isFunction(a) && a(b); }); }; @@ -16005,7 +16007,8 @@ Entry.BlockView.DRAG_RADIUS = 5; a.constructor !== Entry.Block && a.destroy(); }); var d = this.block; - (a = d.events.viewDestroy) && !this.isInBlockMenu && a.forEach(function(a) { + a = d.events.viewDestroy; + "workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) { Entry.Utils.isFunction(a) && a(d); }); this._schemaChangeEvent && this._schemaChangeEvent.destroy(); diff --git a/dist/entry.min.js b/dist/entry.min.js index 427fe702da..9dc1bceff4 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -701,12 +701,12 @@ Entry.Container.prototype.selectObject=function(b,a){var c=this.getObject(b);a&& Entry.Container.prototype.getObject=function(b){for(var a=this.objects_.length,c=0;c Date: Thu, 23 Jun 2016 16:46:49 +0900 Subject: [PATCH 07/31] variableContainer toJSON edited --- dist/entry.js | 4 ++-- dist/entry.min.js | 2 +- src/variable_container.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index c11f7ae41a..397784ff0d 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -14134,9 +14134,9 @@ Entry.VariableContainer.prototype.getVariableJSON = function() { for (a = 0;a < this.lists_.length;a++) { b.push(this.lists_[a].toJSON()); } - Entry.engine.projectTimer && b.push(Entry.engine.projectTimer); + Entry.engine.projectTimer && b.push(Entry.engine.projectTimer.toJSON()); a = Entry.container.inputValue; - Entry.isEmpty(a) || b.push(a); + Entry.isEmpty(a) || b.push(a.toJSON()); return b; }; Entry.VariableContainer.prototype.getMessageJSON = function() { diff --git a/dist/entry.min.js b/dist/entry.min.js index 9dc1bceff4..f002bad552 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1294,7 +1294,7 @@ Entry.VariableContainer.prototype.createListView=function(b){var a=this,c=Entry. e.bindOnClick(function(c){c.stopPropagation();a.removeList(b);a.selectedList=null;a.listSettingView.addClass("entryRemove")});var f=Entry.createElement("button");f.addClass("entryVariableListElementEditWorkspace");f.bindOnClick(function(c){c.stopPropagation();h.removeAttribute("disabled");g.removeClass("entryRemove");this.addClass("entryRemove");a.updateSelectedVariable(b);h.focus()});c.editButton=f;var g=Entry.createElement("button");g.addClass("entryVariableListElementEditWorkspace");g.addClass("entryRemove"); g.bindOnClick(function(c){c.stopPropagation();h.blur();h.setAttribute("disabled","disabled");f.removeClass("entryRemove");this.addClass("entryRemove");a.select(b);a.updateSelectedVariable(null,"list")});c.editSaveButton=g;var h=Entry.createElement("input");h.setAttribute("disabled","disabled");h.addClass("entryVariableListElementNameWorkspace");h.value=b.name_;h.bindOnClick(function(a){a.stopPropagation()});h.onblur=function(c){(c=this.value.trim())&&0!==c.length?a.changeListName(b,this.value):(Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.list_can_not_space),this.value=b.getName())};h.onkeydown=function(a){13==a.keyCode&&this.blur()};c.nameField=h;d.appendChild(h);d.appendChild(f);d.appendChild(g);d.appendChild(e);b.listElement=c};Entry.VariableContainer.prototype.mapVariable=function(b,a){for(var c=this.variables_.length,d=0;d Date: Thu, 23 Jun 2016 18:02:21 +0900 Subject: [PATCH 08/31] right click download chrome only --- dist/entry.js | 287 +++++++++++++++++++----------------- dist/entry.min.js | 90 +++++------ src/util/utils.js | 5 + src/workspace/block_view.js | 19 ++- 4 files changed, 214 insertions(+), 187 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 397784ff0d..4b4d13b6e9 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -8228,22 +8228,22 @@ Entry.EntryObject.prototype.generateView = function() { var l = Entry.createElement("span"); l.addClass("entryObjectCoordinateSizeWorkspace"); l.innerHTML = Lang.Workspace.Size + " : "; - var n = Entry.createElement("input"); - n.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"); - n.bindOnClick(function(a) { + var q = Entry.createElement("input"); + q.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"); + q.bindOnClick(function(a) { a.stopPropagation(); this.select(); }); - n.setAttribute("readonly", !0); + q.setAttribute("readonly", !0); d.appendChild(e); d.appendChild(g); d.appendChild(h); d.appendChild(k); d.appendChild(l); - d.appendChild(n); + d.appendChild(q); d.xInput_ = g; d.yInput_ = k; - d.sizeInput_ = n; + d.sizeInput_ = q; this.coordinateView_ = d; c = this; g.onkeypress = function(a) { @@ -8262,11 +8262,11 @@ Entry.EntryObject.prototype.generateView = function() { c.updateCoordinateView(); Entry.stage.updateObject(); }; - n.onkeypress = function(a) { + q.onkeypress = function(a) { 13 == a.keyCode && c.editObjectValues(!1); }; - n.onblur = function(a) { - isNaN(n.value) || c.entity.setSize(Number(n.value)); + q.onblur = function(a) { + isNaN(q.value) || c.entity.setSize(Number(q.value)); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8277,48 +8277,48 @@ Entry.EntryObject.prototype.generateView = function() { e = Entry.createElement("span"); e.addClass("entryObjectRotateSpanWorkspace"); e.innerHTML = Lang.Workspace.rotation + " : "; - var m = Entry.createElement("input"); - m.addClass("entryObjectRotateInputWorkspace"); - m.setAttribute("readonly", !0); - m.bindOnClick(function(a) { + var n = Entry.createElement("input"); + n.addClass("entryObjectRotateInputWorkspace"); + n.setAttribute("readonly", !0); + n.bindOnClick(function(a) { a.stopPropagation(); this.select(); }); this.rotateSpan_ = e; - this.rotateInput_ = m; + this.rotateInput_ = n; h = Entry.createElement("span"); h.addClass("entryObjectDirectionSpanWorkspace"); h.innerHTML = Lang.Workspace.direction + " : "; - var q = Entry.createElement("input"); - q.addClass("entryObjectDirectionInputWorkspace"); - q.setAttribute("readonly", !0); - q.bindOnClick(function(a) { + var m = Entry.createElement("input"); + m.addClass("entryObjectDirectionInputWorkspace"); + m.setAttribute("readonly", !0); + m.bindOnClick(function(a) { a.stopPropagation(); this.select(); }); - this.directionInput_ = q; + this.directionInput_ = m; d.appendChild(e); - d.appendChild(m); + d.appendChild(n); d.appendChild(h); - d.appendChild(q); - d.rotateInput_ = m; - d.directionInput_ = q; + d.appendChild(m); + d.rotateInput_ = n; + d.directionInput_ = m; c = this; - m.onkeypress = function(a) { + n.onkeypress = function(a) { 13 == a.keyCode && c.editObjectValues(!1); }; - m.onblur = function(a) { - a = m.value; + n.onblur = function(a) { + a = n.value; -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); isNaN(a) || c.entity.setRotation(Number(a)); c.updateRotationView(); Entry.stage.updateObject(); }; - q.onkeypress = function(a) { + m.onkeypress = function(a) { 13 == a.keyCode && c.editObjectValues(!1); }; - q.onblur = function(a) { - a = q.value; + m.onblur = function(a) { + a = m.value; -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); isNaN(a) || c.entity.setDirection(Number(a)); c.updateRotationView(); @@ -8390,20 +8390,20 @@ Entry.EntryObject.prototype.generateView = function() { if (a = Entry.container.getObject(this.id)) { Entry.container.selectObject(a.id), Entry.playground.injectObject(a); } - }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, b.appendChild(d), this.informationView_ = d, d = Entry.createElement("div"), d.addClass("entryObjectRotateLabelWrapperWorkspace"), this.view_.appendChild(d), this.rotateLabelWrapperView_ = d, e = Entry.createElement("span"), e.addClass("entryObjectRotateSpanWorkspace"), e.innerHTML = Lang.Workspace.rotation + " : ", m = Entry.createElement("input"), - m.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = m, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", q = Entry.createElement("input"), q.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = q, d.appendChild(e), d.appendChild(m), d.appendChild(h), d.appendChild(q), d.rotateInput_ = m, d.directionInput_ = q, c = this, m.onkeypress = function(a) { - 13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(Number(a)), c.updateRotationView(), m.blur()); - }, m.onblur = function(a) { + }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, b.appendChild(d), this.informationView_ = d, d = Entry.createElement("div"), d.addClass("entryObjectRotateLabelWrapperWorkspace"), this.view_.appendChild(d), this.rotateLabelWrapperView_ = d, e = Entry.createElement("span"), e.addClass("entryObjectRotateSpanWorkspace"), e.innerHTML = Lang.Workspace.rotation + " : ", n = Entry.createElement("input"), + n.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = n, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", m = Entry.createElement("input"), m.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = m, d.appendChild(e), d.appendChild(n), d.appendChild(h), d.appendChild(m), d.rotateInput_ = n, d.directionInput_ = m, c = this, n.onkeypress = function(a) { + 13 == a.keyCode && (a = n.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(Number(a)), c.updateRotationView(), n.blur()); + }, n.onblur = function(a) { c.entity.setRotation(c.entity.getRotation()); Entry.stage.updateObject(); - }, q.onkeypress = function(a) { - 13 == a.keyCode && (a = q.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(Number(a)), c.updateRotationView(), q.blur()); - }, q.onblur = function(a) { + }, m.onkeypress = function(a) { + 13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(Number(a)), c.updateRotationView(), m.blur()); + }, m.onblur = function(a) { c.entity.setDirection(c.entity.getDirection()); Entry.stage.updateObject(); }, b = Entry.createElement("div"), b.addClass("entryObjectRotationWrapperWorkspace"), b.object = this, this.view_.appendChild(b), d = Entry.createElement("span"), d.addClass("entryObjectCoordinateWorkspace"), b.appendChild(d), e = Entry.createElement("span"), e.addClass("entryObjectCoordinateSpanWorkspace"), e.innerHTML = "X:", g = Entry.createElement("input"), g.addClass("entryObjectCoordinateInputWorkspace"), h = Entry.createElement("span"), h.addClass("entryObjectCoordinateSpanWorkspace"), - h.innerHTML = "Y:", k = Entry.createElement("input"), k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"), l = Entry.createElement("span"), l.addClass("entryObjectCoordinateSpanWorkspace"), l.innerHTML = Lang.Workspace.Size, n = Entry.createElement("input"), n.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(n), - d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = n, this.coordinateView_ = d, c = this, g.onkeypress = function(a) { + h.innerHTML = "Y:", k = Entry.createElement("input"), k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"), l = Entry.createElement("span"), l.addClass("entryObjectCoordinateSpanWorkspace"), l.innerHTML = Lang.Workspace.Size, q = Entry.createElement("input"), q.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(q), + d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = q, this.coordinateView_ = d, c = this, g.onkeypress = function(a) { 13 == a.keyCode && (isNaN(g.value) || c.entity.setX(Number(g.value)), c.updateCoordinateView(), c.blur()); }, g.onblur = function(a) { c.entity.setX(c.entity.getX()); @@ -9155,14 +9155,14 @@ Entry.Painter.prototype.fill = function() { var c = new createjs.Point(this.stage.mouseX, this.stage.mouseY); c.x = Math.round(c.x); c.y = Math.round(c.y); - for (var d = 4 * (c.y * b + c.x), e = this.colorLayerData.data[d], f = this.colorLayerData.data[d + 1], g = this.colorLayerData.data[d + 2], h = this.colorLayerData.data[d + 3], k, l, c = [[c.x, c.y]], n = Entry.hex2rgb(this.stroke.lineColor);c.length;) { - for (var d = c.pop(), m = d[0], q = d[1], d = 4 * (q * b + m);0 <= q && this.matchColor(d, e, f, g, h);) { - --q, d -= 4 * b; + for (var d = 4 * (c.y * b + c.x), e = this.colorLayerData.data[d], f = this.colorLayerData.data[d + 1], g = this.colorLayerData.data[d + 2], h = this.colorLayerData.data[d + 3], k, l, c = [[c.x, c.y]], q = Entry.hex2rgb(this.stroke.lineColor);c.length;) { + for (var d = c.pop(), n = d[0], m = d[1], d = 4 * (m * b + n);0 <= m && this.matchColor(d, e, f, g, h);) { + --m, d -= 4 * b; } d += 4 * b; - q += 1; - for (l = k = !1;q < a - 1 && this.matchColor(d, e, f, g, h);) { - q += 1, this.colorPixel(d, n.r, n.g, n.b), 0 < m && (this.matchColor(d - 4, e, f, g, h) ? k || (c.push([m - 1, q]), k = !0) : k && (k = !1)), m < b - 1 && (this.matchColor(d + 4, e, f, g, h) ? l || (c.push([m + 1, q]), l = !0) : l && (l = !1)), d += 4 * b; + m += 1; + for (l = k = !1;m < a - 1 && this.matchColor(d, e, f, g, h);) { + m += 1, this.colorPixel(d, q.r, q.g, q.b), 0 < n && (this.matchColor(d - 4, e, f, g, h) ? k || (c.push([n - 1, m]), k = !0) : k && (k = !1)), n < b - 1 && (this.matchColor(d + 4, e, f, g, h) ? l || (c.push([n + 1, m]), l = !0) : l && (l = !1)), d += 4 * b; } if (1080 < c.length) { break; @@ -9706,9 +9706,9 @@ Entry.Painter.prototype.generateView = function(b) { this.attrColorArea = Entry.createElement("fieldset", "entryPainterAttrColor"); this.attrColorArea.addClass("entryPlaygroundPainterAttrColor"); g.appendChild(this.attrColorArea); - var n = Entry.createElement("div"); - n.addClass("entryPlaygroundPainterAttrColorContainer"); - this.attrColorArea.appendChild(n); + var q = Entry.createElement("div"); + q.addClass("entryPlaygroundPainterAttrColorContainer"); + this.attrColorArea.appendChild(q); this.attrCircleArea = Entry.createElement("div"); this.attrCircleArea.addClass("painterAttrCircleArea"); g.appendChild(this.attrCircleArea); @@ -9735,7 +9735,7 @@ Entry.Painter.prototype.generateView = function(b) { document.getElementById("entryPainterAttrCircle").style.backgroundColor = a.stroke.lineColor; document.getElementById("entryPainterAttrCircleInput").value = b; }); - n.appendChild(c); + q.appendChild(c); }); this.attrThickArea = Entry.createElement("div", "painterAttrThickArea"); this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea"); @@ -9744,12 +9744,12 @@ Entry.Painter.prototype.generateView = function(b) { d.addClass("painterAttrThickName"); d.innerHTML = Lang.Workspace.thickness; this.attrThickArea.appendChild(d); - var m = Entry.createElement("fieldset", "entryPainterAttrThick"); - m.addClass("entryPlaygroundPainterAttrThick"); - this.attrThickArea.appendChild(m); + var n = Entry.createElement("fieldset", "entryPainterAttrThick"); + n.addClass("entryPlaygroundPainterAttrThick"); + this.attrThickArea.appendChild(n); d = Entry.createElement("div"); d.addClass("paintAttrThickTop"); - m.appendChild(d); + n.appendChild(d); e = Entry.createElement("select", "entryPainterAttrThick"); e.addClass("entryPlaygroundPainterAttrThickInput"); e.size = "1"; @@ -9759,16 +9759,16 @@ Entry.Painter.prototype.generateView = function(b) { for (d = 1;10 >= d;d++) { c = Entry.createElement("option"), c.value = d, c.innerHTML = d, e.appendChild(c); } - m.appendChild(e); + n.appendChild(e); d = Entry.createElement("div", "entryPainterShapeLineColor"); d.addClass("painterAttrShapeLineColor"); c = Entry.createElement("div", "entryPainterShapeInnerBackground"); c.addClass("painterAttrShapeInnerBackground"); d.appendChild(c); - m.appendChild(d); + n.appendChild(d); this.attrThickArea.painterAttrShapeLineColor = d; - m.bindOnClick(function() { - q.style.zIndex = "1"; + n.bindOnClick(function() { + m.style.zIndex = "1"; this.style.zIndex = "10"; r = !1; }); @@ -9781,13 +9781,13 @@ Entry.Painter.prototype.generateView = function(b) { c = Entry.createElement("div"); c.addClass("paintAttrBackgroundTop"); d.appendChild(c); - var q = Entry.createElement("div", "entryPainterShapeBackgroundColor"); - q.addClass("painterAttrShapeBackgroundColor"); - this.attrBackgroundArea.painterAttrShapeBackgroundColor = q; - c.appendChild(q); + var m = Entry.createElement("div", "entryPainterShapeBackgroundColor"); + m.addClass("painterAttrShapeBackgroundColor"); + this.attrBackgroundArea.painterAttrShapeBackgroundColor = m; + c.appendChild(m); var r = !1; - q.bindOnClick(function(a) { - m.style.zIndex = "1"; + m.bindOnClick(function(a) { + n.style.zIndex = "1"; this.style.zIndex = "10"; r = !0; }); @@ -11808,15 +11808,15 @@ Entry.ContextMenu = {}; var e = this.dom; e.empty(); for (var f = 0, g = a.length;f < g;f++) { - var h = a[f], k = h.text, l = !1 !== h.enable, n = Entry.Dom("li", {class:l ? "menuAble" : "menuDisable", parent:e}); - n.text(k); + var h = a[f], k = h.text, l = !1 !== h.enable, q = Entry.Dom("li", {class:l ? "menuAble" : "menuDisable", parent:e}); + q.text(k); l && h.callback && function(a, b) { a.mousedown(function(a) { a.preventDefault(); d.hide(); b(a); }); - }(n, h.callback); + }(q, h.callback); } e.removeClass("entryRemove"); this.position(Entry.mouseCoordinate); @@ -12432,6 +12432,9 @@ Entry.Utils.stopProjectWithToast = function(b, a) { "workspace" === Entry.type && (Entry.container.selectObject(b.getCode().object.id, !0), b.view.getBoard().activateBlock(b)); throw Error(a); }; +Entry.Utils.isChrome = function() { + return /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); +}; Entry.Model = function(b, a) { var c = Entry.Model; c.generateSchema(b); @@ -12956,12 +12959,12 @@ Entry.HWMonitor = function(b) { } h < f - e && (f = h / 2 + 3, e = -h / 2 - 3); for (;1 < a.length;) { - var k = a.shift(), l = a.pop(), n = e, m = f, q = d; - h <= f - e ? (e += k.width + 5, f -= l.width + 5, q = 0) : 0 === a.length ? (e = (e + f) / 2 - 3, f = e + 6) : (e = Math.max(e, -g / 2 + k.width) + 15, f = Math.min(f, g / 2 - l.width) - 15); - this._movePort(k, e, b, n); - this._movePort(l, f, b, m); + var k = a.shift(), l = a.pop(), q = e, n = f, m = d; + h <= f - e ? (e += k.width + 5, f -= l.width + 5, m = 0) : 0 === a.length ? (e = (e + f) / 2 - 3, f = e + 6) : (e = Math.max(e, -g / 2 + k.width) + 15, f = Math.min(f, g / 2 - l.width) - 15); + this._movePort(k, e, b, q); + this._movePort(l, f, b, n); h -= k.width + l.width + 10; - b += q; + b += m; } a.length && this._movePort(a[0], (f + e - a[0].width) / 2, b, 100); }; @@ -12972,8 +12975,8 @@ Entry.HWMonitor = function(b) { for (var e = listLine = wholeWidth = 0;e < a.length;e++) { wholeWidth += a[e].width; } - for (var f = 0, g = 0, h = initX, k = 0, l = 0, n = 0, e = 0;e < a.length;e++) { - l = a[e], e != a.length - 1 && (n = a[e + 1]), g += l.width, lP = initX, k = initY + 30 * f, l.group.attr({transform:"translate(" + lP + "," + k + ")"}), initX += l.width + 10, g > d - (l.width + n.width / 2.2) && (f += 1, initX = h, g = 0); + for (var f = 0, g = 0, h = initX, k = 0, l = 0, q = 0, e = 0;e < a.length;e++) { + l = a[e], e != a.length - 1 && (q = a[e + 1]), g += l.width, lP = initX, k = initY + 30 * f, l.group.attr({transform:"translate(" + lP + "," + k + ")"}), initX += l.width + 10, g > d - (l.width + q.width / 2.2) && (f += 1, initX = h, g = 0); } }; b._movePort = function(a, b, d, e) { @@ -15919,12 +15922,20 @@ Entry.BlockView.DRAG_RADIUS = 5; Entry.do("cloneBlock", k); }}, l = {text:Lang.Blocks.CONTEXT_COPY_option, enable:this.copyable, callback:function() { h.block.copyToClipboard(); - }}, n = {text:Lang.Blocks.Delete_Blocks, enable:k.isDeletable(), callback:function() { + }}, q = {text:Lang.Blocks.Delete_Blocks, enable:k.isDeletable(), callback:function() { Entry.do("destroyBlock", h.block); + }}, n = {text:"\uc774\ubbf8\uc9c0\ub85c \uc800\uc7a5\ud558\uae30", callback:function() { + h.getDataUrl().then(function(a) { + var b = document.createElement("a"); + b.href = a.src; + b.download = "\uc5d4\ud2b8\ub9ac \ube14\ub85d.png"; + b.click(); + }); }}; f.push(g); f.push(l); - f.push(n); + f.push(q); + Entry.Utils.isChrome() && "workspace" == Entry.type && f.push(n); Entry.ContextMenu.show(f); } } @@ -16189,8 +16200,8 @@ Entry.BlockView.DRAG_RADIUS = 5; function b() { g = g.replace("(svgGroup)", (new XMLSerializer).serializeToString(h)).replace("(defs)", (new XMLSerializer).serializeToString(l[0])).replace(/>\s+/g, ">").replace(/\s+>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.move_line=function(){this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").moveTo(this.oldPt.x,this.oldPt.y).lineTo(this.stage.mouseX,this.stage.mouseY);this.file.modified=!0;this.stage.update()}; @@ -972,9 +972,9 @@ this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);th d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); Entry.getColourCodes().forEach(function(b){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=b;c.bindOnClick(function(c){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});n.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); -var m=Entry.createElement("fieldset","entryPainterAttrThick");m.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(m);d=Entry.createElement("div");d.addClass("paintAttrThickTop");m.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);m.appendChild(e); -d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);m.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;m.bindOnClick(function(){q.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var q=Entry.createElement("div","entryPainterShapeBackgroundColor");q.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=q;c.appendChild(q);var r=!1;q.bindOnClick(function(a){m.style.zIndex= +var q=Entry.createElement("fieldset","entryPainterAttrThick");q.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(q);d=Entry.createElement("div");d.addClass("paintAttrThickTop");q.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);q.appendChild(e); +d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);q.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;q.bindOnClick(function(){m.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); +g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(a){q.style.zIndex= "1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", "entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); @@ -1156,7 +1156,7 @@ Entry.Utils.addFilters=function(b,a){var c=b.elem("defs"),d=c.elem("filter",{id: {result:"matrixOut",in:"offOut",type:"matrix",values:"0.7 0 0 0 0 0 0.7 0 0 0 0 0 0.7 0 0 0 0 0 1 0"});d.elem("feBlend",{in:"SourceGraphic",in1:"offOut",mode:"normal"});c=c.elem("filter",{id:"entryBlockHighlightFilter_"+a});c.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:0});c.elem("feColorMatrix",{result:"matrixOut",in:"offOut",type:"matrix",values:"1.3 0 0 0 0 0 1.3 0 0 0 0 0 1.3 0 0 0 0 0 1 0"})}; Entry.Utils.addBlockPattern=function(b,a){for(var c=b.elem("pattern",{id:"blockHoverPattern_"+a,class:"blockHoverPattern",patternUnits:"userSpaceOnUse",patternTransform:"translate(12, 0)",x:0,y:0,width:125,height:33}).elem("g"),d=c.elem("rect",{x:0,y:0,width:125,height:33}),e=Entry.mediaFilePath+"block_pattern_(order).png",f=1;5>f;f++)c.elem("image",{class:"pattern"+f,href:e.replace("(order)",f),x:0,y:0,width:125,height:33});return d};Entry.Utils.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4}; Entry.Utils.createMouseEvent=function(b,a){var c=document.createEvent("MouseEvent");c.initMouseEvent(b,!0,!0,window,0,0,0,a.clientX,a.clientY,!1,!1,!1,!1,0,null);return c};Entry.Utils.xmlToJsonData=function(b){b=$.parseXML(b);var a=[];b=b.childNodes[0].childNodes;for(var c in b){var d=b[c];if(d.tagName){var e={category:d.getAttribute("id"),blocks:[]},d=d.childNodes;for(c in d){var f=d[c];f.tagName&&(f=f.getAttribute("type"))&&e.blocks.push(f)}a.push(e)}}return a}; -Entry.Utils.stopProjectWithToast=function(b,a){a=a||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(Entry.container.selectObject(b.getCode().object.id,!0),b.view.getBoard().activateBlock(b));throw Error(a);};Entry.Model=function(b,a){var c=Entry.Model;c.generateSchema(b);c.generateSetter(b);c.generateObserve(b);(void 0===a||a)&&Object.seal(b);return b}; +Entry.Utils.stopProjectWithToast=function(b,a){a=a||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(Entry.container.selectObject(b.getCode().object.id,!0),b.view.getBoard().activateBlock(b));throw Error(a);};Entry.Utils.isChrome=function(){return/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())};Entry.Model=function(b,a){var c=Entry.Model;c.generateSchema(b);c.generateSetter(b);c.generateObserve(b);(void 0===a||a)&&Object.seal(b);return b}; (function(b){b.generateSchema=function(a){var b=a.schema;if(void 0!==b){b=JSON.parse(JSON.stringify(b));a.data={};for(var d in b)(function(d){a.data[d]=b[d];Object.defineProperty(a,d,{get:function(){return a.data[d]}})})(d);a._toJSON=this._toJSON}};b.generateSetter=function(a){a.set=this.set};b.set=function(a,b){var d={},e;for(e in this.data)void 0!==a[e]&&(a[e]===this.data[e]?delete a[e]:(d[e]=this.data[e],this.data[e]=a[e]instanceof Array?a[e].concat():a[e]));b||this.notify(Object.keys(a),d)};b.generateObserve= function(a){a.observers=[];a.observe=this.observe;a.unobserve=this.unobserve;a.notify=this.notify};b.observe=function(a,b,d,e){d=new Entry.Observer(this.observers,a,b,d);if(!1!==e)a[b]([]);return d};b.unobserve=function(a){a.destroy()};b.notify=function(a,b){"string"===typeof a&&(a=[a]);var d=this;d.observers.map(function(e){var f=a;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,a));if(f.length)e.object[e.funcName](f.map(function(a){return{name:a,object:d,oldValue:b[a]}}))})};b._toJSON=function(){var a= {},b;for(b in this.data)a[b]=this.data[b];return a}})(Entry.Model);Entry.Func=function(b){this.id=b?b.id:Entry.generateHash();this.content=b?new Entry.Code(b.content):new Entry.Code([[{type:"function_create",copyable:!1,deletable:!1,x:40,y:40}]]);this.blockMenuBlock=this.block=null;this.hashMap={};this.paramMap={};var a=function(){};a.prototype=Entry.block.function_general;a=new a;a.changeEvent=new Entry.Event;a.template=Lang.template.function_general;Entry.block["func_"+this.id]=a;if(b){b=this.content._blockMap;for(var c in b)Entry.Func.registerParamBlock(b[c].type); @@ -1191,7 +1191,7 @@ b[h],0d-(l.width+n.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+d+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,12:Entry.SensorBoard,13:Entry.CODEino,15:Entry.dplay,16:Entry.nemoino,17:Entry.Xbot,18:Entry.ardublock,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick,42:Entry.Arduino,51:Entry.Neobot,71:Entry.Robotis_carCont, 72:Entry.Robotis_openCM70,81:Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; @@ -1860,9 +1860,9 @@ params:["180"]},null],type:"dplay_servo"},paramsKeyMap:{VALUE:0},"class":"dplay_ e);Entry.hw.setDigitalPortValue(6,f);Entry.hw.setDigitalPortValue(11,g);return a.callReturn()}},dplay_Robot_run_sec:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub85c\ubd07\uc744 %1 \ucd08 \ub3d9\uc548 %2 \ud558\uae30 %3",params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[["\uc804\uc9c4","1"],["\ud6c4\uc9c4","2"],["\uc6b0\ud68c\uc804","3"],["\uc88c\ud68c\uc804","4"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png", size:12}],events:{},def:{params:[{type:"text",params:["1"]},null,null],type:"dplay_Robot_run_sec"},paramsKeyMap:{VALUE:0,PORT:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=Entry.dplay.Left_value,h=Entry.dplay.Right_value,k=a.getField("PORT");if(a.isStart){if(1==a.timeFlag)return"1"==k?(c=0,d=g,e=h,f=0):"2"==k?(c=g,e=d=0,f=h):"3"==k?(c=0,d=g,f=e=0):"4"==k&&(d=c=0,e=h,f=0),Entry.hw.setDigitalPortValue(3,c),Entry.hw.setDigitalPortValue(5,d),Entry.hw.setDigitalPortValue(6, e),Entry.hw.setDigitalPortValue(11,f),a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;f=e=d=c=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;var c=1E3*a.getNumberValue("VALUE"),l=setTimeout(function(){a.timeFlag=0;Entry.dplay.removeTimeout(l)},c);Entry.dplay.timeouts.push(l);return a}},dplay_robot_speed_sel:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"%1 \ubc14\ud034 \uc18d\ub3c4\ub97c %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",params:[{type:"Dropdown", -options:[["\uc67c\ucabd","1"],["\uc624\ub978\ucabd","2"],["\uc591\ucabd","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"dplay_robot_speed_sel"},paramsKeyMap:{PORT:0,VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,h=0,k=0,l=0,n=0,m=a.getField("PORT"),q=a.getNumberValue("VALUE", -a),q=Math.max(q,-100),q=Math.min(q,100);"1"==m&&(c=3,d=5,0q?(n=Math.round(q-155),g=-n,h=0,Entry.dplay.Left_value=g):0==q&&(h=g=0,Entry.dplay.Left_value=0));"2"==m&&(e=6,f=11,0q?(n=Math.round(q-155),k=-n,l=0,Entry.dplay.Right_value=k):0==q&&(l=k=0,Entry.dplay.Right_value=k));"3"==m&&(c=3,d=5,e=6,f=11,0q?(n=Math.round(q-155),g=-n,h=0,k=-n,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==q&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f, +options:[["\uc67c\ucabd","1"],["\uc624\ub978\ucabd","2"],["\uc591\ucabd","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"dplay_robot_speed_sel"},paramsKeyMap:{PORT:0,VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,h=0,k=0,l=0,n=0,q=a.getField("PORT"),m=a.getNumberValue("VALUE", +a),m=Math.max(m,-100),m=Math.min(m,100);"1"==q&&(c=3,d=5,0m?(n=Math.round(m-155),g=-n,h=0,Entry.dplay.Left_value=g):0==m&&(h=g=0,Entry.dplay.Left_value=0));"2"==q&&(e=6,f=11,0m?(n=Math.round(m-155),k=-n,l=0,Entry.dplay.Right_value=k):0==m&&(l=k=0,Entry.dplay.Right_value=k));"3"==q&&(c=3,d=5,e=6,f=11,0m?(n=Math.round(m-155),g=-n,h=0,k=-n,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==m&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f, k),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var r=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(r)},50);Entry.dplay.timeouts.push(r);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,g=0,g=a.getNumberValue("L_VALUE",a),g=Math.max(g,-100),g=Math.min(g,100);0g?(g=Math.round(g-155),c=-g,d=0,Entry.dplay.Left_value=c):0==g&&(d=c=0,Entry.dplay.Left_value= 0);g=a.getNumberValue("R_VALUE",a);g=Math.max(g,-100);g=Math.min(g,100);0g?(g=Math.round(g-155),e=-g,f=0,Entry.dplay.Right_value=e):0==g&&(f=e=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(3,c),Entry.hw.setDigitalPortValue(5,d), @@ -1919,27 +1919,27 @@ b.onMouseDown=function(a){function c(a){a.stopPropagation();var c=e.workspace.ge Entry.DRAG_MODE_DRAG,m.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(m,c),a=!0),this.animating&&this.set({animating:!1}),0===m.dragInstance.height&&m.dragInstance.set({height:-1+m.height}),c=m.dragInstance,m._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),m.originPos||(m.originPos={x:m.x,y:m.y}),a&&e.generateCodeMagnetMap(),m._updateCloseBlock()))}function d(a){$(document).unbind(".block");m.terminateDrag(a);e&&e.set({dragBlock:null}); m._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete m.dragInstance}a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();this._changeFill(!1);var e=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(a);if(!this.readOnly&&!e.viewOnly){e.setSelectedBlock(this);this.dominate();if(0===a.button||a.originalEvent&&a.originalEvent.touches){var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;this.mouseDownCoordinate= {x:f.pageX,y:f.pageY};var g=$(document);g.bind("mousemove.block touchmove.block",c);g.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:f.pageX,startY:f.pageY,offsetX:f.pageX,offsetY:f.pageY,height:0,mode:!0});e.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN}else if(Entry.Utils.isRightButton(a)){var h=this,k=h.block;if(this.isInBlockMenu)return;f=[];var g={text:Lang.Blocks.Duplication_option,enable:this.copyable,callback:function(){Entry.do("cloneBlock", -k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},n={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}};f.push(g);f.push(l);f.push(n);Entry.ContextMenu.show(f)}var m=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event))}};b.vimBoardEvent=function(a,b,d){a&&(a= -Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(d===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew, -g=Entry.GlobalSvg;a=!1;var h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode=d,b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")): -Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"),f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}b.setMagnetedBlock(null); -a&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};b._updateCloseBlock=function(){var a=this.getBoard(),b;if(this._skeleton.magnets){for(var d in this.magnet)if(b="next"===d?this.getBoard().getNearestMagnet(this.x,this.y+this.getBelowHeight(),d):this.getBoard().getNearestMagnet(this.x,this.y,d))return a.setMagnetedBlock(b.view,d);a.setMagnetedBlock(null)}};b.dominate=function(){this.block.getThread().view.dominate()};b.getSvgRoot=function(){for(var a= -this.getBoard().svgBlockGroup,b=this.svgGroup;b.parentNode!==a;)b=b.parentNode;return b};b.getBoard=function(){return this._board};b._setBoard=function(){this._board=this._board.code.board};b.destroy=function(a){this._destroyObservers();var b=this.svgGroup;a?$(b).fadeOut(100,function(){b.remove()}):b.remove();this._contents.forEach(function(a){a.constructor!==Entry.Block&&a.destroy()});var d=this.block;a=d.events.viewDestroy;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&& -a(d)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};b.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow));return this._shadow};b.destroyShadow=function(){this._shadow&&(this._shadow.remove(),delete this._shadow)};b._updateMagnet=function(){if(this._skeleton.magnets){var a=this._skeleton.magnets(this);a.next&&this._nextGroup.attr("transform","translate("+a.next.x+","+a.next.y+ -")");this.magnet=a;this.block.getThread().changeEvent.notify()}};b._updateBG=function(){if(this._board.dragBlock&&this._board.dragBlock.dragInstance){var a=this.svgGroup;if(this.magnet.next){if(a=this.magneting){var b=this._board.dragBlock.getShadow(),d=this.getAbsoluteCoordinate(),e;if("previous"===a)e=this.magnet.next,e="translate("+(d.x+e.x)+","+(d.y+e.y)+")";else if("next"===a){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(d.x+e.x)+","+(d.y+e.y-f)+")"}$(b).attr({transform:e, -display:"block"});this._clonedShadow=b;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===a&&(a=this._board.dragBlock.getBelowHeight()+this.offsetY,this.originalHeight=this.offsetY,this.set({offsetY:a}))}else this._clonedShadow&&(this._clonedShadow.attr({display:"none"}),delete this._clonedShadow),a=this.originalHeight,void 0!==a&&(this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background, -delete this.nextBackground),this.set({offsetY:a}),delete this.originalHeight);(a=this.block.thread.changeEvent)&&a.notify()}else this.magneting?(a.attr({filter:"url(#entryBlockHighlightFilter_"+this.getBoard().suffix+")"}),a.addClass("outputHighlight")):(a.removeClass("outputHighlight"),a.removeAttr("filter"))}};b.addDragging=function(){this.svgGroup.addClass("dragging")};b.removeDragging=function(){this.svgGroup.removeClass("dragging")};b.addSelected=function(){this.svgGroup.addClass("selected")}; -b.removeSelected=function(){this.svgGroup.removeClass("selected")};b.getSkeleton=function(){return this._skeleton};b.getContentPos=function(){return this._skeleton.contentPos(this)};b.renderText=function(){this._startContentRender(Entry.Workspace.MODE_VIMBOARD)};b.renderBlock=function(){this._startContentRender(Entry.Workspace.MODE_BOARD)};b._updateOpacity=function(){this.svgGroup.attr({opacity:!1===this.visible?0:1});this.visible&&this._setPosition()};b._updateShadow=function(){this.shadow&&Entry.Utils.colorDarken(this._schema.color, -.7)};b._setMovable=function(){this.movable=null!==this.block.isMovable()?this.block.isMovable():void 0!==this._skeleton.movable?this._skeleton.movable:!0};b._setReadOnly=function(){this.readOnly=null!==this.block.isReadOnly()?this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly:!1};b._setCopyable=function(){this.copyable=null!==this.block.isCopyable()?this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable:!0};b.bumpAway=function(a,b){var d=this; -a=a||15;b?window.setTimeout(function(){d._moveBy(a,a,!1)},b):d._moveBy(a,a,!1)};b.bindPrev=function(a){if(a){if(this._toLocalCoordinate(a.view._nextGroup),(a=a.getNextBlock())&&a!==this.block){var b=this.block.getLastBlock();b.view.magnet.next?a.view._toLocalCoordinate(b.view._nextGroup):(a.view._toGlobalCoordinate(),a.separate(),a.view.bumpAway(null,100))}}else if(a=this.block.getPrevBlock())this._toLocalCoordinate(a.view._nextGroup),(a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)}; -b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y;return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()};b._updateColor=function(){var a=this._schema.color;this.block.deletable=== -Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g,">").replace(/\s+(svgGroup)(defs)', -h=this.svgGroup.cloneNode(!0),k=this._skeleton.box(this);h.setAttribute("transform","scale(1.5) translate(%X,%Y)".replace("%X",-k.offsetX).replace("%Y",-k.offsetY));for(var l=this.getBoard().svgDom.find("defs"),n=this.svgGroup.getBoundingClientRect(),m=h.getElementsByTagName("image"),k=h.getElementsByTagName("text"),q=["\u2265","\u2264"],r="\u2265\u2264-><=+-x/".split(""),t=0;t\s+/g,">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.cloneNode(!0),k=this._skeleton.box(this);h.setAttribute("transform","scale(1.5) translate(%X,%Y)".replace("%X",-k.offsetX).replace("%Y",-k.offsetY));for(var l=this.getBoard().svgDom.find("defs"),n= +this.svgGroup.getBoundingClientRect(),q=h.getElementsByTagName("image"),k=h.getElementsByTagName("text"),m=["\u2265","\u2264"],r="\u2265\u2264-><=+-x/".split(""),t=0;te||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;fg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint=f.point}this._magnetMap[b]=d}};b._getCodeBlocks=function(a,b){var d=a.getThreads(),e=[],f;switch(b){case "previous":f=this._getNextMagnets; -break;case "next":f=this._getPreviousMagnets;break;case "string":f=this._getFieldMagnets;break;case "boolean":f=this._getFieldMagnets;break;case "param":f=this._getOutputMagnets;break;default:return[]}for(var g=0;gd.endPoint)f=h+1;else{e=d.blocks;for(f=0;f Date: Fri, 24 Jun 2016 09:57:32 +0900 Subject: [PATCH 09/31] edit getDataUrl --- dist/entry.js | 68 +++++++++++++++--------------- dist/entry.min.js | 84 ++++++++++++++++++------------------- src/workspace/block_view.js | 4 +- 3 files changed, 79 insertions(+), 77 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index bdc60e5a0e..af139eda87 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -9849,40 +9849,40 @@ Entry.Painter.prototype.generateView = function(b) { this.attrLineArea = Entry.createElement("div", "painterAttrLineStyle"); this.attrLineArea.addClass("entryPlaygroundPainterAttrLineStyle"); g.appendChild(this.attrLineArea); - var t = Entry.createElement("div"); - t.addClass("entryPlaygroundPainterAttrLineStyleLine"); - this.attrLineArea.appendChild(t); var u = Entry.createElement("div"); - u.addClass("entryPlaygroundPaitnerAttrLineArea"); + u.addClass("entryPlaygroundPainterAttrLineStyleLine"); this.attrLineArea.appendChild(u); + var t = Entry.createElement("div"); + t.addClass("entryPlaygroundPaitnerAttrLineArea"); + this.attrLineArea.appendChild(t); d = Entry.createElement("div"); d.addClass("entryPlaygroundPainterAttrLineStyleLine1"); - u.appendChild(d); + t.appendChild(d); d.value = "line"; var v = Entry.createElement("div"); v.addClass("painterAttrLineStyleBackgroundLine"); - t.bindOnClick(function(a) { - u.removeClass("entryRemove"); + u.bindOnClick(function(a) { + t.removeClass("entryRemove"); }); - u.blur = function(a) { + t.blur = function(a) { this.addClass("entryRemove"); }; - u.onmouseleave = function(a) { + t.onmouseleave = function(a) { this.addClass("entryRemove"); }; d.bindOnClick(function(a) { - this.attrLineArea.removeClass(t); + this.attrLineArea.removeClass(u); this.attrLineArea.appendChild(v); this.attrLineArea.onchange(a); - u.blur(); + t.blur(); }); v.bindOnClick(function(a) { - u.removeClass("entryRemove"); + t.removeClass("entryRemove"); }); this.attrLineArea.onchange = function(b) { a.stroke.style = b.target.value; }; - u.blur(); + t.blur(); } }; Entry.Painter.prototype.restoreHandle = function() { @@ -11666,8 +11666,8 @@ Entry.BlockDriver = function() { return d; } for (var e = 0;e < a.length;e++) { - var f = a[e], g = f.tagName, h = $(f).children()[0], t = f.getAttribute("name"); - "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(b(h)), d.index[t] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[t] = d.params.length - 1); + var f = a[e], g = f.tagName, h = $(f).children()[0], u = f.getAttribute("name"); + "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(b(h)), d.index[u] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[u] = d.params.length - 1); } return d; } @@ -16198,10 +16198,10 @@ Entry.BlockView.DRAG_RADIUS = 5; }; b.getDataUrl = function(a) { function b() { - g = g.replace("(svgGroup)", (new XMLSerializer).serializeToString(h)).replace("(defs)", (new XMLSerializer).serializeToString(l[0])).replace(/>\s+/g, ">").replace(/\s+\s+/g, ">").replace(/\s+>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.move_line=function(){this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").moveTo(this.oldPt.x,this.oldPt.y).lineTo(this.stage.mouseX,this.stage.mouseY);this.file.modified=!0;this.stage.update()}; @@ -968,19 +968,19 @@ e.addClass("entryPlaygroundPainterAttrResizeXTop");e.innerHTML="X";c.appendChild c.innerHTML="x";d.appendChild(c);c=Entry.createElement("div");c.addClass("entryPlaygroundAttrReiszeY");d.appendChild(c);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrResizeYTop");d.innerHTML="Y";c.appendChild(d);this.objectHeightInput=Entry.createElement("input","entryPainterAttrHeight");this.objectHeightInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;a.handle.height=this.value;a.updateImageHandle()}; this.objectHeightInput.addClass("entryPlaygroundPainterNumberInput");c.appendChild(this.objectHeightInput);this.attrRotateArea=Entry.createElement("div","painterAttrRotateArea");this.attrRotateArea.addClass("painterAttrRotateArea");g.appendChild(this.attrRotateArea);d=Entry.createElement("div");d.addClass("painterAttrRotateName");d.innerHTML=Lang.Workspace.picture_rotation;this.attrRotateArea.appendChild(d);d=Entry.createElement("fieldset","entryPainterAttrRotate");d.addClass("entryPlaygroundPainterAttrRotate"); this.attrRotateArea.appendChild(d);c=Entry.createElement("div");c.addClass("painterAttrRotateTop");c.innerHTML="\u03bf";d.appendChild(c);this.objectRotateInput=Entry.createElement("input","entryPainterAttrDegree");this.objectRotateInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;360<=this.value?this.value%=360:0>this.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); -this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var n=Entry.createElement("div");n.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(n);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); +this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var q=Entry.createElement("div");q.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(q);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); Entry.getColourCodes().forEach(function(b){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=b;c.bindOnClick(function(c){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= -b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});n.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); -var q=Entry.createElement("fieldset","entryPainterAttrThick");q.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(q);d=Entry.createElement("div");d.addClass("paintAttrThickTop");q.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);q.appendChild(e); -d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);q.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;q.bindOnClick(function(){m.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(a){q.style.zIndex= +b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});q.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); +var n=Entry.createElement("fieldset","entryPainterAttrThick");n.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(n);d=Entry.createElement("div");d.addClass("paintAttrThickTop");n.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);n.appendChild(e); +d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);n.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;n.bindOnClick(function(){m.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); +g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(a){n.style.zIndex= "1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", "entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(b){a.font.style=b.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;dd.style.opacity&&(clearInterval(a),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryRemove");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.BlockDriver=function(){}; -(function(b){b.convert=function(){var a=new Date,b;for(b in Entry.block)"function"===typeof Entry.block[b]&&this._convertBlock(b);console.log((new Date).getTime()-a.getTime())};b._convertBlock=function(a){function b(a){var d={type:a.getAttribute("type"),index:{}};a=$(a).children();if(!a)return d;for(var e=0;eg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||Entry.dispatchEvent("loadComplete")};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;dg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||Entry.dispatchEvent("loadComplete")};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;d=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; Entry.Utils.colorDarken=function(b,a){function c(a){2!=a.length&&(a="0"+a);return a}var d,e,f;7===b.length?(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),f=parseInt(b.substr(5,2),16)):(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),f=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;d=c(Math.floor(d*a).toString(16));e=c(Math.floor(e*a).toString(16));f=c(Math.floor(f*a).toString(16));return"#"+d+e+f}; Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;var c=Entry.Utils.hexToHsl(b);c.l+=a/100;c.l=Math.min(1,Math.max(0,c.l));return Entry.Utils.hslToHex(c)};Entry.Utils.bound01=function(b,a){var c=b;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(b="100%");c="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));c&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; @@ -1191,8 +1191,8 @@ b[h],0d-(l.width+n.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; +b,tP,h),this._movePort(rPort,b,bP,k))};b._alignNS=function(a,b,d){for(var e=-this._rect.width/2,f=this._rect.width/2,g=this._rect.width,h=0,k=0;kd-(l.width+q.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+d+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,12:Entry.SensorBoard,13:Entry.CODEino,15:Entry.dplay,16:Entry.nemoino,17:Entry.Xbot,18:Entry.ardublock,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick,42:Entry.Arduino,51:Entry.Neobot,71:Entry.Robotis_carCont, 72:Entry.Robotis_openCM70,81:Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,c;this.connected=!1;this.connectTrial++;if(-1m?(n=Math.round(m-155),g=-n,h=0,Entry.dplay.Left_value=g):0==m&&(h=g=0,Entry.dplay.Left_value=0));"2"==q&&(e=6,f=11,0m?(n=Math.round(m-155),k=-n,l=0,Entry.dplay.Right_value=k):0==m&&(l=k=0,Entry.dplay.Right_value=k));"3"==q&&(c=3,d=5,e=6,f=11,0m?(n=Math.round(m-155),g=-n,h=0,k=-n,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==m&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f, +options:[["\uc67c\ucabd","1"],["\uc624\ub978\ucabd","2"],["\uc591\ucabd","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"dplay_robot_speed_sel"},paramsKeyMap:{PORT:0,VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,h=0,k=0,l=0,q=0,n=a.getField("PORT"),m=a.getNumberValue("VALUE", +a),m=Math.max(m,-100),m=Math.min(m,100);"1"==n&&(c=3,d=5,0m?(q=Math.round(m-155),g=-q,h=0,Entry.dplay.Left_value=g):0==m&&(h=g=0,Entry.dplay.Left_value=0));"2"==n&&(e=6,f=11,0m?(q=Math.round(m-155),k=-q,l=0,Entry.dplay.Right_value=k):0==m&&(l=k=0,Entry.dplay.Right_value=k));"3"==n&&(c=3,d=5,e=6,f=11,0m?(q=Math.round(m-155),g=-q,h=0,k=-q,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==m&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f, k),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var r=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(r)},50);Entry.dplay.timeouts.push(r);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,g=0,g=a.getNumberValue("L_VALUE",a),g=Math.max(g,-100),g=Math.min(g,100);0g?(g=Math.round(g-155),c=-g,d=0,Entry.dplay.Left_value=c):0==g&&(d=c=0,Entry.dplay.Left_value= 0);g=a.getNumberValue("R_VALUE",a);g=Math.max(g,-100);g=Math.min(g,100);0g?(g=Math.round(g-155),e=-g,f=0,Entry.dplay.Right_value=e):0==g&&(f=e=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(3,c),Entry.hw.setDigitalPortValue(5,d), @@ -1919,8 +1919,8 @@ b.onMouseDown=function(a){function c(a){a.stopPropagation();var c=e.workspace.ge Entry.DRAG_MODE_DRAG,m.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(m,c),a=!0),this.animating&&this.set({animating:!1}),0===m.dragInstance.height&&m.dragInstance.set({height:-1+m.height}),c=m.dragInstance,m._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),m.originPos||(m.originPos={x:m.x,y:m.y}),a&&e.generateCodeMagnetMap(),m._updateCloseBlock()))}function d(a){$(document).unbind(".block");m.terminateDrag(a);e&&e.set({dragBlock:null}); m._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete m.dragInstance}a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();this._changeFill(!1);var e=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(a);if(!this.readOnly&&!e.viewOnly){e.setSelectedBlock(this);this.dominate();if(0===a.button||a.originalEvent&&a.originalEvent.touches){var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;this.mouseDownCoordinate= {x:f.pageX,y:f.pageY};var g=$(document);g.bind("mousemove.block touchmove.block",c);g.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:f.pageX,startY:f.pageY,offsetX:f.pageX,offsetY:f.pageY,height:0,mode:!0});e.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN}else if(Entry.Utils.isRightButton(a)){var h=this,k=h.block;if(this.isInBlockMenu)return;f=[];var g={text:Lang.Blocks.Duplication_option,enable:this.copyable,callback:function(){Entry.do("cloneBlock", -k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},n={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},q={text:"\uc774\ubbf8\uc9c0\ub85c \uc800\uc7a5\ud558\uae30",callback:function(){h.getDataUrl().then(function(a){var b=document.createElement("a");b.href=a.src;b.download="\uc5d4\ud2b8\ub9ac \ube14\ub85d.png";b.click()})}};f.push(g);f.push(l);f.push(n);Entry.Utils.isChrome()&& -"workspace"==Entry.type&&f.push(q);Entry.ContextMenu.show(f)}var m=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode(); +k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},q={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},n={text:"\uc774\ubbf8\uc9c0\ub85c \uc800\uc7a5\ud558\uae30",callback:function(){h.getDataUrl().then(function(a){var b=document.createElement("a");b.href=a.src;b.download="\uc5d4\ud2b8\ub9ac \ube14\ub85d.png";b.click()})}};f.push(g);f.push(l);f.push(q);Entry.Utils.isChrome()&& +"workspace"==Entry.type&&f.push(n);Entry.ContextMenu.show(f)}var m=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode(); this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(d===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg;a=!1;var h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock", e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode=d,b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"), this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"),f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}b.setMagnetedBlock(null);a&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};b._updateCloseBlock=function(){var a=this.getBoard(),b;if(this._skeleton.magnets){for(var d in this.magnet)if(b= @@ -1935,11 +1935,11 @@ this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly b.view.magnet.next?a.view._toLocalCoordinate(b.view._nextGroup):(a.view._toGlobalCoordinate(),a.separate(),a.view.bumpAway(null,100))}}else if(a=this.block.getPrevBlock())this._toLocalCoordinate(a.view._nextGroup),(a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)};b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y; return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()};b._updateColor=function(){var a=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g,">").replace(/\s+\s+/g,">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.cloneNode(!0),k=this._skeleton.box(this);h.setAttribute("transform","scale(1.5) translate(%X,%Y)".replace("%X",-k.offsetX).replace("%Y",-k.offsetY));for(var l=this.getBoard().svgDom.find("defs"),n= -this.svgGroup.getBoundingClientRect(),q=h.getElementsByTagName("image"),k=h.getElementsByTagName("text"),m=["\u2265","\u2264"],r="\u2265\u2264-><=+-x/".split(""),t=0;t(svgGroup)(defs)',h=this.svgGroup.cloneNode(!0),k=this._skeleton.box(this),l=a?1:1.5;h.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X",-k.offsetX).replace("%Y",-k.offsetY).replace("%SCALE",l));for(var q=this.getBoard().svgDom.find("defs"), +n=this.svgGroup.getBoundingClientRect(),m=h.getElementsByTagName("image"),k=h.getElementsByTagName("text"),r=["\u2265","\u2264"],u="\u2265\u2264-><=+-x/".split(""),l=0;le||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;fg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint=f.point}this._magnetMap[b]=d}};b._getCodeBlocks=function(a,b){var d=a.getThreads(),e=[],f;switch(b){case "previous":f=this._getNextMagnets; -break;case "next":f=this._getPreviousMagnets;break;case "string":f=this._getFieldMagnets;break;case "boolean":f=this._getFieldMagnets;break;case "param":f=this._getOutputMagnets;break;default:return[]}for(var g=0;gd.endPoint)f=h+1;else{e=d.blocks;for(f=0;f Date: Fri, 24 Jun 2016 11:48:55 +0900 Subject: [PATCH 10/31] fix font-size for angle field --- dist/entry.js | 2 +- dist/entry.min.js | 2 +- src/workspace/field/angle.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 408bf823aa..028f7c4ce2 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -16753,7 +16753,7 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); b.renderStart = function() { this.svgGroup && $(this.svgGroup).remove(); this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); - this.textElement = this.svgGroup.elem("text", {x:4, y:4, "font-size":"9pt"}); + this.textElement = this.svgGroup.elem("text", {x:4, y:4, "font-size":"11px"}); this.textElement.textContent = this.getText(); var a = this.getTextWidth(), b = this.position && this.position.y ? this.position.y : 0; this._header = this.svgGroup.elem("rect", {x:0, y:b - 8, rx:3, ry:3, width:a, height:16, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); diff --git a/dist/entry.min.js b/dist/entry.min.js index 1448833a7f..a36bde22e4 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1962,7 +1962,7 @@ this.optionGroup&&(this.optionGroup.remove(),delete this.optionGroup);this.comma function(){var a=this._block.view,b=a.getContentPos(),a=a.getAbsoluteCoordinate();return{x:a.x+this.box.x+b.x,y:a.y+this.box.y+b.y}};b.getAbsolutePosFromDocument=function(){var a=this._block.view,b=a.getContentPos(),d=a.getAbsoluteCoordinate(),a=a.getBoard().svgDom.offset();return{x:d.x+this.box.x+b.x+a.left,y:d.y+this.box.y+b.y+a.top}};b.getRelativePos=function(){var a=this._block.view.getContentPos(),b=this.box;return{x:b.x+a.x,y:b.y+a.y}};b.truncate=function(){var a=String(this.getValue()),b=this.TEXT_LIMIT_LENGTH, d=a.substring(0,b);a.length>b&&(d+="...");return d};b.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};b.getValue=function(){return this._block.params[this._index]};b.setValue=function(a,b){this.value!=a&&(this.value=a,this._block.params[this._index]=a,b&&this._blockView.reDraw())};b._isEditable=function(){if(this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1;var a=this._block.view,b=a.getBoard();if(!0===b.disableMouseEvent)return!1;var d=b.workspace.selectedBlockView; if(!d||b!=d.getBoard())return!1;b=a.getSvgRoot();return b==d.svgGroup||$(b).has($(a.svgGroup))};b._selectBlockView=function(){var a=this._block.view;a.getBoard().setSelectedBlock(a)};b._bindRenderOptions=function(){var a=this;$(this.svgGroup).bind("mouseup touchend",function(b){a._isEditable()&&(a.destroyOption(),a._startValue=a.getValue(),a.renderOptions())})};b.pointer=function(a){a=a||[];a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)}})(Entry.Field.prototype);Entry.FieldAngle=function(b,a,c){this._block=a.block;this._blockView=a;this.box=new Entry.BoxModel;this.svgGroup=null;this.position=b.position;this._contents=b;this._index=c;b=this.getValue();this.setValue(this.modValue(void 0!==b?b:90));this.renderStart()};Entry.Utils.inherit(Entry.Field,Entry.FieldAngle); -(function(b){b.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-input-field"});this.textElement=this.svgGroup.elem("text",{x:4,y:4,"font-size":"9pt"});this.textElement.textContent=this.getText();var a=this.getTextWidth(),b=this.position&&this.position.y?this.position.y:0;this._header=this.svgGroup.elem("rect",{x:0,y:b-8,rx:3,ry:3,width:a,height:16,rx:3,ry:3,fill:"#fff","fill-opacity":.4});this.svgGroup.appendChild(this.textElement); +(function(b){b.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-input-field"});this.textElement=this.svgGroup.elem("text",{x:4,y:4,"font-size":"11px"});this.textElement.textContent=this.getText();var a=this.getTextWidth(),b=this.position&&this.position.y?this.position.y:0;this._header=this.svgGroup.elem("rect",{x:0,y:b-8,rx:3,ry:3,width:a,height:16,rx:3,ry:3,fill:"#fff","fill-opacity":.4});this.svgGroup.appendChild(this.textElement); this._bindRenderOptions();this.box.set({x:0,y:0,width:a,height:16})};b.renderOptions=function(){var a=this;this._attachDisposeEvent(function(){a.applyValue();a.destroyOption()});this.optionGroup=Entry.Dom("input",{class:"entry-widget-input-field",parent:$("body")});this.optionGroup.val(this.value);this.optionGroup.on("mousedown",function(a){a.stopPropagation()});this.optionGroup.on("keyup",function(b){var c=b.keyCode||b.which;a.applyValue(b);-1<[13,27].indexOf(c)&&a.destroyOption()});var b=this.getAbsolutePosFromDocument(); b.y-=this.box.height/2;this.optionGroup.css({height:16,left:b.x,top:b.y,width:a.box.width});this.optionGroup.select();this.svgOptionGroup=this.appendSvgOptionGroup();this.svgOptionGroup.elem("circle",{x:0,y:0,r:49,class:"entry-field-angle-circle"});this._dividerGroup=this.svgOptionGroup.elem("g");for(b=0;360>b;b+=15)this._dividerGroup.elem("line",{x1:49,y1:0,x2:49-(0===b%45?10:5),y2:0,transform:"rotate("+b+", 0, 0)",class:"entry-angle-divider"});b=this.getAbsolutePosFromBoard();b.x+=this.box.width/ 2;b.y=b.y+this.box.height/2+49+1;this.svgOptionGroup.attr({class:"entry-field-angle",transform:"translate("+b.x+","+b.y+")"});var b=a.getAbsolutePosFromDocument(),d=[b.x+a.box.width/2,b.y+a.box.height/2+1];$(this.svgOptionGroup).mousemove(function(b){a.optionGroup.val(a.modValue(function(a,b){var c=b[0]-a[0],d=b[1]-a[1]-49-1,e=Math.atan(-d/c),e=Entry.toDegrees(e),e=90-e;0>c?e+=180:0 Date: Fri, 24 Jun 2016 12:36:50 +0900 Subject: [PATCH 11/31] print perf --- dist/entry.js | 107 ++++++++++++++++++------------------ dist/entry.min.js | 89 +++++++++++++++--------------- src/workspace/block_view.js | 9 ++- 3 files changed, 103 insertions(+), 102 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 028f7c4ce2..1431f23ab4 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -9857,40 +9857,40 @@ Entry.Painter.prototype.generateView = function(b) { this.attrLineArea = Entry.createElement("div", "painterAttrLineStyle"); this.attrLineArea.addClass("entryPlaygroundPainterAttrLineStyle"); g.appendChild(this.attrLineArea); - var u = Entry.createElement("div"); - u.addClass("entryPlaygroundPainterAttrLineStyleLine"); - this.attrLineArea.appendChild(u); var t = Entry.createElement("div"); - t.addClass("entryPlaygroundPaitnerAttrLineArea"); + t.addClass("entryPlaygroundPainterAttrLineStyleLine"); this.attrLineArea.appendChild(t); + var u = Entry.createElement("div"); + u.addClass("entryPlaygroundPaitnerAttrLineArea"); + this.attrLineArea.appendChild(u); d = Entry.createElement("div"); d.addClass("entryPlaygroundPainterAttrLineStyleLine1"); - t.appendChild(d); + u.appendChild(d); d.value = "line"; var v = Entry.createElement("div"); v.addClass("painterAttrLineStyleBackgroundLine"); - u.bindOnClick(function(a) { - t.removeClass("entryRemove"); + t.bindOnClick(function(a) { + u.removeClass("entryRemove"); }); - t.blur = function(a) { + u.blur = function(a) { this.addClass("entryRemove"); }; - t.onmouseleave = function(a) { + u.onmouseleave = function(a) { this.addClass("entryRemove"); }; d.bindOnClick(function(a) { - this.attrLineArea.removeClass(u); + this.attrLineArea.removeClass(t); this.attrLineArea.appendChild(v); this.attrLineArea.onchange(a); - t.blur(); + u.blur(); }); v.bindOnClick(function(a) { - t.removeClass("entryRemove"); + u.removeClass("entryRemove"); }); this.attrLineArea.onchange = function(b) { a.stroke.style = b.target.value; }; - t.blur(); + u.blur(); } }; Entry.Painter.prototype.restoreHandle = function() { @@ -11675,8 +11675,8 @@ Entry.BlockDriver = function() { return d; } for (var e = 0;e < a.length;e++) { - var f = a[e], g = f.tagName, h = $(f).children()[0], u = f.getAttribute("name"); - "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(b(h)), d.index[u] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[u] = d.params.length - 1); + var f = a[e], g = f.tagName, h = $(f).children()[0], t = f.getAttribute("name"); + "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(b(h)), d.index[t] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[t] = d.params.length - 1); } return d; } @@ -15735,6 +15735,7 @@ Entry.BlockView = function(b, a, c) { }; Entry.BlockView.PARAM_SPACE = 5; Entry.BlockView.DRAG_RADIUS = 5; +Entry.BlockView.pngMap = {}; (function(b) { b.schema = {id:0, type:Entry.STATIC.BLOCK_RENDER_MODEL, x:0, y:0, offsetX:0, offsetY:0, width:0, height:0, contentWidth:0, contentHeight:0, magneting:!1, visible:!0, animating:!1, shadow:!0, display:!0}; b._startRender = function(a, b) { @@ -16207,72 +16208,72 @@ Entry.BlockView.DRAG_RADIUS = 5; }; b.getDataUrl = function(a) { function b() { - g = g.replace("(svgGroup)", (new XMLSerializer).serializeToString(h)).replace("(defs)", (new XMLSerializer).serializeToString(q[0])).replace(/>\s+/g, ">").replace(/\s+\s+/g, ">").replace(/\s+>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.move_line=function(){this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").moveTo(this.oldPt.x,this.oldPt.y).lineTo(this.stage.mouseX,this.stage.mouseY);this.file.modified=!0;this.stage.update()}; @@ -968,19 +968,19 @@ e.addClass("entryPlaygroundPainterAttrResizeXTop");e.innerHTML="X";c.appendChild c.innerHTML="x";d.appendChild(c);c=Entry.createElement("div");c.addClass("entryPlaygroundAttrReiszeY");d.appendChild(c);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrResizeYTop");d.innerHTML="Y";c.appendChild(d);this.objectHeightInput=Entry.createElement("input","entryPainterAttrHeight");this.objectHeightInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;a.handle.height=this.value;a.updateImageHandle()}; this.objectHeightInput.addClass("entryPlaygroundPainterNumberInput");c.appendChild(this.objectHeightInput);this.attrRotateArea=Entry.createElement("div","painterAttrRotateArea");this.attrRotateArea.addClass("painterAttrRotateArea");g.appendChild(this.attrRotateArea);d=Entry.createElement("div");d.addClass("painterAttrRotateName");d.innerHTML=Lang.Workspace.picture_rotation;this.attrRotateArea.appendChild(d);d=Entry.createElement("fieldset","entryPainterAttrRotate");d.addClass("entryPlaygroundPainterAttrRotate"); this.attrRotateArea.appendChild(d);c=Entry.createElement("div");c.addClass("painterAttrRotateTop");c.innerHTML="\u03bf";d.appendChild(c);this.objectRotateInput=Entry.createElement("input","entryPainterAttrDegree");this.objectRotateInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;360<=this.value?this.value%=360:0>this.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); -this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var q=Entry.createElement("div");q.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(q);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); +this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var n=Entry.createElement("div");n.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(n);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); Entry.getColourCodes().forEach(function(b){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=b;c.bindOnClick(function(c){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= -b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});q.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); -var n=Entry.createElement("fieldset","entryPainterAttrThick");n.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(n);d=Entry.createElement("div");d.addClass("paintAttrThickTop");n.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);n.appendChild(e); -d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);n.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;n.bindOnClick(function(){m.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(a){n.style.zIndex= +b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});n.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); +var q=Entry.createElement("fieldset","entryPainterAttrThick");q.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(q);d=Entry.createElement("div");d.addClass("paintAttrThickTop");q.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);q.appendChild(e); +d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);q.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;q.bindOnClick(function(){m.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); +g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(a){q.style.zIndex= "1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", "entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(b){a.font.style=b.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;dd.style.opacity&&(clearInterval(a),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryRemove");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.BlockDriver=function(){}; -(function(b){b.convert=function(){var a=new Date,b;for(b in Entry.block)"function"===typeof Entry.block[b]&&this._convertBlock(b);console.log((new Date).getTime()-a.getTime())};b._convertBlock=function(a){function b(a){var d={type:a.getAttribute("type"),index:{}};a=$(a).children();if(!a)return d;for(var e=0;eg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||Entry.dispatchEvent("loadComplete")};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;dg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||Entry.dispatchEvent("loadComplete")};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;d=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; Entry.Utils.colorDarken=function(b,a){function c(a){2!=a.length&&(a="0"+a);return a}var d,e,f;7===b.length?(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),f=parseInt(b.substr(5,2),16)):(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),f=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;d=c(Math.floor(d*a).toString(16));e=c(Math.floor(e*a).toString(16));f=c(Math.floor(f*a).toString(16));return"#"+d+e+f}; Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;var c=Entry.Utils.hexToHsl(b);c.l+=a/100;c.l=Math.min(1,Math.max(0,c.l));return Entry.Utils.hslToHex(c)};Entry.Utils.bound01=function(b,a){var c=b;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(b="100%");c="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));c&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; @@ -1191,8 +1191,8 @@ b[h],0d-(l.width+q.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; +b,tP,h),this._movePort(rPort,b,bP,k))};b._alignNS=function(a,b,d){for(var e=-this._rect.width/2,f=this._rect.width/2,g=this._rect.width,h=0,k=0;kd-(l.width+n.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+d+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,12:Entry.SensorBoard,13:Entry.CODEino,15:Entry.dplay,16:Entry.nemoino,17:Entry.Xbot,18:Entry.ardublock,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick,42:Entry.Arduino,51:Entry.Neobot,71:Entry.Robotis_carCont, 72:Entry.Robotis_openCM70,81:Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,c;this.connected=!1;this.connectTrial++;if(-1m?(q=Math.round(m-155),g=-q,h=0,Entry.dplay.Left_value=g):0==m&&(h=g=0,Entry.dplay.Left_value=0));"2"==n&&(e=6,f=11,0m?(q=Math.round(m-155),k=-q,l=0,Entry.dplay.Right_value=k):0==m&&(l=k=0,Entry.dplay.Right_value=k));"3"==n&&(c=3,d=5,e=6,f=11,0m?(q=Math.round(m-155),g=-q,h=0,k=-q,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==m&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f, +options:[["\uc67c\ucabd","1"],["\uc624\ub978\ucabd","2"],["\uc591\ucabd","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"dplay_robot_speed_sel"},paramsKeyMap:{PORT:0,VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,h=0,k=0,l=0,n=0,q=a.getField("PORT"),m=a.getNumberValue("VALUE", +a),m=Math.max(m,-100),m=Math.min(m,100);"1"==q&&(c=3,d=5,0m?(n=Math.round(m-155),g=-n,h=0,Entry.dplay.Left_value=g):0==m&&(h=g=0,Entry.dplay.Left_value=0));"2"==q&&(e=6,f=11,0m?(n=Math.round(m-155),k=-n,l=0,Entry.dplay.Right_value=k):0==m&&(l=k=0,Entry.dplay.Right_value=k));"3"==q&&(c=3,d=5,e=6,f=11,0m?(n=Math.round(m-155),g=-n,h=0,k=-n,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==m&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f, k),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var r=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(r)},50);Entry.dplay.timeouts.push(r);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,g=0,g=a.getNumberValue("L_VALUE",a),g=Math.max(g,-100),g=Math.min(g,100);0g?(g=Math.round(g-155),c=-g,d=0,Entry.dplay.Left_value=c):0==g&&(d=c=0,Entry.dplay.Left_value= 0);g=a.getNumberValue("R_VALUE",a);g=Math.max(g,-100);g=Math.min(g,100);0g?(g=Math.round(g-155),e=-g,f=0,Entry.dplay.Right_value=e):0==g&&(f=e=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(3,c),Entry.hw.setDigitalPortValue(5,d), @@ -1905,7 +1905,7 @@ e.scroll(a.pageY-c.offsetY);c.set({offsetY:a.pageY})}function d(a){$(document).u b);g.bind("touchend.scroll",d);e.dragInstance=new Entry.DragInstance({startY:f.pageY,offsetY:f.pageY})}a.stopPropagation()};b._addControl=function(){$(this.vScrollbar).bind("mousedown touchstart",this.mouseHandler)}})(Entry.BlockMenuScroller.prototype);Entry.BlockView=function(b,a,c){Entry.Model(this,!1);this.block=b;this._lazyUpdatePos=_.debounce(b._updatePos.bind(b),200);this._board=a;this._observers=[];this.set(b);this.svgGroup=a.svgBlockGroup.elem("g");this._schema=Entry.block[b.type];this._schema.changeEvent&&(this._schemaChangeEvent=this._schema.changeEvent.attach(this,this._updateSchema));var d=this._skeleton=Entry.skeleton[this._schema.skeleton];this._contents=[];this._statements=[];this.magnet={};this._paramMap={};d.magnets&&d.magnets(this).next&& (this.svgGroup.nextMagnet=this.block,this._nextGroup=this.svgGroup.elem("g"),this._observers.push(this.observe(this,"_updateMagnet",["contentHeight"])));this.isInBlockMenu=this.getBoard()instanceof Entry.BlockMenu;var e=this;this.mouseHandler=function(){var a=e.block.events;a&&a.mousedown&&a.mousedown.forEach(function(a){a(e)});e.onMouseDown.apply(e,arguments)};this._startRender(b,c);this._observers.push(this.block.observe(this,"_setMovable",["movable"]));this._observers.push(this.block.observe(this, "_setReadOnly",["movable"]));this._observers.push(this.block.observe(this,"_setCopyable",["copyable"]));this._observers.push(this.block.observe(this,"_updateColor",["deletable"],!1));this._observers.push(this.observe(this,"_updateBG",["magneting"],!1));this._observers.push(this.observe(this,"_updateOpacity",["visible"],!1));this._observers.push(this.observe(this,"_updateDisplay",["display"],!1));this._observers.push(this.observe(this,"_updateShadow",["shadow"]));this._observers.push(this.observe(this, -"_updateMagnet",["offsetY"]));this._observers.push(a.code.observe(this,"_setBoard",["board"],!1));this.dragMode=Entry.DRAG_MODE_NONE;Entry.Utils.disableContextmenu(this.svgGroup.node);a=b.events.viewAdd;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(b)})};Entry.BlockView.PARAM_SPACE=5;Entry.BlockView.DRAG_RADIUS=5; +"_updateMagnet",["offsetY"]));this._observers.push(a.code.observe(this,"_setBoard",["board"],!1));this.dragMode=Entry.DRAG_MODE_NONE;Entry.Utils.disableContextmenu(this.svgGroup.node);a=b.events.viewAdd;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(b)})};Entry.BlockView.PARAM_SPACE=5;Entry.BlockView.DRAG_RADIUS=5;Entry.BlockView.pngMap={}; (function(b){b.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,offsetX:0,offsetY:0,width:0,height:0,contentWidth:0,contentHeight:0,magneting:!1,visible:!0,animating:!1,shadow:!0,display:!0};b._startRender=function(a,b){var d=this,e=this._skeleton;this.svgGroup.attr({class:"block"});var f=e.classes;f&&0!==f.length&&f.forEach(function(a){d.svgGroup.addClass(a)});f=e.path(this);this.pathGroup=this.svgGroup.elem("g");this._updateMagnet();this._path=this.pathGroup.elem("path");this.getBoard().patternRect&& ($(this._path).mouseenter(function(a){d._mouseEnable&&d._changeFill(!0)}),$(this._path).mouseleave(function(a){d._mouseEnable&&d._changeFill(!1)}));var g=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(g=Entry.Utils.colorLighten(g));this._fillColor=g;f={d:f,fill:g,class:"blockPath"};if(this.magnet.next||this._skeleton.nextShadow)g=this.getBoard().suffix,this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_"+g+")"});else if(this.magnet.string||this.magnet.boolean)f.stroke= e.outerLine;e.outerLine&&(f["stroke-width"]="0.6");this._path.attr(f);this._moveTo(this.x,this.y,!1);this._startContentRender(b);!0!==this._board.disableMouseEvent&&this._addControl();this.bindPrev()};b._startContentRender=function(a){a=void 0===a?Entry.Workspace.MODE_BOARD:a;this.contentSvgGroup&&this.contentSvgGroup.remove();var b=this._schema;b.statements&&b.statements.length&&this.statementSvgGroup&&this.statementSvgGroup.remove();this._contents=[];this.contentSvgGroup=this.svgGroup.elem("g"); @@ -1919,8 +1919,8 @@ b.onMouseDown=function(a){function c(a){a.stopPropagation();var c=e.workspace.ge Entry.DRAG_MODE_DRAG,m.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(m,c),a=!0),this.animating&&this.set({animating:!1}),0===m.dragInstance.height&&m.dragInstance.set({height:-1+m.height}),c=m.dragInstance,m._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),m.originPos||(m.originPos={x:m.x,y:m.y}),a&&e.generateCodeMagnetMap(),m._updateCloseBlock()))}function d(a){$(document).unbind(".block");m.terminateDrag(a);e&&e.set({dragBlock:null}); m._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete m.dragInstance}a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();this._changeFill(!1);var e=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(a);if(!this.readOnly&&!e.viewOnly){e.setSelectedBlock(this);this.dominate();if(0===a.button||a.originalEvent&&a.originalEvent.touches){var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;this.mouseDownCoordinate= {x:f.pageX,y:f.pageY};var g=$(document);g.bind("mousemove.block touchmove.block",c);g.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:f.pageX,startY:f.pageY,offsetX:f.pageX,offsetY:f.pageY,height:0,mode:!0});e.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN}else if(Entry.Utils.isRightButton(a)){var h=this,k=h.block;if(this.isInBlockMenu)return;f=[];var g={text:Lang.Blocks.Duplication_option,enable:this.copyable,callback:function(){Entry.do("cloneBlock", -k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},q={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},n={text:"\uc774\ubbf8\uc9c0\ub85c \uc800\uc7a5\ud558\uae30",callback:function(){h.getDataUrl().then(function(a){var b=document.createElement("a");b.href=a.src;b.download="\uc5d4\ud2b8\ub9ac \ube14\ub85d.png";b.click()})}};f.push(g);f.push(l);f.push(q);Entry.Utils.isChrome()&& -"workspace"==Entry.type&&f.push(n);Entry.ContextMenu.show(f)}var m=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode(); +k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},n={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},q={text:"\uc774\ubbf8\uc9c0\ub85c \uc800\uc7a5\ud558\uae30",callback:function(){h.getDataUrl().then(function(a){var b=document.createElement("a");b.href=a.src;b.download="\uc5d4\ud2b8\ub9ac \ube14\ub85d.png";b.click()})}};f.push(g);f.push(l);f.push(n);Entry.Utils.isChrome()&& +"workspace"==Entry.type&&f.push(q);Entry.ContextMenu.show(f)}var m=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode(); this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(d===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg;a=!1;var h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock", e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode=d,b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"), this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"),f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}b.setMagnetedBlock(null);a&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};b._updateCloseBlock=function(){var a=this.getBoard(),b;if(this._skeleton.magnets){for(var d in this.magnet)if(b= @@ -1935,11 +1935,12 @@ this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly b.view.magnet.next?a.view._toLocalCoordinate(b.view._nextGroup):(a.view._toGlobalCoordinate(),a.separate(),a.view.bumpAway(null,100))}}else if(a=this.block.getPrevBlock())this._toLocalCoordinate(a.view._nextGroup),(a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)};b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y; return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()};b._updateColor=function(){var a=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g,">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.cloneNode(!0),k=this._skeleton.box(this),l=a?1:1.5;h.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X",-k.offsetX).replace("%Y",-k.offsetY).replace("%SCALE",l));for(var q=this.getBoard().svgDom.find("defs"), -n=this.svgGroup.getBoundingClientRect(),m=h.getElementsByTagName("image"),k=h.getElementsByTagName("text"),r=["\u2265","\u2264"],u="\u2265\u2264-><=+-x/".split(""),l=0;l\s+/g,">").replace(/\s+(svgGroup)(defs)',g=this.svgGroup.cloneNode(!0),h=this._skeleton.box(this),k=a?1:1.5;g.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X", +-h.offsetX).replace("%Y",-h.offsetY).replace("%SCALE",k));for(var l=this.getBoard().svgDom.find("defs"),n=this.svgGroup.getBoundingClientRect(),q=g.getElementsByTagName("image"),h=g.getElementsByTagName("text"),m=["\u2265","\u2264"],r="\u2265\u2264-><=+-x/".split(""),k=0;ke||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;fg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint=f.point}this._magnetMap[b]=d}};b._getCodeBlocks=function(a,b){var d=a.getThreads(),e=[],f;switch(b){case "previous":f=this._getNextMagnets; -break;case "next":f=this._getPreviousMagnets;break;case "string":f=this._getFieldMagnets;break;case "boolean":f=this._getFieldMagnets;break;case "param":f=this._getOutputMagnets;break;default:return[]}for(var g=0;gd.endPoint)f=h+1;else{e=d.blocks;for(f=0;f Date: Fri, 24 Jun 2016 16:23:24 +0900 Subject: [PATCH 12/31] download images at board --- dist/entry.js | 21 ++++++--- dist/entry.min.js | 85 +++++++++++++++++++------------------ src/workspace/block_view.js | 16 ++++--- src/workspace/board.js | 17 ++++++++ 4 files changed, 85 insertions(+), 54 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 1431f23ab4..fe00c8cf24 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -15935,12 +15935,7 @@ Entry.BlockView.pngMap = {}; }}, q = {text:Lang.Blocks.Delete_Blocks, enable:k.isDeletable(), callback:function() { Entry.do("destroyBlock", h.block); }}, n = {text:"\uc774\ubbf8\uc9c0\ub85c \uc800\uc7a5\ud558\uae30", callback:function() { - h.getDataUrl().then(function(a) { - var b = document.createElement("a"); - b.href = a.src; - b.download = "\uc5d4\ud2b8\ub9ac \ube14\ub85d.png"; - b.click(); - }); + h.downloadAsImage(); }}; f.push(g); f.push(l); @@ -16275,6 +16270,14 @@ Entry.BlockView.pngMap = {}; } return e.promise(); }; + b.downloadAsImage = function() { + this.getDataUrl().then(function(a) { + var b = document.createElement("a"); + b.href = a.src; + b.download = "\uc5d4\ud2b8\ub9ac \ube14\ub85d.png"; + b.click(); + }); + }; })(Entry.BlockView.prototype); Entry.Code = function(b, a) { Entry.Model(this, !1); @@ -17969,6 +17972,7 @@ Entry.Board = function(b) { Entry.Board.OPTION_PASTE = 0; Entry.Board.OPTION_ALIGN = 1; Entry.Board.OPTION_CLEAR = 2; +Entry.Board.OPTION_DOWNLOAD = 3; (function(b) { b.schema = {code:null, dragBlock:null, magnetedBlockView:null, selectedBlockView:null}; b.createView = function(a) { @@ -18080,6 +18084,7 @@ Entry.Board.OPTION_CLEAR = 2; } a = []; this._contextOptions[Entry.Board.OPTION_PASTE].option.enable = !!Entry.clipboard; + this._contextOptions[Entry.Board.OPTION_DOWNLOAD].option.enable = 0 !== this.code.getThreads().length; for (e = 0;e < this._contextOptions.length;e++) { this._contextOptions[e].activated && a.push(this._contextOptions[e].option); } @@ -18404,6 +18409,10 @@ Entry.Board.OPTION_CLEAR = 2; a.alignThreads(); }}}, {activated:!0, option:{text:Lang.Blocks.Clear_all_blocks, callback:function() { a.code.clear(); + }}}, {activated:"workspace" === Entry.type && Entry.Utils.isChrome(), option:{text:"\ubaa8\ub4e0 \ube14\ub7ed \uc774\ubbf8\uc9c0\ub85c \uc800\uc7a5\ud558\uae30", enable:!0, callback:function() { + a.code.getThreads().forEach(function(a) { + (a = a.getFirstBlock()) && a.view.downloadAsImage(); + }); }}}]; }; b.activateContextOption = function(a) { diff --git a/dist/entry.min.js b/dist/entry.min.js index 28fb3c8e84..017b298d60 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1919,28 +1919,28 @@ b.onMouseDown=function(a){function c(a){a.stopPropagation();var c=e.workspace.ge Entry.DRAG_MODE_DRAG,m.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(m,c),a=!0),this.animating&&this.set({animating:!1}),0===m.dragInstance.height&&m.dragInstance.set({height:-1+m.height}),c=m.dragInstance,m._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),m.originPos||(m.originPos={x:m.x,y:m.y}),a&&e.generateCodeMagnetMap(),m._updateCloseBlock()))}function d(a){$(document).unbind(".block");m.terminateDrag(a);e&&e.set({dragBlock:null}); m._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete m.dragInstance}a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();this._changeFill(!1);var e=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(a);if(!this.readOnly&&!e.viewOnly){e.setSelectedBlock(this);this.dominate();if(0===a.button||a.originalEvent&&a.originalEvent.touches){var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;this.mouseDownCoordinate= {x:f.pageX,y:f.pageY};var g=$(document);g.bind("mousemove.block touchmove.block",c);g.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:f.pageX,startY:f.pageY,offsetX:f.pageX,offsetY:f.pageY,height:0,mode:!0});e.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN}else if(Entry.Utils.isRightButton(a)){var h=this,k=h.block;if(this.isInBlockMenu)return;f=[];var g={text:Lang.Blocks.Duplication_option,enable:this.copyable,callback:function(){Entry.do("cloneBlock", -k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},n={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},q={text:"\uc774\ubbf8\uc9c0\ub85c \uc800\uc7a5\ud558\uae30",callback:function(){h.getDataUrl().then(function(a){var b=document.createElement("a");b.href=a.src;b.download="\uc5d4\ud2b8\ub9ac \ube14\ub85d.png";b.click()})}};f.push(g);f.push(l);f.push(n);Entry.Utils.isChrome()&& -"workspace"==Entry.type&&f.push(q);Entry.ContextMenu.show(f)}var m=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode(); -this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(d===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg;a=!1;var h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock", -e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode=d,b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"), -this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"),f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}b.setMagnetedBlock(null);a&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};b._updateCloseBlock=function(){var a=this.getBoard(),b;if(this._skeleton.magnets){for(var d in this.magnet)if(b= -"next"===d?this.getBoard().getNearestMagnet(this.x,this.y+this.getBelowHeight(),d):this.getBoard().getNearestMagnet(this.x,this.y,d))return a.setMagnetedBlock(b.view,d);a.setMagnetedBlock(null)}};b.dominate=function(){this.block.getThread().view.dominate()};b.getSvgRoot=function(){for(var a=this.getBoard().svgBlockGroup,b=this.svgGroup;b.parentNode!==a;)b=b.parentNode;return b};b.getBoard=function(){return this._board};b._setBoard=function(){this._board=this._board.code.board};b.destroy=function(a){this._destroyObservers(); -var b=this.svgGroup;a?$(b).fadeOut(100,function(){b.remove()}):b.remove();this._contents.forEach(function(a){a.constructor!==Entry.Block&&a.destroy()});var d=this.block;a=d.events.viewDestroy;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(d)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};b.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow)); -return this._shadow};b.destroyShadow=function(){this._shadow&&(this._shadow.remove(),delete this._shadow)};b._updateMagnet=function(){if(this._skeleton.magnets){var a=this._skeleton.magnets(this);a.next&&this._nextGroup.attr("transform","translate("+a.next.x+","+a.next.y+")");this.magnet=a;this.block.getThread().changeEvent.notify()}};b._updateBG=function(){if(this._board.dragBlock&&this._board.dragBlock.dragInstance){var a=this.svgGroup;if(this.magnet.next){if(a=this.magneting){var b=this._board.dragBlock.getShadow(), -d=this.getAbsoluteCoordinate(),e;if("previous"===a)e=this.magnet.next,e="translate("+(d.x+e.x)+","+(d.y+e.y)+")";else if("next"===a){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(d.x+e.x)+","+(d.y+e.y-f)+")"}$(b).attr({transform:e,display:"block"});this._clonedShadow=b;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===a&&(a=this._board.dragBlock.getBelowHeight()+this.offsetY, -this.originalHeight=this.offsetY,this.set({offsetY:a}))}else this._clonedShadow&&(this._clonedShadow.attr({display:"none"}),delete this._clonedShadow),a=this.originalHeight,void 0!==a&&(this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground),this.set({offsetY:a}),delete this.originalHeight);(a=this.block.thread.changeEvent)&&a.notify()}else this.magneting?(a.attr({filter:"url(#entryBlockHighlightFilter_"+this.getBoard().suffix+")"}), -a.addClass("outputHighlight")):(a.removeClass("outputHighlight"),a.removeAttr("filter"))}};b.addDragging=function(){this.svgGroup.addClass("dragging")};b.removeDragging=function(){this.svgGroup.removeClass("dragging")};b.addSelected=function(){this.svgGroup.addClass("selected")};b.removeSelected=function(){this.svgGroup.removeClass("selected")};b.getSkeleton=function(){return this._skeleton};b.getContentPos=function(){return this._skeleton.contentPos(this)};b.renderText=function(){this._startContentRender(Entry.Workspace.MODE_VIMBOARD)}; -b.renderBlock=function(){this._startContentRender(Entry.Workspace.MODE_BOARD)};b._updateOpacity=function(){this.svgGroup.attr({opacity:!1===this.visible?0:1});this.visible&&this._setPosition()};b._updateShadow=function(){this.shadow&&Entry.Utils.colorDarken(this._schema.color,.7)};b._setMovable=function(){this.movable=null!==this.block.isMovable()?this.block.isMovable():void 0!==this._skeleton.movable?this._skeleton.movable:!0};b._setReadOnly=function(){this.readOnly=null!==this.block.isReadOnly()? -this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly:!1};b._setCopyable=function(){this.copyable=null!==this.block.isCopyable()?this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable:!0};b.bumpAway=function(a,b){var d=this;a=a||15;b?window.setTimeout(function(){d._moveBy(a,a,!1)},b):d._moveBy(a,a,!1)};b.bindPrev=function(a){if(a){if(this._toLocalCoordinate(a.view._nextGroup),(a=a.getNextBlock())&&a!==this.block){var b=this.block.getLastBlock(); -b.view.magnet.next?a.view._toLocalCoordinate(b.view._nextGroup):(a.view._toGlobalCoordinate(),a.separate(),a.view.bumpAway(null,100))}}else if(a=this.block.getPrevBlock())this._toLocalCoordinate(a.view._nextGroup),(a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)};b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y; -return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()};b._updateColor=function(){var a=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g,">").replace(/\s+(svgGroup)(defs)',g=this.svgGroup.cloneNode(!0),h=this._skeleton.box(this),k=a?1:1.5;g.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X", --h.offsetX).replace("%Y",-h.offsetY).replace("%SCALE",k));for(var l=this.getBoard().svgDom.find("defs"),n=this.svgGroup.getBoundingClientRect(),q=g.getElementsByTagName("image"),h=g.getElementsByTagName("text"),m=["\u2265","\u2264"],r="\u2265\u2264-><=+-x/".split(""),k=0;k\s+/g,">").replace(/\s+(svgGroup)(defs)',g=this.svgGroup.cloneNode(!0),h=this._skeleton.box(this),k=a?1:1.5;g.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X",-h.offsetX).replace("%Y",-h.offsetY).replace("%SCALE",k)); +for(var l=this.getBoard().svgDom.find("defs"),n=this.svgGroup.getBoundingClientRect(),q=g.getElementsByTagName("image"),h=g.getElementsByTagName("text"),m=["\u2265","\u2264"],r="\u2265\u2264-><=+-x/".split(""),k=0;ke||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;f'), {parent:this.wrapper});this.visible=!0;var d=this;this.svg=Entry.SVG(this._svgId);$(window).scroll(function(){d.updateOffset()});this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;a.isOverlay?(this.wrapper.addClass("entryOverlayBoard"),this.generateButtons(),this.suffix="overlayBoard"):this.suffix="board";Entry.Utils.addFilters(this.svg,this.suffix);this.patternRect=Entry.Utils.addBlockPattern(this.svg, this.suffix)};b.changeCode=function(a){this.code&&this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:a});var b=this;a&&(this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()}),a.createView(this));this.scroller.resizeScrollBar()};b.bindCodeView=function(a){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup);this.svgGroup.appendChild(this.svgBlockGroup)}; b.setMagnetedBlock=function(a,b){if(this.magnetedBlockView){if(this.magnetedBlockView===a)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:a});a&&(a.set({magneting:b}),a.dominate())};b.getCode=function(){return this.code};b.findById=function(a){return this.code.findById(a)};b._addControl=function(){var a=this.svgDom,b=this;a.mousedown(function(){b.onMouseDown.apply(b,arguments)});a.bind("touchstart",function(){b.onMouseDown.apply(b,arguments)});a.on("wheel",function(){b.mouseWheel.apply(b, arguments)});var d=b.scroller;d&&(a.mouseenter(function(a){d.setOpacity(1)}),a.mouseleave(function(a){d.setOpacity(0)}))};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var c=f.dragInstance;f.scroller.scroll(a.pageX-c.offsetX,a.pageY-c.offsetY);c.set({offsetX:a.pageX,offsetY:a.pageY})}function d(a){$(document).unbind(".entryBoard");delete f.dragInstance}if(this.workspace.getMode()!= Entry.Workspace.MODE_VIMBOARD){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();if(0===a.button||a.originalEvent&&a.originalEvent.touches){a=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;Entry.documentMousedown&&Entry.documentMousedown.notify(a);var e=$(document);e.bind("mousemove.entryBoard",b);e.bind("mouseup.entryBoard",d);e.bind("touchmove.entryBoard",b);e.bind("touchend.entryBoard",d);this.dragInstance=new Entry.DragInstance({startX:a.pageX, -startY:a.pageY,offsetX:a.pageX,offsetY:a.pageY})}else if(Entry.Utils.isRightButton(a)){if(!this.visible)return;a=[];this._contextOptions[Entry.Board.OPTION_PASTE].option.enable=!!Entry.clipboard;for(e=0;ea&&(f=f+e+10,e=0,d=15);e=Math.max(e,k.width);l=d+15;h._moveTo(f,l,!1);d=d+k.height+15}}this.scroller.resizeScrollBar()};b.clear=function(){this.svgBlockGroup.remove();this.svgThreadGroup.remove()};b.updateOffset=function(){this._offset=this.svg.getBoundingClientRect();var a=$(window),b=a.scrollTop(),a=a.scrollLeft(),d=this._offset;this.relativeOffset= -{top:d.top-b,left:d.left-a};this.btnWrapper&&this.btnWrapper.attr({transform:"translate("+(d.width/2-65)+","+(d.height-200)+")"})};b.generateButtons=function(){var a=this,b=this.svgGroup.elem("g");this.btnWrapper=b;var d=b.elem("text",{x:27,y:33,class:"entryFunctionButtonText"});d.textContent=Lang.Buttons.save;var e=b.elem("text",{x:102.5,y:33,class:"entryFunctionButtonText"});e.textContent=Lang.Buttons.cancel;var f=b.elem("circle",{cx:27.5,cy:27.5,r:27.5,class:"entryFunctionButton"}),b=b.elem("circle", -{cx:102.5,cy:27.5,r:27.5,class:"entryFunctionButton"});$(f).bind("mousedown touchstart",function(){a.save()});$(d).bind("mousedown touchstart",function(){a.save()});$(b).bind("mousedown touchstart",function(){a.cancelEdit()});$(e).bind("mousedown touchstart",function(){a.cancelEdit()})};b.cancelEdit=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"cancelEdit")};b.save=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"save")};b.generateCodeMagnetMap=function(){var a=this.code; -if(a&&this.dragBlock)for(var b in this.dragBlock.magnet){var d=this._getCodeBlocks(a,b);d.sort(function(a,b){return a.point-b.point});d.unshift({point:-Number.MAX_VALUE,blocks:[]});for(var e=1;eg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint=f.point}this._magnetMap[b]=d}};b._getCodeBlocks=function(a,b){var d=a.getThreads(),e=[],f;switch(b){case "previous":f=this._getNextMagnets; -break;case "next":f=this._getPreviousMagnets;break;case "string":f=this._getFieldMagnets;break;case "boolean":f=this._getFieldMagnets;break;case "param":f=this._getOutputMagnets;break;default:return[]}for(var g=0;gd.endPoint)f=h+1;else{e=d.blocks;for(f=0;fa&&(f=f+e+10,e=0,d=15);e=Math.max(e,k.width);l=d+15;h._moveTo(f,l,!1);d=d+k.height+15}}this.scroller.resizeScrollBar()};b.clear=function(){this.svgBlockGroup.remove();this.svgThreadGroup.remove()};b.updateOffset=function(){this._offset= +this.svg.getBoundingClientRect();var a=$(window),b=a.scrollTop(),a=a.scrollLeft(),d=this._offset;this.relativeOffset={top:d.top-b,left:d.left-a};this.btnWrapper&&this.btnWrapper.attr({transform:"translate("+(d.width/2-65)+","+(d.height-200)+")"})};b.generateButtons=function(){var a=this,b=this.svgGroup.elem("g");this.btnWrapper=b;var d=b.elem("text",{x:27,y:33,class:"entryFunctionButtonText"});d.textContent=Lang.Buttons.save;var e=b.elem("text",{x:102.5,y:33,class:"entryFunctionButtonText"});e.textContent= +Lang.Buttons.cancel;var f=b.elem("circle",{cx:27.5,cy:27.5,r:27.5,class:"entryFunctionButton"}),b=b.elem("circle",{cx:102.5,cy:27.5,r:27.5,class:"entryFunctionButton"});$(f).bind("mousedown touchstart",function(){a.save()});$(d).bind("mousedown touchstart",function(){a.save()});$(b).bind("mousedown touchstart",function(){a.cancelEdit()});$(e).bind("mousedown touchstart",function(){a.cancelEdit()})};b.cancelEdit=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"cancelEdit")};b.save=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD, +"save")};b.generateCodeMagnetMap=function(){var a=this.code;if(a&&this.dragBlock)for(var b in this.dragBlock.magnet){var d=this._getCodeBlocks(a,b);d.sort(function(a,b){return a.point-b.point});d.unshift({point:-Number.MAX_VALUE,blocks:[]});for(var e=1;eg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint=f.point}this._magnetMap[b]=d}};b._getCodeBlocks=function(a,b){var d= +a.getThreads(),e=[],f;switch(b){case "previous":f=this._getNextMagnets;break;case "next":f=this._getPreviousMagnets;break;case "string":f=this._getFieldMagnets;break;case "boolean":f=this._getFieldMagnets;break;case "param":f=this._getOutputMagnets;break;default:return[]}for(var g=0;gd.endPoint)f=h+1;else{e=d.blocks;for(f=0;f Date: Mon, 27 Jun 2016 12:43:15 +0900 Subject: [PATCH 13/31] missing min --- dist/entry.min.js | 231 ++++++++++++++++++++-------------------------- 1 file changed, 102 insertions(+), 129 deletions(-) diff --git a/dist/entry.min.js b/dist/entry.min.js index 259b49e09c..bcef191e01 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -32,7 +32,7 @@ Blockly.Blocks.albert_stop={init:function(){this.setColour("#00979D");this.appen Blockly.Blocks.albert_set_pad_size_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_1);this.appendValueInput("WIDTH").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_2);this.appendValueInput("HEIGHT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", "*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_pad_size_to=function(b,a){var c=Entry.hw.sendQueue;c.padWidth=a.getNumberValue("WIDTH");c.padHeight=a.getNumberValue("HEIGHT");return a.callReturn()}; Blockly.Blocks.albert_set_eye_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_eye_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_set_eye_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.ALBERT_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.ALBERT_color_magenta, -"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.ALBERT_set_eye_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_eye_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}; +"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.ALBERT_set_eye_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_eye_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}; Blockly.Blocks.albert_clear_eye={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_clear_eye_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_clear_eye_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_clear_eye=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftEye=0:("RIGHT"!=d&&(c.leftEye=0),c.rightEye=0);return a.callReturn()}; Blockly.Blocks.albert_body_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_body_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.turn_on,"ON"],[Lang.General.turn_off,"OFF"]]),"STATE").appendField(Lang.Blocks.ALBERT_body_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -62,7 +62,7 @@ Entry.block.albert_move_backward=function(b,a){var c=Entry.hw.sendQueue;if(a.isS Blockly.Blocks.albert_turn_around={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_around_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_around_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_turn_around=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return c.leftWheel=a.leftValue,c.rightWheel=a.rightValue,a;delete a.timeFlag;delete a.isStart;delete a.leftValue;delete a.rightValue;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}c="LEFT"==a.getField("DIRECTION",a);a.leftValue=c?-30:30;a.rightValue=c?30:-30;a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a}; Blockly.Blocks.albert_set_led_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_led_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_set_led_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.General.skyblue,"3"],[Lang.General.blue,"1"],[Lang.General.purple, -"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}; +"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}; Blockly.Blocks.albert_clear_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_clear_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_clear_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_clear_led=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"FRONT"==d?(c.leftEye=0,c.rightEye=0):"LEFT"==d?c.leftEye=0:c.rightEye=0;return a.callReturn()}; Blockly.Blocks.albert_change_wheels_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_wheels_by_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_change_wheels_by_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_wheels_by_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ @@ -77,7 +77,7 @@ Blockly.Blocks.arduino_text={init:function(){this.setColour("#00979D");this.appe Blockly.Blocks.arduino_send={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_send_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_send_2);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.arduino_send=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return a.callReturn()}; Blockly.Blocks.arduino_get_string={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_string_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_string_2);this.setOutput(!0,"String");this.setInputsInline(!0)}}; -Entry.block.arduino_get_number=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return+d.responseText}; +Entry.block.arduino_get_number=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return Number(d.responseText)}; Blockly.Blocks.arduino_get_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_number_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_number_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.arduino_get_string=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return d.responseText}; Blockly.Blocks.arduino_get_sensor_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_arduino_get_sensor_number_0,"A0"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_1,"A1"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_2,"A2"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_3,"A3"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_4,"A4"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_5,"A5"]]),"PORT");this.appendDummyInput().appendField(" "); @@ -87,7 +87,7 @@ Blockly.Blocks.arduino_get_pwm_port_number={init:function(){this.setColour("#009 Blockly.Blocks.arduino_get_number_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.arduino_get_number_sensor_value=function(b,a){var c=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(c[1])}; Blockly.Blocks.arduino_get_digital_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_get_digital_value_1);this.appendValueInput("VALUE").setCheck("Number");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.arduino_get_digital_value=function(b,a){var c=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(c)}; Blockly.Blocks.arduino_toggle_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_2);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*")); -this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_led=function(b,a){var c=a.getNumberValue("VALUE"),d="on"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}; +this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_led=function(b,a){var c=a.getNumberValue("VALUE"),d=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(c,"on"==d?255:0);return a.callReturn()}; Blockly.Blocks.arduino_toggle_pwm={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_1);this.appendValueInput("PORT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_3);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", "*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_pwm=function(b,a){var c=a.getNumberValue("PORT"),d=a.getNumberValue("VALUE"),d=Math.round(d),d=Math.max(d,0),d=Math.min(d,255);Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}; Blockly.Blocks.arduino_convert_scale={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_1);this.appendValueInput("VALUE1").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_2);this.appendValueInput("VALUE2").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_3);this.appendValueInput("VALUE3").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_4); @@ -115,7 +115,7 @@ Entry.block.CODEino_get_accelerometer_direction=function(b,a){var c=a.getField(" Blockly.Blocks.CODEino_get_accelerometer_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_8).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_accelerometer_X,"3"],[Lang.Blocks.CODEino_accelerometer_Y,"4"],[Lang.Blocks.CODEino_accelerometer_Z,"5"]]),"PORT").appendField(Lang.Blocks.CODEino_string_9);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.CODEino_get_accelerometer_value=function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}; Blockly.Blocks.dplay_select_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([["7","7"],["8","8"],["9","9"],["10","10"]]),"PORT");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_select_led=function(b,a){var c=a.getField("PORT"),d=7;"7"==c?d=7:"8"==c?d=8:"9"==c?d=9:"10"==c&&(d=10);c="on"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(d,c);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_select_led=function(b,a){var c=a.getField("PORT"),d=7;"7"==c?d=7:"8"==c?d=8:"9"==c?d=9:"10"==c&&(d=10);c=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(d,"on"==c?255:0);return a.callReturn()}; Blockly.Blocks.dplay_get_switch_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ub514\uc9c0\ud138 ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["2","2"],["4","4"]]),"PORT");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.dplay_string_5,"ON"],[Lang.Blocks.dplay_string_6,"OFF"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; Entry.block.dplay_get_switch_status=function(b,a){var c=a.getField("PORT"),d=2;"2"==c?d=2:"4"==c&&(d=4);return"OFF"==a.getField("STATUS")?1==Entry.hw.getDigitalPortValue(d)?1:0:0==Entry.hw.getDigitalPortValue(d)?1:0}; Blockly.Blocks.dplay_get_light_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.dplay_light).appendField(new Blockly.FieldDropdown([[Lang.Blocks.dplay_string_3,"BRIGHT"],[Lang.Blocks.dplay_string_4,"DARK"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; @@ -182,10 +182,10 @@ Blockly.Blocks.get_rotation_direction={init:function(){this.setColour(calcBlockC Entry.block.get_rotation_direction=function(b,a){return"DIRECTION"==a.getField("OPERATOR",a).toUpperCase()?parseFloat(b.getDirection().toFixed(1)):parseFloat(b.getRotation().toFixed(1))}; Blockly.Blocks.distance_something={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_distance_something_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_distance_something_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.distance_something=function(b,a){var c=a.getField("VALUE",a);if("mouse"==c)return c=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-c.x,2)+Math.pow(b.getY()-c.y,2));c=Entry.container.getEntity(c);return Math.sqrt(Math.pow(b.getX()-c.getX(),2)+Math.pow(b.getY()-c.getY(),2))}; -Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(b,a){return"x"===a.getField("VALUE",a)?+Entry.stage.mouseCoordinate.x:+Entry.stage.mouseCoordinate.y}; +Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(b,a){return"x"===a.getField("VALUE",a)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}; Blockly.Blocks.coordinate_object={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_object_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithSelf",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_object_2,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"], [Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],null,!0,calcArrowColor),"COORDINATE").appendField(Lang.Blocks.CALC_coordinate_object_3,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return+c.getSize().toFixed(1);case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}; +Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return Number(c.getSize().toFixed(1));case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}; Blockly.Blocks.calc_basic={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["String","Number"]);this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.calc_basic=function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e};Blockly.Blocks.calc_plus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("+",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.calc_plus=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d};Blockly.Blocks.calc_minus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("-",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; @@ -232,7 +232,7 @@ Entry.block.quotient_and_mod=function(b,a){var c=a.getNumberValue("LEFTHAND",a), Blockly.Blocks.choose_project_timer_action={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_choose_project_timer_action_1,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_choose_project_timer_action_sub_1,"START"],[Lang.Blocks.CALC_choose_project_timer_action_sub_2,"STOP"],[Lang.Blocks.CALC_choose_project_timer_action_sub_3,"RESET"]],null,!0,calcArrowColor),"ACTION").appendField(Lang.Blocks.CALC_choose_project_timer_action_2, calcFontColor).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/calc_01.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)},whenAdd:function(){Entry.engine&&Entry.engine.showProjectTimer()},whenRemove:function(b){Entry.engine&&Entry.engine.hideProjectTimer(b)}}; Entry.block.choose_project_timer_action=function(b,a){var c=a.getField("ACTION"),d=Entry.engine,e=d.projectTimer;"START"==c?e.isInit?e.isInit&&e.isPaused&&(e.pauseStart&&(e.pausedTime+=(new Date).getTime()-e.pauseStart),delete e.pauseStart,e.isPaused=!1):d.startProjectTimer():"STOP"==c?e.isInit&&!e.isPaused&&(e.isPaused=!0,e.pauseStart=(new Date).getTime()):"RESET"==c&&e.isInit&&(e.setValue(0),e.start=(new Date).getTime(),e.pausedTime=0,delete e.pauseStart);return a.callReturn()};Blockly.Blocks.wait_second={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_1);this.appendValueInput("SECOND").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.wait_second=function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;var c=a.getNumberValue("SECOND",a),c=60/(Entry.FPS||60)*c*1E3;setTimeout(function(){a.timeFlag=0},c);return a}; +Entry.block.wait_second=function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;var c=a.getNumberValue("SECOND",a);setTimeout(function(){a.timeFlag=0},60/(Entry.FPS||60)*c*1E3);return a}; Blockly.Blocks.repeat_basic={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_basic_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_basic_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.repeat_basic=function(b,a){var c;if(!a.isLooped){a.isLooped=!0;c=a.getNumberValue("VALUE",a);if(0>c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(c)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}; Blockly.Blocks.repeat_inf={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_inf).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_inf=function(b,a){a.isLooped=!0;return a.getStatement("DO")}; @@ -305,10 +305,10 @@ Blockly.Blocks.hamster_follow_line_until={init:function(){this.setColour("#00979 Entry.block.hamster_follow_line_until=function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=a.getField("COLOR"),f=a.getField("DIRECTION"),g=4;"RIGHT"==f?g=5:"FRONT"==f?g=6:"REAR"==f&&(g=7);"WHITE"==e&&(g+=7);if(a.isStart){if(e=Entry.Hamster,d.lineTracerStateId!=e.lineTracerStateId&&(e.lineTracerStateId=d.lineTracerStateId,64==d.lineTracerState))return delete a.isStart,Entry.engine.isContinue=!1,e.setLineTracerMode(c,0),a.callReturn()}else a.isStart=!0,c.leftWheel=0,c.rightWheel=0,Entry.Hamster.setLineTracerMode(c, g);return a}; Blockly.Blocks.hamster_set_following_speed_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_following_speed_to_1).appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]]),"SPEED").appendField(Lang.Blocks.HAMSTER_set_following_speed_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hamster_set_following_speed_to=function(b,a){Entry.hw.sendQueue.lineTracerSpeed=+a.getField("SPEED",a);return a.callReturn()};Blockly.Blocks.hamster_stop={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_stop).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.hamster_set_following_speed_to=function(b,a){Entry.hw.sendQueue.lineTracerSpeed=Number(a.getField("SPEED",a));return a.callReturn()};Blockly.Blocks.hamster_stop={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_stop).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_stop=function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}; Blockly.Blocks.hamster_set_led_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_led_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_set_led_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.HAMSTER_color_cyan,"3"],[Lang.General.blue,"1"], -[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}; +[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}; Blockly.Blocks.hamster_clear_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_clear_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_clear_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_clear_led=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()};Blockly.Blocks.hamster_beep={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_beep).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_beep=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;c.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;c.buzzer=440;c.note=0;var d=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(d)},200);Entry.Hamster.timeouts.push(d);return a}; @@ -329,12 +329,12 @@ Entry.block.hamster_change_tempo_by=function(b,a){Entry.Hamster.tempo+=a.getNumb Blockly.Blocks.hamster_set_tempo_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_set_tempo_to=function(b,a){Entry.Hamster.tempo=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}; Blockly.Blocks.hamster_set_port_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_port_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_set_port_to_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output,"8"], -[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]]),"MODE").appendField(Lang.Blocks.HAMSTER_set_port_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_port_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=+a.getField("MODE",a);"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}; +[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]]),"MODE").appendField(Lang.Blocks.HAMSTER_set_port_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_port_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=Number(a.getField("MODE",a));"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}; Blockly.Blocks.hamster_change_output_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_output_by_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_change_output_by_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_output_by_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_change_output_by=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=void 0!=c.outputA?c.outputA+e:e:("B"!=d&&(c.outputA=void 0!=c.outputA?c.outputA+e:e),c.outputB=void 0!=c.outputB?c.outputB+e:e);return a.callReturn()}; Blockly.Blocks.hamster_set_output_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_output_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_set_output_to_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_output_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_output_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=e:("B"!=d&&(c.outputA=e),c.outputB=e);return a.callReturn()};Blockly.Blocks.is_clicked={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_clicked,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_clicked=function(b,a){return Entry.stage.isClick}; -Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(b,a){var c=+a.getField("VALUE",a);return 0<=Entry.pressedKeys.indexOf(c)}; +Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(b,a){var c=Number(a.getField("VALUE",a));return 0<=Entry.pressedKeys.indexOf(c)}; Blockly.Blocks.reach_something={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_reach_something_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("collision"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_reach_something_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; Entry.block.reach_something=function(b,a){if(!b.getVisible())return!1;var c=a.getField("VALUE",a),d=b.object,e=/wall/.test(c),f=ndgmr.checkPixelCollision;if(e)switch(e=Entry.stage.wall,c){case "wall":if(f(d,e.up,.2,!0)||f(d,e.down,.2,!0)||f(d,e.left,.2,!0)||f(d,e.right,.2,!0))return!0;break;case "wall_up":if(f(d,e.up,.2,!0))return!0;break;case "wall_down":if(f(d,e.down,.2,!0))return!0;break;case "wall_right":if(f(d,e.right,.2,!0))return!0;break;case "wall_left":if(f(d,e.left,.2,!0))return!0}else{if("mouse"== c)return f=Entry.stage.canvas,f=d.globalToLocal(f.mouseX,f.mouseY),d.hitTest(f.x,f.y);c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==b.type){f=c.object.getTransformedBounds();d=d.getTransformedBounds();if(Entry.checkCollisionRect(d,f))return!0;for(var c=c.parent.clonedEntities,e=0,g=c.length;e","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_basic_operator=function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return+d>+e;case "LESS":return+d<+e;case "GREATER_OR_EQUAL":return+d>=+e;case "LESS_OR_EQUAL":return+d<=+e}};Blockly.Blocks.show={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_show).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.show=function(b,a){b.setVisible(!0);return a.callReturn()}; +Entry.block.boolean_basic_operator=function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return Number(d)>Number(e);case "LESS":return Number(d)=Number(e);case "LESS_OR_EQUAL":return Number(d)<=Number(e)}};Blockly.Blocks.show={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_show).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.show=function(b,a){b.setVisible(!0);return a.callReturn()}; Blockly.Blocks.hide={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_hide).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hide=function(b,a){b.setVisible(!1);return a.callReturn()}; Blockly.Blocks.dialog_time={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_1);this.appendValueInput("VALUE").setCheck(["String","Number",null]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_2);this.appendValueInput("SECOND").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_3);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.speak,"speak"]]),"OPTION"); this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -401,7 +401,7 @@ Entry.block.locate_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue Blockly.Blocks.rotate_by_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.rotate_by_angle=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}; Blockly.Blocks.rotate_by_angle_dropdown={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_dropdown_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([["45","45"],["90","90"],["135","135"],["180","180"]]),"VALUE").appendField(Lang.Blocks.MOVING_rotate_by_angle_dropdown_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_by_angle_dropdown=function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+ +c);return a.callReturn()}; +Entry.block.rotate_by_angle_dropdown=function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}; Blockly.Blocks.see_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.see_angle=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}; Blockly.Blocks.see_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_direction_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sprites"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -413,7 +413,7 @@ Entry.block.locate_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b Blockly.Blocks.locate_y={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_y_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_y_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.locate_y=function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate=function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(+c);b.setY(+d);b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}; +Entry.block.locate=function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}; Blockly.Blocks.move_xy_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_3);this.appendValueInput("VALUE3").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.move_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dX=d/a.frameCount;a.dY=e/a.frameCount}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; @@ -439,8 +439,8 @@ Blockly.Blocks.rotate_direction={init:function(){this.setColour("#A751E3");this. Entry.block.rotate_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; Blockly.Blocks.locate_object_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"TARGET");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_object_time=function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=+e.x,e=+e.y):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&& -b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +Entry.block.locate_object_time=function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&& +!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.rotate_absolute={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_set_direction_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_set_direction_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.rotate_absolute=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}; Blockly.Blocks.rotate_relative={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -830,7 +830,6 @@ this.name;d=Entry.createElement("div");d.addClass("entryObjectEditWorkspace");d. (d=Entry.createElement("div"),d.addClass("entryObjectDeleteWorkspace"),d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.container.removeObject(this.object)}));d=Entry.createElement("div");d.addClass("entryObjectInformationWorkspace");d.object=this;this.isInformationToggle=!1;b.appendChild(d);this.informationView_=d;b=Entry.createElement("div");b.addClass("entryObjectRotationWrapperWorkspace");b.object=this;this.view_.appendChild(b); d=Entry.createElement("span");d.addClass("entryObjectCoordinateWorkspace");b.appendChild(d);e=Entry.createElement("span");e.addClass("entryObjectCoordinateSpanWorkspace");e.innerHTML="X:";var g=Entry.createElement("input");g.addClass("entryObjectCoordinateInputWorkspace");g.setAttribute("readonly",!0);g.bindOnClick(function(a){a.stopPropagation();this.select()});var h=Entry.createElement("span");h.addClass("entryObjectCoordinateSpanWorkspace");h.innerHTML="Y:";var k=Entry.createElement("input");k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"); k.bindOnClick(function(a){a.stopPropagation();this.select()});k.setAttribute("readonly",!0);var l=Entry.createElement("span");l.addClass("entryObjectCoordinateSizeWorkspace");l.innerHTML=Lang.Workspace.Size+" : ";var n=Entry.createElement("input");n.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size");n.bindOnClick(function(a){a.stopPropagation();this.select()});n.setAttribute("readonly",!0);d.appendChild(e);d.appendChild(g);d.appendChild(h);d.appendChild(k); -<<<<<<< HEAD d.appendChild(l);d.appendChild(n);d.xInput_=g;d.yInput_=k;d.sizeInput_=n;this.coordinateView_=d;c=this;g.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};g.onblur=function(a){isNaN(g.value)||c.entity.setX(Number(g.value));c.updateCoordinateView();Entry.stage.updateObject()};k.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};k.onblur=function(a){isNaN(k.value)||c.entity.setY(Number(k.value));c.updateCoordinateView();Entry.stage.updateObject()};n.onkeypress=function(a){13== a.keyCode&&c.editObjectValues(!1)};n.onblur=function(a){isNaN(n.value)||c.entity.setSize(Number(n.value));c.updateCoordinateView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("entryObjectRotateLabelWrapperWorkspace");this.view_.appendChild(d);this.rotateLabelWrapperView_=d;e=Entry.createElement("span");e.addClass("entryObjectRotateSpanWorkspace");e.innerHTML=Lang.Workspace.rotation+" : ";var q=Entry.createElement("input");q.addClass("entryObjectRotateInputWorkspace");q.setAttribute("readonly", !0);q.bindOnClick(function(a){a.stopPropagation();this.select()});this.rotateSpan_=e;this.rotateInput_=q;h=Entry.createElement("span");h.addClass("entryObjectDirectionSpanWorkspace");h.innerHTML=Lang.Workspace.direction+" : ";var m=Entry.createElement("input");m.addClass("entryObjectDirectionInputWorkspace");m.setAttribute("readonly",!0);m.bindOnClick(function(a){a.stopPropagation();this.select()});this.directionInput_=m;d.appendChild(e);d.appendChild(q);d.appendChild(h);d.appendChild(m);d.rotateInput_= @@ -851,27 +850,6 @@ function(a){c.entity.setY(c.entity.getY());Entry.stage.updateObject()},d=Entry.c b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("free")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeBWorkspace"),b.object=this,this.rotateModeBView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("vertical")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeCWorkspace"),b.object=this,this.rotateModeCView_= b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("none")}),this.updateThumbnailView(),this.updateCoordinateView(),this.updateRotateMethodView(),this.updateInputViews(),this.view_};Entry.EntryObject.prototype.setName=function(b){Entry.assert("string"==typeof b,"object name must be string");this.name=b;this.nameView_.value=b};Entry.EntryObject.prototype.setText=function(b){Entry.assert("string"==typeof b,"object text must be string");this.text=b}; Entry.EntryObject.prototype.setScript=function(b){this.script=b};Entry.EntryObject.prototype.getScriptText=function(){return JSON.stringify(this.script.toJSON())}; -======= -d.appendChild(l);d.appendChild(n);d.xInput_=g;d.yInput_=k;d.sizeInput_=n;this.coordinateView_=d;c=this;g.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};g.onblur=function(a){isNaN(g.value)||c.entity.setX(+g.value);c.updateCoordinateView();Entry.stage.updateObject()};k.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};k.onblur=function(a){isNaN(k.value)||c.entity.setY(+k.value);c.updateCoordinateView();Entry.stage.updateObject()};n.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)}; -n.onblur=function(a){isNaN(n.value)||c.entity.setSize(+n.value);c.updateCoordinateView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("entryObjectRotateLabelWrapperWorkspace");this.view_.appendChild(d);this.rotateLabelWrapperView_=d;e=Entry.createElement("span");e.addClass("entryObjectRotateSpanWorkspace");e.innerHTML=Lang.Workspace.rotation+" : ";var m=Entry.createElement("input");m.addClass("entryObjectRotateInputWorkspace");m.setAttribute("readonly",!0);m.bindOnClick(function(a){a.stopPropagation(); -this.select()});this.rotateSpan_=e;this.rotateInput_=m;h=Entry.createElement("span");h.addClass("entryObjectDirectionSpanWorkspace");h.innerHTML=Lang.Workspace.direction+" : ";var q=Entry.createElement("input");q.addClass("entryObjectDirectionInputWorkspace");q.setAttribute("readonly",!0);q.bindOnClick(function(a){a.stopPropagation();this.select()});this.directionInput_=q;d.appendChild(e);d.appendChild(m);d.appendChild(h);d.appendChild(q);d.rotateInput_=m;d.directionInput_=q;c=this;m.onkeypress=function(a){13== -a.keyCode&&c.editObjectValues(!1)};m.onblur=function(a){a=m.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setRotation(+a);c.updateRotationView();Entry.stage.updateObject()};q.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};q.onblur=function(a){a=q.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setDirection(+a);c.updateRotationView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("rotationMethodWrapper"); -b.appendChild(d);this.rotationMethodWrapper_=d;b=Entry.createElement("span");b.addClass("entryObjectRotateMethodLabelWorkspace");d.appendChild(b);b.innerHTML=Lang.Workspace.rotate_method+" : ";b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeAWorkspace");b.object=this;this.rotateModeAView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("free"),this.object.setRotateMethod("free"))}); -b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeBWorkspace");b.object=this;this.rotateModeBView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("vertical"),this.object.setRotateMethod("vertical"))});b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeCWorkspace");b.object=this;this.rotateModeCView_=b;d.appendChild(b); -b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("none"),this.object.setRotateMethod("none"))});this.updateThumbnailView();this.updateCoordinateView();this.updateRotateMethodView();this.updateInputViews();this.updateCoordinateView(!0);this.updateRotationView(!0);return this.view_}if("phone"==Entry.type)return b=Entry.createElement("li",this.id),b.addClass("entryContainerListElementWorkspace"),b.object=this,b.bindOnClick(function(a){Entry.container.getObject(this.id)&& -Entry.container.selectObject(this.id)}),$&&(a=this,context.attach("#"+this.id,[{text:Lang.Workspace.context_rename,href:"/",action:function(a){a.preventDefault()}},{text:Lang.Workspace.context_duplicate,href:"/",action:function(b){b.preventDefault();Entry.container.addCloneObject(a)}},{text:Lang.Workspace.context_remove,href:"/",action:function(b){b.preventDefault();Entry.container.removeObject(a)}}])),this.view_=b,b=Entry.createElement("ul"),b.addClass("objectInfoView"),d=Entry.createElement("li"), -d.addClass("objectInfo_visible"),e=Entry.createElement("li"),e.addClass("objectInfo_lock"),b.appendChild(d),b.appendChild(e),this.view_.appendChild(b),b=Entry.createElement("div"),b.addClass("entryObjectThumbnailWorkspace"),this.view_.appendChild(b),this.thumbnailView_=b,b=Entry.createElement("div"),b.addClass("entryObjectWrapperWorkspace"),this.view_.appendChild(b),d=Entry.createElement("input"),d.addClass("entryObjectNameWorkspace"),b.appendChild(d),this.nameView_=d,this.nameView_.entryObject=this, -this.nameView_.onblur=function(){this.entryObject.name=this.value;Entry.playground.reloadPlayground()},this.nameView_.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)},this.nameView_.value=this.name,Entry.objectEditable&&Entry.objectDeletable&&(d=Entry.createElement("div"),d.addClass("entryObjectDeletePhone"),d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.container.removeObject(this.object)})),d=Entry.createElement("button"), -d.addClass("entryObjectEditPhone"),d.object=this,d.bindOnClick(function(a){if(a=Entry.container.getObject(this.id))Entry.container.selectObject(a.id),Entry.playground.injectObject(a)}),this.view_.appendChild(d),d=Entry.createElement("div"),d.addClass("entryObjectInformationWorkspace"),d.object=this,this.isInformationToggle=!1,b.appendChild(d),this.informationView_=d,d=Entry.createElement("div"),d.addClass("entryObjectRotateLabelWrapperWorkspace"),this.view_.appendChild(d),this.rotateLabelWrapperView_= -d,e=Entry.createElement("span"),e.addClass("entryObjectRotateSpanWorkspace"),e.innerHTML=Lang.Workspace.rotation+" : ",m=Entry.createElement("input"),m.addClass("entryObjectRotateInputWorkspace"),this.rotateSpan_=e,this.rotateInput_=m,h=Entry.createElement("span"),h.addClass("entryObjectDirectionSpanWorkspace"),h.innerHTML=Lang.Workspace.direction+" : ",q=Entry.createElement("input"),q.addClass("entryObjectDirectionInputWorkspace"),this.directionInput_=q,d.appendChild(e),d.appendChild(m),d.appendChild(h), -d.appendChild(q),d.rotateInput_=m,d.directionInput_=q,c=this,m.onkeypress=function(a){13==a.keyCode&&(a=m.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))),isNaN(a)||c.entity.setRotation(+a),c.updateRotationView(),m.blur())},m.onblur=function(a){c.entity.setRotation(c.entity.getRotation());Entry.stage.updateObject()},q.onkeypress=function(a){13==a.keyCode&&(a=q.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))),isNaN(a)||c.entity.setDirection(+a),c.updateRotationView(), -q.blur())},q.onblur=function(a){c.entity.setDirection(c.entity.getDirection());Entry.stage.updateObject()},b=Entry.createElement("div"),b.addClass("entryObjectRotationWrapperWorkspace"),b.object=this,this.view_.appendChild(b),d=Entry.createElement("span"),d.addClass("entryObjectCoordinateWorkspace"),b.appendChild(d),e=Entry.createElement("span"),e.addClass("entryObjectCoordinateSpanWorkspace"),e.innerHTML="X:",g=Entry.createElement("input"),g.addClass("entryObjectCoordinateInputWorkspace"),h=Entry.createElement("span"), -h.addClass("entryObjectCoordinateSpanWorkspace"),h.innerHTML="Y:",k=Entry.createElement("input"),k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"),l=Entry.createElement("span"),l.addClass("entryObjectCoordinateSpanWorkspace"),l.innerHTML=Lang.Workspace.Size,n=Entry.createElement("input"),n.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size"),d.appendChild(e),d.appendChild(g),d.appendChild(h),d.appendChild(k),d.appendChild(l), -d.appendChild(n),d.xInput_=g,d.yInput_=k,d.sizeInput_=n,this.coordinateView_=d,c=this,g.onkeypress=function(a){13==a.keyCode&&(isNaN(g.value)||c.entity.setX(+g.value),c.updateCoordinateView(),c.blur())},g.onblur=function(a){c.entity.setX(c.entity.getX());Entry.stage.updateObject()},k.onkeypress=function(a){13==a.keyCode&&(isNaN(k.value)||c.entity.setY(+k.value),c.updateCoordinateView(),c.blur())},k.onblur=function(a){c.entity.setY(c.entity.getY());Entry.stage.updateObject()},d=Entry.createElement("div"), -d.addClass("rotationMethodWrapper"),b.appendChild(d),this.rotationMethodWrapper_=d,b=Entry.createElement("span"),b.addClass("entryObjectRotateMethodLabelWorkspace"),d.appendChild(b),b.innerHTML=Lang.Workspace.rotate_method+" : ",b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeAWorkspace"),b.object=this,this.rotateModeAView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("free")}),b=Entry.createElement("div"), -b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeBWorkspace"),b.object=this,this.rotateModeBView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("vertical")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeCWorkspace"),b.object=this,this.rotateModeCView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("none")}), -this.updateThumbnailView(),this.updateCoordinateView(),this.updateRotateMethodView(),this.updateInputViews(),this.view_};Entry.EntryObject.prototype.setName=function(b){Entry.assert("string"==typeof b,"object name must be string");this.name=b;this.nameView_.value=b};Entry.EntryObject.prototype.setText=function(b){Entry.assert("string"==typeof b,"object text must be string");this.text=b};Entry.EntryObject.prototype.setScript=function(b){this.script=b};Entry.EntryObject.prototype.getScriptText=function(){return JSON.stringify(this.script.toJSON())}; ->>>>>>> master Entry.EntryObject.prototype.initEntity=function(b){var a={};a.x=a.y=0;a.rotation=0;a.direction=90;if("sprite"==this.objectType){var c=b.sprite.pictures[0].dimension;a.regX=c.width/2;a.regY=c.height/2;a.scaleX=a.scaleY="background"==b.sprite.category.main?Math.max(270/c.height,480/c.width):"new"==b.sprite.category.main?1:200/(c.width+c.height);a.width=c.width;a.height=c.height}else if("textBox"==this.objectType)if(a.regX=25,a.regY=12,a.scaleX=a.scaleY=1.5,a.width=50,a.height=24,a.text=b.text,b.options){if(b= b.options,c="",b.bold&&(c+="bold "),b.italic&&(c+="italic "),a.underline=b.underline,a.strike=b.strike,a.font=c+"20px "+b.font.family,a.colour=b.colour,a.bgColor=b.background,a.lineBreak=b.lineBreak)a.width=256,a.height=.5625*a.width,a.regX=a.width/2,a.regY=a.height/2}else a.underline=!1,a.strike=!1,a.font="20px Nanum Gothic",a.colour="#000000",a.bgColor="#ffffff";return a}; Entry.EntryObject.prototype.updateThumbnailView=function(){if("sprite"==this.objectType)if(this.entity.picture.fileurl)this.thumbnailView_.style.backgroundImage='url("'+this.entity.picture.fileurl+'")';else{var b=this.entity.picture.filename;this.thumbnailView_.style.backgroundImage='url("'+Entry.defaultPath+"/uploads/"+b.substring(0,2)+"/"+b.substring(2,4)+"/thumb/"+b+'.png")'}else"textBox"==this.objectType&&(this.thumbnailView_.style.backgroundImage="url("+(Entry.mediaFilePath+"/text_icon.png")+ @@ -1032,7 +1010,7 @@ node:a};};b.UpdateExpression=function(a){throw{message:a.operator+"\uc740(\ub294 node:a};};b.initScope=function(a){if(null===this.scope){var b=function(){};b.prototype=this.syntax.Scope}else b=function(){},b.prototype=this.scope;this.scope=new b;this.scopeChain.push(this.scope);return this.scanDefinition(a)};b.unloadScope=function(){this.scopeChain.pop();this.scope=this.scopeChain.length?this.scopeChain[this.scopeChain.length-1]:null};b.scanDefinition=function(a){a=a.body;for(var b=[],d=0;d=b.keyCode&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:d})});break;case "block":this._parser=new Entry.BlockParser(this.syntax)}}; (function(b){b.parse=function(a){var b=null;switch(this._lang){case "js":try{var d=acorn.parse(a),b=this._parser.Program(d)}catch(e){this.codeMirror&&(e instanceof SyntaxError?(a={from:{line:e.loc.line-1,ch:e.loc.column-2},to:{line:e.loc.line-1,ch:e.loc.column+1}},e.message="\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4."):(a=this.getLineNumber(e.node.start,e.node.end),a.message=e.message,a.severity="error",this.codeMirror.markText(a.from,a.to,{className:"CodeMirror-lint-mark-error",__annotation:a, clearOnEnter:!0})),Entry.toast.alert("Error",e.message)),b=[]}break;case "block":a=this._parser.Code(a).match(/(.*{.*[\S|\s]+?}|.+)/g),b=Array.isArray(a)?a.reduce(function(a,b,c){var d="";1===c&&(a+="\n");d=-1=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var a={name:b.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(a);this.addScene(a);b=Entry.container.getSceneObjects(b);for(var c=b.length-1;0<=c;c--)Entry.container.addCloneObject(b[c],a.id)}}; Entry.Scene.prototype.resize=function(){var b=this.getScenes(),a=this.selectedScene,c=b[0];if(0!==b.length&&c){var d=$(c.view).offset().left,c=parseFloat($(a.view).css("margin-left")),e=$(this.view_).width()-d,f=0,g;for(g in b){var d=b[g],h=d.view;h.addClass("minValue");$(d.inputWrapper).width(Entry.computeInputWidth(d.name));h=$(h);f=f+h.width()+c}if(f>e)for(g in e-=$(a.view).width(),c=e/(b.length-1)-(Entry.Scene.viewBasicWidth+c),b)d=b[g],a.id!=d.id?(d.view.removeClass("minValue"),$(d.inputWrapper).width(c)): d.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var b=this.getScenes();return b[b.indexOf(this.selectedScene)+1]};Entry.Script=function(b){this.entity=b};p=Entry.Script.prototype; -p.init=function(b,a,c){Entry.assert("BLOCK"==b.tagName.toUpperCase(),b.tagName);this.type=b.getAttribute("type");this.id=+b.getAttribute("id");b.getElementsByTagName("mutation").length&&b.getElementsByTagName("mutation")[0].hasAttribute("hashid")&&(this.hashId=b.childNodes[0].getAttribute("hashid"));"REPEAT"==this.type.substr(0,6).toUpperCase()&&(this.isRepeat=!0);a instanceof Entry.Script&&(this.previousScript=a,a.parentScript&&(this.parentScript=a.parentScript));c instanceof Entry.Script&&(this.parentScript= -c);b=b.childNodes;for(a=0;ag&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||Entry.dispatchEvent("loadComplete")};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;dg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return this.queueCount/this.totalCount};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;d=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; Entry.Utils.colorDarken=function(b,a){function c(a){2!=a.length&&(a="0"+a);return a}var d,e,f;7===b.length?(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),f=parseInt(b.substr(5,2),16)):(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),f=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;d=c(Math.floor(d*a).toString(16));e=c(Math.floor(e*a).toString(16));f=c(Math.floor(f*a).toString(16));return"#"+d+e+f}; Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;var c=Entry.Utils.hexToHsl(b);c.l+=a/100;c.l=Math.min(1,Math.max(0,c.l));return Entry.Utils.hslToHex(c)};Entry.Utils.bound01=function(b,a){var c=b;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(b="100%");c="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));c&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; @@ -1157,12 +1135,12 @@ Entry.addEventListener=function(b,a){this.events_||(this.events_={});this.events Entry.removeAllEventListener=function(b){this.events_&&this.events_[b]&&delete this.events_[b]};Entry.addTwoNumber=function(b,a){if(isNaN(b)||isNaN(a))return b+a;b+="";a+="";var c=b.indexOf("."),d=a.indexOf("."),e=0,f=0;0=f?(parseFloat(b)+parseFloat(a)).toFixed(e):(parseFloat(b)+parseFloat(a)).toFixed(f):parseInt(b)+parseInt(a)}; Entry.hex2rgb=function(b){return(b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(b))?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null};Entry.rgb2hex=function(b,a,c){return"#"+(16777216+(b<<16)+(a<<8)+c).toString(16).slice(1)};Entry.generateRgb=function(){return{r:Math.floor(256*Math.random()),g:Math.floor(256*Math.random()),b:Math.floor(256*Math.random())}};Entry.adjustValueWithMaxMin=function(b,a,c){return b>c?c:ba.y+a.height||b.x+b.widtha.x+a.width)};Entry.bindAnimationCallback=function(b,a){b.addEventListener("webkitAnimationEnd",a,!1);b.addEventListener("animationend",a,!1);b.addEventListener("oanimationend",a,!1)};Entry.cloneSimpleObject=function(b){var a={},c;for(c in b)a[c]=b[c];return a};Entry.nodeListToArray=function(b){for(var a=Array(b.length),c=-1,d=b.length;++c!==d;a[c]=b[c]);return a}; -Entry.computeInputWidth=function(b){var a=document.createElement("span");a.className="tmp-element";a.innerHTML=b.replace(/&/g,"&").replace(//g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return+(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],c=0;c/g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return Number(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],c=0;cd&&(d=h.index)}return 0a&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:+(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,c){setTimeout(function(){b.addEventListener(a,c)},0)};Entry.deAttachEventListener=function(b,a,c){b.removeEventListener(a,c)}; +Entry.getMaxFloatPoint=function(b){for(var a=0,c=0,d=b.length;ca&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:Number(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,c){setTimeout(function(){b.addEventListener(a,c)},0)};Entry.deAttachEventListener=function(b,a,c){b.removeEventListener(a,c)}; Entry.isEmpty=function(b){if(!b)return!0;for(var a in b)if(b.hasOwnProperty(a))return!1;return!0};Entry.Utils.disableContextmenu=function(b){if(b)$(b).on("contextmenu",function(a){a.stopPropagation();a.preventDefault();return!1})};Entry.Utils.isRightButton=function(b){return 2==b.button||b.ctrlKey};Entry.Utils.isTouchEvent=function(b){return"mousedown"!==b.type.toLowerCase()};Entry.Utils.inherit=function(b,a){function c(){}c.prototype=b.prototype;a.prototype=new c;return a}; Entry.bindAnimationCallbackOnce=function(b,a){b.one("webkitAnimationEnd animationendo animationend",a)};Entry.Utils.isInInput=function(b){return"textarea"==b.target.type||"text"==b.target.type};Entry.Utils.isFunction=function(b){return"function"===typeof b}; Entry.Utils.addFilters=function(b,a){var c=b.elem("defs"),d=c.elem("filter",{id:"entryTrashcanFilter_"+a});d.elem("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:2,result:"blur"});d.elem("feOffset",{"in":"blur",dx:1,dy:1,result:"offsetBlur"});d=d.elem("feMerge");d.elem("feMergeNode",{"in":"offsetBlur"});d.elem("feMergeNode",{"in":"SourceGraphic"},d);d=c.elem("filter",{id:"entryBlockShadowFilter_"+a,height:"200%"});d.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:1});d.elem("feColorMatrix", @@ -1195,13 +1173,8 @@ Entry.Func.setupMenuCode=function(){var b=Entry.playground.mainWorkspace;b&&(b=b Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.menuCode||this.setupMenuCode();var b=Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length;2>>>>>> master Entry.Func.prototype.generateBlock=function(b){b=Entry.Func.generateBlock(this);this.block=b.block;this.description=b.description}; Entry.Func.generateWsBlock=function(b){this.unbindFuncChangeEvent();b=b?b:this.targetFunc;for(var a=b.content.getEventMap("funcDef")[0].params[0],c=0,d=0,e=[],f="",g=b.hashMap,h=b.paramMap;a;){var k=a.params[0];switch(a.type){case "function_field_label":f=f+" "+k;break;case "function_field_boolean":Entry.Mutator.mutate(k.type,{template:Lang.Blocks.FUNCTION_logical_variable+" "+(c?c:"")});g[k.type]=!1;h[k.type]=c+d;c++;e.push({type:"Block",accept:"boolean"});f+=" %"+(c+d);break;case "function_field_string":Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_character_variable+" "+(d?d:"")}),g[k.type]=!1,h[k.type]=c+d,d++,f+=" %"+(c+d),e.push({type:"Block",accept:"string"})}a=a.getOutputBlock()}c++;f+=" %"+(c+d);e.push({type:"Indicator",img:"block_icon/function_03.png",size:12});Entry.Mutator.mutate("func_"+b.id,{params:e,template:f});for(var l in g)g[l]?(a=-1=Entry.HW.TRIAL_LIMIT)this.isFi JSON.parse(a.data);b.checkDevice(a);b.updatePortData(a)}.bind(this),a.onclose=function(){"WebSocket"===b.socketType&&(this.socket=null,b.initSocket())}}catch(d){}try{c=new WebSocket("wss://hardware.play-entry.org:23518")}catch(d){}}c.binaryType="arraybuffer";c.onopen=function(){b.socketType="WebSocketSecurity";b.initHardware(c)};c.onmessage=function(a){a=JSON.parse(a.data);b.checkDevice(a);b.updatePortData(a)};c.onclose=function(){"WebSocketSecurity"===b.socketType&&(this.socket=null,b.initSocket())}; Entry.dispatchEvent("hwChanged")}}catch(d){}};p.retryConnect=function(){this.connectTrial=0;this.initSocket()};p.initHardware=function(b){this.socket=b;this.connectTrial=0;this.connected=!0;Entry.dispatchEvent("hwChanged");Entry.playground&&Entry.playground.object&&Entry.playground.setMenu(Entry.playground.object.objectType)};p.setDigitalPortValue=function(b,a){this.sendQueue[b]=a;this.removePortReadable(b)};p.getAnalogPortValue=function(b){return this.connected?this.portData["a"+b]:0}; p.getDigitalPortValue=function(b){if(!this.connected)return 0;this.setPortReadable(b);return void 0!==this.portData[b]?this.portData[b]:0};p.setPortReadable=function(b){this.sendQueue.readablePorts||(this.sendQueue.readablePorts=[]);var a=!1,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=!0;break}a||this.sendQueue.readablePorts.push(b)}; -p.removePortReadable=function(b){if(this.sendQueue.readablePorts||Array.isArray(this.sendQueue.readablePorts)){var a,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=+c;break}this.sendQueue.readablePorts=void 0!=a?this.sendQueue.readablePorts.slice(0,a).concat(this.sendQueue.readablePorts.slice(a+1,this.sendQueue.readablePorts.length)):[]}};p.update=function(){this.socket&&1==this.socket.readyState&&this.socket.send(JSON.stringify(this.sendQueue))}; +p.removePortReadable=function(b){if(this.sendQueue.readablePorts||Array.isArray(this.sendQueue.readablePorts)){var a,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=Number(c);break}this.sendQueue.readablePorts=void 0!=a?this.sendQueue.readablePorts.slice(0,a).concat(this.sendQueue.readablePorts.slice(a+1,this.sendQueue.readablePorts.length)):[]}};p.update=function(){this.socket&&1==this.socket.readyState&&this.socket.send(JSON.stringify(this.sendQueue))}; p.updatePortData=function(b){this.portData=b;this.hwMonitor&&this.hwMonitor.update()};p.closeConnection=function(){this.socket&&this.socket.close()};p.downloadConnector=function(){window.open("http://download.play-entry.org/apps/Entry_HW_1.5.5_Setup.exe","_blank").focus()};p.downloadSource=function(){window.open("http://play-entry.com/down/board.ino","_blank").focus()};p.setZero=function(){Entry.hw.hwModule&&Entry.hw.hwModule.setZero()}; p.checkDevice=function(b){void 0!==b.company&&(b=""+b.company+b.model,b!=this.selectedDevice&&(this.selectedDevice=b,this.hwModule=this.hwInfo[b],Entry.dispatchEvent("hwChanged"),Entry.toast.success("\ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 \uc131\uacf5","\ud558\ub4dc\uc6e8\uc5b4 \uc544\uc774\ucf58\uc744 \ub354\ube14\ud074\ub9ad\ud558\uba74, \uc13c\uc11c\uac12\ub9cc \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.",!0),this.hwModule.monitorTemplate&&(this.hwMonitor?(this.hwMonitor._hwModule=this.hwModule, -this.hwMonitor.initView()):this.hwMonitor=new Entry.HWMonitor(this.hwModule),Entry.propertyPanel.addMode("hw",this.hwMonitor),b=this.hwModule.monitorTemplate,"both"==b.mode?(b.mode="list",this.hwMonitor.generateListView(),b.mode="general",this.hwMonitor.generateView(),b.mode="both"):"list"==b.mode?this.hwMonitor.generateListView():this.hwMonitor.generateView())))};p.banHW=function(){var b=this.hwInfo,a;for(a in b)Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name,!0)};Entry.BlockModel=function(){Entry.Model(this)};Entry.BlockModel.prototype.schema={id:null,x:0,y:0,type:null,params:{},statements:{},prev:null,next:null,view:null};Entry.BlockRenderModel=function(){Entry.Model(this)};Entry.BlockRenderModel.prototype.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,width:0,height:0,magneting:!1};Entry.BoxModel=function(){Entry.Model(this)};Entry.BoxModel.prototype.schema={id:0,type:Entry.STATIC.BOX_MODEL,x:0,y:0,width:0,height:0};Entry.DragInstance=function(b){Entry.Model(this);this.set(b)};Entry.DragInstance.prototype.schema={type:Entry.STATIC.DRAG_INSTANCE,startX:0,startY:0,offsetX:0,offsetY:0,absX:0,absY:0,prev:null,height:0,mode:0,isNew:!1};Entry.ThreadModel=function(){Entry.Model(this)};Entry.ThreadModel.prototype.schema={id:0,type:Entry.STATIC.THREAD_MODEL,x:0,y:0,width:0,minWidth:0,height:0};Entry.Variable=function(b){Entry.assert("string"==typeof b.name,"Variable name must be given");this.name_=b.name;this.id_=b.id?b.id:Entry.generateHash();this.type=b.variableType?b.variableType:"variable";this.object_=b.object||null;this.isCloud_=b.isCloud||!1;var a=Entry.parseNumber(b.value);this.value_="number"==typeof a?a:b.value?b.value:0;"slide"==this.type?(this.minValue_=+(b.minValue?b.minValue:0),this.maxValue_=+(b.maxValue?b.maxValue:100)):"list"==this.type&&(this.array_=b.array?b.array:[]); -b.isClone||(this.visible_=b.visible||"boolean"==typeof b.visible?b.visible:!0,this.x_=b.x?b.x:null,this.y_=b.y?b.y:null,"list"==this.type&&(this.width_=b.width?b.width:100,this.height_=b.height?b.height:120,this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; +this.hwMonitor.initView()):this.hwMonitor=new Entry.HWMonitor(this.hwModule),Entry.propertyPanel.addMode("hw",this.hwMonitor),b=this.hwModule.monitorTemplate,"both"==b.mode?(b.mode="list",this.hwMonitor.generateListView(),b.mode="general",this.hwMonitor.generateView(),b.mode="both"):"list"==b.mode?this.hwMonitor.generateListView():this.hwMonitor.generateView())))};p.banHW=function(){var b=this.hwInfo,a;for(a in b)Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name,!0)};Entry.BlockModel=function(){Entry.Model(this)};Entry.BlockModel.prototype.schema={id:null,x:0,y:0,type:null,params:{},statements:{},prev:null,next:null,view:null};Entry.BlockRenderModel=function(){Entry.Model(this)};Entry.BlockRenderModel.prototype.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,width:0,height:0,magneting:!1};Entry.BoxModel=function(){Entry.Model(this)};Entry.BoxModel.prototype.schema={id:0,type:Entry.STATIC.BOX_MODEL,x:0,y:0,width:0,height:0};Entry.DragInstance=function(b){Entry.Model(this);this.set(b)};Entry.DragInstance.prototype.schema={type:Entry.STATIC.DRAG_INSTANCE,startX:0,startY:0,offsetX:0,offsetY:0,absX:0,absY:0,prev:null,height:0,mode:0,isNew:!1};Entry.ThreadModel=function(){Entry.Model(this)};Entry.ThreadModel.prototype.schema={id:0,type:Entry.STATIC.THREAD_MODEL,x:0,y:0,width:0,minWidth:0,height:0};Entry.Variable=function(b){Entry.assert("string"==typeof b.name,"Variable name must be given");this.name_=b.name;this.id_=b.id?b.id:Entry.generateHash();this.type=b.variableType?b.variableType:"variable";this.object_=b.object||null;this.isCloud_=b.isCloud||!1;var a=Entry.parseNumber(b.value);this.value_="number"==typeof a?a:b.value?b.value:0;"slide"==this.type?(this.minValue_=Number(b.minValue?b.minValue:0),this.maxValue_=Number(b.maxValue?b.maxValue:100)):"list"==this.type&&(this.array_=b.array? +b.array:[]);b.isClone||(this.visible_=b.visible||"boolean"==typeof b.visible?b.visible:!0,this.x_=b.x?b.x:null,this.y_=b.y?b.y:null,"list"==this.type&&(this.width_=b.width?b.width:100,this.height_=b.height?b.height:120,this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; Entry.Variable.prototype.generateView=function(b){var a=this.type;if("variable"==a||"timer"==a||"answer"==a)this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.wrapper_=new createjs.Shape,this.view_.addChild(this.wrapper_),this.textView_=new createjs.Text("asdf",this.FONT,"#000000"),this.textView_.textBaseline="alphabetic",this.textView_.x=4,this.textView_.y=1,this.view_.addChild(this.textView_),this.valueView_=new createjs.Text("asdf", "10pt NanumGothic","#ffffff"),this.valueView_.textBaseline="alphabetic",a=Entry.variableContainer.variables_.length,this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(a/11)),this.setY(24*b+20-135-264*Math.floor(a/11))),this.view_.visible=this.visible_,this.view_.addChild(this.valueView_),this.view_.on("mousedown",function(a){"workspace"==Entry.type&&(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)},this.cursor="move")}),this.view_.on("pressmove", function(a){"workspace"==Entry.type&&(this.variable.setX(.75*a.stageX-240+this.offset.x),this.variable.setY(.75*a.stageY-135+this.offset.y),this.variable.updateView())});else if("slide"==a){var c=this;this.view_=new createjs.Container;this.rect_=new createjs.Shape;this.view_.addChild(this.rect_);this.view_.variable=this;this.wrapper_=new createjs.Shape;this.view_.addChild(this.wrapper_);this.textView_=new createjs.Text("name",this.FONT,"#000000");this.textView_.textBaseline="alphabetic";this.textView_.x= @@ -1253,15 +1226,15 @@ this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredW this.scrollPosition+b&&ac.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(a-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type?(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+ 14,this.valueView_.y=1,this.isNumber()?parseInt(this.getValue(),10)==this.getValue()?this.valueView_.text=this.getValue():this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#E457DC").ss(1,2,0).s("#E457DC").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+ 15,14,7,7,7,7)):(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#ffbb14").ss(1, -2,0).s("orange").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7))};Entry.Variable.prototype.getName=function(){return this.name_};Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this.updateView()};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?+this.value_:this.value_}; -Entry.Variable.prototype.isNumber=function(){return isNaN(this.value_)?!1:!0};Entry.Variable.prototype.setValue=function(b){"slide"!=this.type?this.value_=b:(b=+b,this.value_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this.updateView()};Entry.Variable.prototype.isVisible=function(){return this.visible_}; +2,0).s("orange").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7))};Entry.Variable.prototype.getName=function(){return this.name_};Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this.updateView()};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?Number(this.value_):this.value_}; +Entry.Variable.prototype.isNumber=function(){return isNaN(this.value_)?!1:!0};Entry.Variable.prototype.setValue=function(b){"slide"!=this.type?this.value_=b:(b=Number(b),this.value_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this.updateView()};Entry.Variable.prototype.isVisible=function(){return this.visible_}; Entry.Variable.prototype.setVisible=function(b){Entry.assert("boolean"==typeof b,"Variable visible state must be boolean");(this.visible_=this.view_.visible=b)&&this.updateView()};Entry.Variable.prototype.setX=function(b){this.x_=b;this.updateView()};Entry.Variable.prototype.getX=function(){return this.x_};Entry.Variable.prototype.setY=function(b){this.y_=b;this.updateView()};Entry.Variable.prototype.getY=function(){return this.y_}; Entry.Variable.prototype.setWidth=function(b){this.width_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getWidth=function(){return this.width_};Entry.Variable.prototype.isInList=function(b,a){this.getX();this.getY()};Entry.Variable.prototype.setHeight=function(b){this.height_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getHeight=function(){return this.height_};Entry.Variable.prototype.takeSnapshot=function(){this.snapshot_=this.toJSON()}; Entry.Variable.prototype.loadSnapshot=function(){this.snapshot_&&!this.isCloud_&&this.syncModel_(this.snapshot_)};Entry.Variable.prototype.syncModel_=function(b){this.setX(b.x);this.setY(b.y);this.id_=b.id;this.setVisible(b.visible);this.setValue(b.value);this.setName(b.name);this.isCloud_=b.isCloud;"list"==this.type&&(this.setWidth(b.width),this.setHeight(b.height),this.array_=b.array)}; Entry.Variable.prototype.toJSON=function(){var b={};b.name=this.name_;b.id=this.id_;b.visible=this.visible_;b.value=this.value_;b.variableType=this.type;"list"==this.type?(b.width=this.getWidth(),b.height=this.getHeight(),b.array=JSON.parse(JSON.stringify(this.array_))):"slide"==this.type&&(b.minValue=this.minValue_,b.maxValue=this.maxValue_);b.isCloud=this.isCloud_;b.object=this.object_;b.x=this.x_;b.y=this.y_;return b};Entry.Variable.prototype.remove=function(){Entry.stage.removeVariable(this)}; Entry.Variable.prototype.clone=function(){var b=this.toJSON();b.isClone=!0;return b=new Entry.Variable(b)};Entry.Variable.prototype.getType=function(){return this.type};Entry.Variable.prototype.setType=function(b){this.type=b};Entry.Variable.prototype.getSlidePosition=function(b){var a=this.minValue_;return Math.abs(this.value_-a)/Math.abs(this.maxValue_-a)*b+10}; Entry.Variable.prototype.setSlideCommandX=function(b){var a=this.valueSetter_.graphics.command;b=Math.max("undefined"==typeof b?10:b,10);b=Math.min(this.maxWidth+10,b);a.x=b;this.updateSlideValueByView()}; -Entry.Variable.prototype.updateSlideValueByView=function(){var b=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>b&&(b=0);1c&&(b=this.maxValue_);this.isFloatPoint()||(b=Math.round(b));this.setValue(b)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; +Entry.Variable.prototype.updateSlideValueByView=function(){var b=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>b&&(b=0);1c&&(b=this.maxValue_);this.isFloatPoint()||(b=Math.round(b));this.setValue(b)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; Entry.Variable.prototype.setMinValue=function(b){this.minValue_=b;this.value_b&&(this.value_=b);this.updateView();this.isMaxFloat=Entry.isFloat(this.maxValue_)};Entry.Variable.prototype.isFloatPoint=function(){return this.isMaxFloat||this.isMinFloat};Entry.VariableContainer=function(){this.variables_=[];this.messages_=[];this.lists_=[];this.functions_={};this.viewMode_="all";this.selected=null;this.variableAddPanel={isOpen:!1,info:{object:null,isCloud:!1}};this.listAddPanel={isOpen:!1,info:{object:null,isCloud:!1}};this.selectedVariable=null;this._variableRefs=[];this._messageRefs=[];this._functionRefs=[]}; Entry.VariableContainer.prototype.createDom=function(b){var a=this;this.view_=b;var c=Entry.createElement("table");c.addClass("entryVariableSelectorWorkspace");this.view_.appendChild(c);var d=Entry.createElement("tr");c.appendChild(d);var e=this.createSelectButton("all");e.setAttribute("rowspan","2");e.addClass("selected","allButton");d.appendChild(e);d.appendChild(this.createSelectButton("variable",Entry.variableEnable));d.appendChild(this.createSelectButton("message",Entry.messageEnable));d=Entry.createElement("tr"); d.appendChild(this.createSelectButton("list",Entry.listEnable));d.appendChild(this.createSelectButton("func",Entry.functionEnable));c.appendChild(d);c=Entry.createElement("ul");c.addClass("entryVariableListWorkspace");this.view_.appendChild(c);this.listView_=c;c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.variable_add;var f=this;this.variableAddButton_=c;c.bindOnClick(function(b){b=f.variableAddPanel; @@ -1359,7 +1332,7 @@ c=Entry.createElement("div");c.addClass("entryListSettingLengthControllerWorkspa d=Entry.createElement("span");d.addClass("entryListSettingPlusWorkspace");d.bindOnClick(function(a){b.selectedList.array_.push({data:0});b.updateListSettingView(b.selectedList)});c.appendChild(d);c=Entry.createElement("div");a.seperator=c;a.appendChild(c);c.addClass("entryListSettingSeperatorWorkspace");c=Entry.createElement("div");c.addClass("entryListSettingListValuesWorkspace");a.listValues=c;a.appendChild(c)}; Entry.VariableContainer.prototype.updateListSettingView=function(b){var a=this;b=b||this.selectedList;var c=this.listSettingView,d=c.listValues,e=c.visibleCheck,f=c.lengthInput,g=c.seperator;e.removeClass("entryListSettingCheckedWorkspace");b.isVisible()&&e.addClass("entryListSettingCheckedWorkspace");f.value=b.array_.length;for(b.listElement.appendChild(c);d.firstChild;)d.removeChild(d.firstChild);var h=b.array_;0===h.length?g.addClass("entryRemove"):g.removeClass("entryRemove");for(e=0;eb&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; +f.addClass("entryListSettingValueRemoveWorkspace");e.appendChild(f);d.appendChild(e)})(e);b.updateView();c.removeClass("entryRemove")};Entry.VariableContainer.prototype.setListLength=function(b){b=Number(b);var a=this.selectedList.array_;if(!isNaN(b)){var c=a.length;if(cb&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; Entry.VariableContainer.prototype.updateSelectedVariable=function(b,a){b?"variable"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"slide"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"list"==b.type&&(this.selectedList=b,this.updateListSettingView(b)):(this.selectedVariable=null,"variable"==(a||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; Entry.VariableContainer.prototype.removeLocalVariables=function(b){var a=[],c=this;this.mapVariable(function(b,c){b.object_&&b.object_==c&&a.push(b)},b);a.map(function(a){c.removeVariable(a)})}; Entry.VariableContainer.prototype.updateCloudVariables=function(){var b=Entry.projectId;if(Entry.cloudSavable&&b){var a=Entry.variableContainer,b=a.variables_.filter(function(a){return a.isCloud_}),b=b.map(function(a){return a.toJSON()}),a=a.lists_.filter(function(a){return a.isCloud_}),a=a.map(function(a){return a.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:b,lists:a}}).done(function(){})}}; @@ -1428,7 +1401,7 @@ VALUE:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var c=Ent albert_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_stop",id:"4adb"},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}},albert_set_pad_size_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", size:12}],events:{},def:{params:[{type:"text",params:["108"]},{type:"text",params:["76"]},null],type:"albert_set_pad_size_to",id:"5mhg"},paramsKeyMap:{WIDTH:0,HEIGHT:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;c.padWidth=a.getNumberValue("WIDTH");c.padHeight=a.getNumberValue("HEIGHT");return a.callReturn()}},albert_set_eye_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right, "RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.ALBERT_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.ALBERT_color_magenta,"5"],[Lang.General.white,"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"albert_set_eye_to"},paramsKeyMap:{DIRECTION:0,COLOR:1},"class":"albert_led",isNotFor:["albert"], -func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}},albert_clear_eye:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_clear_eye"}, +func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}},albert_clear_eye:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_clear_eye"}, paramsKeyMap:{DIRECTION:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftEye=0:("RIGHT"!=d&&(c.leftEye=0),c.rightEye=0);return a.callReturn()}},albert_body_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ucf1c\uae30","ON"],["\ub044\uae30","OFF"]],value:"ON",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_body_led"}, paramsKeyMap:{STATE:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?c.bodyLed=1:c.bodyLed=0;return a.callReturn()}},albert_front_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ucf1c\uae30","ON"],["\ub044\uae30","OFF"]],value:"ON",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_front_led"},paramsKeyMap:{STATE:0},"class":"albert_led", isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?c.frontLed=1:c.frontLed=0;return a.callReturn()}},albert_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_beep"},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue= @@ -1445,19 +1418,19 @@ statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12 img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return c.leftWheel=-30,c.rightWheel=-30,a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a}},albert_turn_around:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd","LEFT"], ["\uc624\ub978\ucabd","RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0},func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return c.leftWheel=a.leftValue,c.rightWheel=a.rightValue,a;delete a.timeFlag;delete a.isStart;delete a.leftValue;delete a.rightValue;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}c="LEFT"==a.getField("DIRECTION",a); a.leftValue=c?-30:30;a.rightValue=c?30:-30;a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a}},albert_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd","LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[["\ube68\uac04\uc0c9","4"],["\ub178\ub780\uc0c9","6"],["\ucd08\ub85d\uc0c9","2"],["\ud558\ub298\uc0c9","3"],["\ud30c\ub780\uc0c9","1"],["\ubcf4\ub77c\uc0c9", -"5"],["\ud558\uc580\uc0c9","7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{DIRECTION:0,COLOR:1},func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}},albert_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd", +"5"],["\ud558\uc580\uc0c9","7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{DIRECTION:0,COLOR:1},func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}},albert_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd", "LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0},func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"FRONT"==d?(c.leftEye=0,c.rightEye=0):"LEFT"==d?c.leftEye=0:c.rightEye=0;return a.callReturn()}},albert_change_wheels_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd", "LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=a.getField("DIRECTION"),f=a.getNumberValue("VALUE");"LEFT"==e?c.leftWheel=void 0!=c.leftWheel?c.leftWheel+f:d.leftWheel+f:("RIGHT"!=e&&(c.leftWheel=void 0!=c.leftWheel?c.leftWheel+f: d.leftWheel+f),c.rightWheel=void 0!=c.rightWheel?c.rightWheel+f:d.rightWheel+f);return a.callReturn()}},albert_set_wheels_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd","LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){var c= Entry.hw.sendQueue,d=a.getField("DIRECTION"),e=a.getNumberValue("VALUE");"LEFT"==d?c.leftWheel=e:("RIGHT"!=d&&(c.leftWheel=e),c.rightWheel=e);return a.callReturn()}},arduino_text:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NAME:0},func:function(b,a){return a.getStringField("NAME")}},arduino_send:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]}, paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return a.callReturn()}},arduino_get_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/", -!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return+d.responseText}},arduino_get_string:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return d.responseText}},arduino_get_sensor_number:{color:"#00979D", +!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return Number(d.responseText)}},arduino_get_string:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return d.responseText}},arduino_get_sensor_number:{color:"#00979D", skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","A0"],["1","A1"],["2","A2"],["3","A3"],["4","A4"],["5","A5"]],value:"A0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},arduino_get_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"], ["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},arduino_get_pwm_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]],value:"3",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{}, def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},arduino_get_number_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_sensor_number"}],type:"arduino_get_number_sensor_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){var c=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(c[1])}}, arduino_get_digital_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_port_number"}],type:"arduino_get_digital_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(c)}},arduino_toggle_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Dropdown",options:[[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_port_number"},null,null],type:"arduino_toggle_led"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE"),d="on"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(c, -d);return a.callReturn()}},arduino_toggle_pwm:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"arduino_toggle_pwm"},paramsKeyMap:{PORT:0,VALUE:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("PORT"),d=a.getNumberValue("VALUE"), +{type:"Dropdown",options:[[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_port_number"},null,null],type:"arduino_toggle_led"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE"),d=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(c,"on"==d?255: +0);return a.callReturn()}},arduino_toggle_pwm:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"arduino_toggle_pwm"},paramsKeyMap:{PORT:0,VALUE:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("PORT"),d=a.getNumberValue("VALUE"), d=Math.round(d),d=Math.max(d,0),d=Math.min(d,255);Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}},arduino_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number", params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"arduino_convert_scale"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"arduino",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f, c);return Math.round(c)}},sensorBoard_get_named_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["\uc18c\ub9ac","0"],["\ube5b \uac10\uc9c0","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc628\ub3c4","3"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"sensorBoard_get_named_sensor_value"},paramsKeyMap:{PORT:0},"class":"sensorBoard",isNotFor:["sensorBoard"],func:function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT", @@ -1511,17 +1484,17 @@ color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"},"class": "ROTATION"],[Lang.Blocks.CALC_direction_value,"DIRECTION"]],value:"ROTATION",fontSize:11}],events:{},def:{params:[null],type:"get_rotation_direction"},paramsKeyMap:{OPERATOR:0},"class":"calc",isNotFor:[],func:function(b,a){return"DIRECTION"==a.getField("OPERATOR",a).toUpperCase()?parseFloat(b.getDirection().toFixed(1)):parseFloat(b.getRotation().toFixed(1))}},distance_something:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_distance_something_1, color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_distance_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"distance_something"},paramsKeyMap:{VALUE:1},"class":"calc_distance",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a);if("mouse"==c)return c=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-c.x,2)+Math.pow(b.getY()-c.y,2));c=Entry.container.getEntity(c); return Math.sqrt(Math.pow(b.getX()-c.getX(),2)+Math.pow(b.getY()-c.getY(),2))}},coordinate_mouse:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_1,color:"#3D3D3D"},{type:"Dropdown",options:[["x","x"],["y","y"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"coordinate_mouse"},paramsKeyMap:{VALUE:1}, -"class":"calc",isNotFor:[],func:function(b,a){return"x"===a.getField("VALUE",a)?+Entry.stage.mouseCoordinate.x:+Entry.stage.mouseCoordinate.y}},coordinate_object:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_object_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithSelf",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_object_2,color:"#3D3D3D"},{type:"Dropdown", -options:[[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"],[Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,null,null,null],type:"coordinate_object"},paramsKeyMap:{VALUE:1, -COORDINATE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return+c.getSize().toFixed(1);case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}},calc_basic:{color:"#FFD974", -skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],value:"PLUS",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},defs:[{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MINUS",{type:"number", -params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MULTI",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"DIVIDE",{type:"number",params:["10"]}],type:"calc_basic"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e}},calc_plus:{color:"#FFD974", -skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"+",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d}},calc_minus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"-",color:"#3D3D3D"},{type:"Block",accept:"string"}], -events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c-d}},calc_times:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"x",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND", -a);return c*d}},calc_divide:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c/d}},calc_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/", -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_mod_3,color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_mod"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c%d}},calc_share:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:"\uc758 \ubaab",color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_share"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return Math.floor(c/d)}},calc_operation:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text", -text:Lang.Blocks.CALC_calc_operation_of_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_calc_operation_square,"square"],[Lang.Blocks.CALC_calc_operation_root,"root"],[Lang.Blocks.CALC_calc_operation_sin,"sin"],[Lang.Blocks.CALC_calc_operation_cos,"cos"],[Lang.Blocks.CALC_calc_operation_tan,"tan"],[Lang.Blocks.CALC_calc_operation_asin,"asin_radian"],[Lang.Blocks.CALC_calc_operation_acos, +"class":"calc",isNotFor:[],func:function(b,a){return"x"===a.getField("VALUE",a)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}},coordinate_object:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_object_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithSelf",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_object_2,color:"#3D3D3D"}, +{type:"Dropdown",options:[[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"],[Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,null,null,null],type:"coordinate_object"}, +paramsKeyMap:{VALUE:1,COORDINATE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return Number(c.getSize().toFixed(1));case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}}, +calc_basic:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],value:"PLUS",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},defs:[{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]}, +"MINUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MULTI",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"DIVIDE",{type:"number",params:["10"]}],type:"calc_basic"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e}}, +calc_plus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"+",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d}},calc_minus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"-",color:"#3D3D3D"}, +{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c-d}},calc_times:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"x",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND", +a),d=a.getNumberValue("RIGHTHAND",a);return c*d}},calc_divide:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c/d}},calc_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}, +{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_mod_3,color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_mod"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c%d}},calc_share:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block", +accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:"\uc758 \ubaab",color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_share"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return Math.floor(c/d)}},calc_operation:{color:"#FFD974",skeleton:"basic_string_field",statements:[], +params:[{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_calc_operation_square,"square"],[Lang.Blocks.CALC_calc_operation_root,"root"],[Lang.Blocks.CALC_calc_operation_sin,"sin"],[Lang.Blocks.CALC_calc_operation_cos,"cos"],[Lang.Blocks.CALC_calc_operation_tan,"tan"],[Lang.Blocks.CALC_calc_operation_asin,"asin_radian"],[Lang.Blocks.CALC_calc_operation_acos, "acos_radian"],[Lang.Blocks.CALC_calc_operation_atan,"atan_radian"],[Lang.Blocks.CALC_calc_operation_log,"log"],[Lang.Blocks.CALC_calc_operation_ln,"ln"],[Lang.Blocks.CALC_calc_operation_unnatural,"unnatural"],[Lang.Blocks.CALC_calc_operation_floor,"floor"],[Lang.Blocks.CALC_calc_operation_ceil,"ceil"],[Lang.Blocks.CALC_calc_operation_round,"round"],[Lang.Blocks.CALC_calc_operation_factorial,"factorial"],[Lang.Blocks.CALC_calc_operation_abs,"abs"]],value:"square",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}], events:{},def:{params:[null,{type:"number",params:["10"]},null,null],type:"calc_operation"},paramsKeyMap:{LEFTHAND:1,VALUE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getField("VALUE",a);if(-1<["asin_radian","acos_radian"].indexOf(d)&&(1c))throw Error("x range exceeded");d.indexOf("_")&&(d=d.split("_")[0]);-1<["sin","cos","tan"].indexOf(d)&&(c=Entry.toRadian(c));var e=0;switch(d){case "square":e=c*c;break;case "factorial":e=Entry.factorial(c);break; case "root":e=Math.sqrt(c);break;case "log":e=Math.log(c)/Math.LN10;break;case "ln":e=Math.log(c);break;case "asin":case "acos":case "atan":e=Entry.toDegrees(Math[d](c));break;case "unnatural":e=c-Math.floor(c);0>c&&(e=1-e);break;default:e=Math[d](c)}return Math.round(1E3*e)/1E3}},calc_rand:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_calc_rand_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_2, @@ -1549,7 +1522,7 @@ null,null],type:"quotient_and_mod"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3,OPERATO "START"],[Lang.Blocks.CALC_choose_project_timer_action_sub_2,"STOP"],[Lang.Blocks.CALC_choose_project_timer_action_sub_3,"RESET"]],value:"START",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_2,color:"#3D3D3D"},{type:"Indicator",img:"block_icon/calc_01.png",size:12}],events:{viewAdd:[function(){Entry.engine&&Entry.engine.showProjectTimer()}],dataDestroy:[function(b){Entry.engine&&Entry.engine.hideProjectTimer(b)}]},def:{params:[null, "START",null,null],type:"choose_project_timer_action"},paramsKeyMap:{ACTION:1},"class":"calc_timer",isNotFor:[],func:function(b,a){var c=a.getField("ACTION"),d=Entry.engine,e=d.projectTimer;"START"==c?e.isInit?e.isInit&&e.isPaused&&(e.pauseStart&&(e.pausedTime+=(new Date).getTime()-e.pauseStart),delete e.pauseStart,e.isPaused=!1):d.startProjectTimer():"STOP"==c?e.isInit&&!e.isPaused&&(e.isPaused=!0,e.pauseStart=(new Date).getTime()):"RESET"==c&&e.isInit&&(e.setValue(0),e.start=(new Date).getTime(), e.pausedTime=0,delete e.pauseStart);return a.callReturn()}},wait_second:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null],type:"wait_second"},paramsKeyMap:{SECOND:0},"class":"delay",isNotFor:[],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0; -a.timeFlag=1;var c=a.getNumberValue("SECOND",a),c=60/(Entry.FPS||60)*c*1E3;setTimeout(function(){a.timeFlag=0},c);return a}},repeat_basic:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"repeat_basic"},paramsKeyMap:{VALUE:0},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c;if(!a.isLooped){a.isLooped= +a.timeFlag=1;var c=a.getNumberValue("SECOND",a);setTimeout(function(){a.timeFlag=0},60/(Entry.FPS||60)*c*1E3);return a}},repeat_basic:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"repeat_basic"},paramsKeyMap:{VALUE:0},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c;if(!a.isLooped){a.isLooped= !0;c=a.getNumberValue("VALUE",a);if(0>c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(c)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[], func:function(b,a){a.isLooped=!0;return a.getStatement("DO")}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(b,a){return this.executor.breakLoop()}},wait_until_true:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"}, null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(b,a){return a.getBooleanValue("BOOL",a)?a.callReturn():a}},_if:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(b,a){return a.isCondition?(delete a.isCondition, @@ -1589,11 +1562,11 @@ e=a.getNumberValue("VALUE");"LEFT"==d?c.leftWheel=e:("RIGHT"!=d&&(c.leftWheel=e) {type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_follow_line_using"},paramsKeyMap:{COLOR:0,DIRECTION:1},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("COLOR"),e=a.getField("DIRECTION"),f=1;"RIGHT"==e?f=2:"BOTH"==e&&(f=3);"WHITE"==d&&(f+=7);c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,f);return a.callReturn()}},hamster_follow_line_until:{color:"#00979D",skeleton:"basic", statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_color_black,"BLACK"],[Lang.General.white,"WHITE"]],value:"BLACK",fontSize:11},{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.Blocks.HAMSTER_front,"FRONT"],[Lang.Blocks.HAMSTER_rear,"REAR"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_follow_line_until"},paramsKeyMap:{COLOR:0,DIRECTION:1},"class":"hamster_wheel", isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=a.getField("COLOR"),f=a.getField("DIRECTION"),g=4;"RIGHT"==f?g=5:"FRONT"==f?g=6:"REAR"==f&&(g=7);"WHITE"==e&&(g+=7);if(a.isStart){if(e=Entry.Hamster,d.lineTracerStateId!=e.lineTracerStateId&&(e.lineTracerStateId=d.lineTracerStateId,64==d.lineTracerState))return delete a.isStart,Entry.engine.isContinue=!1,e.setLineTracerMode(c,0),a.callReturn()}else a.isStart=!0,c.leftWheel=0,c.rightWheel=0,Entry.Hamster.setLineTracerMode(c, -g);return a}},hamster_set_following_speed_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]],value:"1",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["5",null],type:"hamster_set_following_speed_to"},paramsKeyMap:{SPEED:0},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){Entry.hw.sendQueue.lineTracerSpeed=+a.getField("SPEED", -a);return a.callReturn()}},hamster_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_stop"},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}},hamster_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left, +g);return a}},hamster_set_following_speed_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]],value:"1",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["5",null],type:"hamster_set_following_speed_to"},paramsKeyMap:{SPEED:0},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){Entry.hw.sendQueue.lineTracerSpeed=Number(a.getField("SPEED", +a));return a.callReturn()}},hamster_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_stop"},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}},hamster_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left, "LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.HAMSTER_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_set_led_to"},paramsKeyMap:{DIRECTION:0,COLOR:1}, -"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}},hamster_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{}, -def:{params:[null,null],type:"hamster_clear_led"},paramsKeyMap:{DIRECTION:0},"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()}},hamster_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_beep"},"class":"hamster_buzzer",isNotFor:["hamster"], +"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}},hamster_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], +events:{},def:{params:[null,null],type:"hamster_clear_led"},paramsKeyMap:{DIRECTION:0},"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()}},hamster_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_beep"},"class":"hamster_buzzer",isNotFor:["hamster"], func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;c.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;c.buzzer=440;c.note=0;var d=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(d)},200);Entry.Hamster.timeouts.push(d);return a}},hamster_change_buzzer_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", size:12}],events:{},def:{params:[{type:"text",params:["10"]},null],type:"hamster_change_buzzer_by"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getNumberValue("VALUE");c.buzzer=void 0!=c.buzzer?c.buzzer+d:d;c.note=0;return a.callReturn()}},hamster_set_buzzer_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text", params:["1000"]},null],type:"hamster_set_buzzer_to"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.buzzer=a.getNumberValue("VALUE");c.note=0;return a.callReturn()}},hamster_clear_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_clear_buzzer"},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c= @@ -1604,16 +1577,16 @@ hamster_rest_for:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:" 1;var d=a.getNumberValue("VALUE"),d=6E4*d/Entry.Hamster.tempo;c.buzzer=0;c.note=0;var e=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(e)},d);Entry.Hamster.timeouts.push(e);return a}},hamster_change_tempo_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["20"]},null],type:"hamster_change_tempo_by"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer", isNotFor:["hamster"],func:function(b,a){Entry.Hamster.tempo+=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}},hamster_set_tempo_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"hamster_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){Entry.Hamster.tempo= a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}},hamster_set_port_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output,"8"],[Lang.Blocks.HAMSTER_pwm_output,"9"], -[Lang.Blocks.HAMSTER_digital_output,"10"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_set_port_to"},paramsKeyMap:{PORT:0,MODE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=+a.getField("MODE",a);"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}},hamster_change_output_by:{color:"#00979D",skeleton:"basic",statements:[], -params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["10"]},null],type:"hamster_change_output_by"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE"); -"A"==d?c.outputA=void 0!=c.outputA?c.outputA+e:e:("B"!=d&&(c.outputA=void 0!=c.outputA?c.outputA+e:e),c.outputB=void 0!=c.outputB?c.outputB+e:e);return a.callReturn()}},hamster_set_output_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null, -{type:"text",params:["100"]},null],type:"hamster_set_output_to"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=e:("B"!=d&&(c.outputA=e),c.outputB=e);return a.callReturn()}},is_clicked:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_is_clicked,color:"#3D3D3D"}],events:{},def:{params:[null],type:"is_clicked"}, -"class":"boolean_input",isNotFor:[],func:function(b,a){return Entry.stage.isClick}},is_press_some_key:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Keyboard",value:81},{type:"Text",text:Lang.Blocks.JUDGEMENT_is_press_some_key_2,color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"is_press_some_key"},paramsKeyMap:{VALUE:0},"class":"boolean_input",isNotFor:[],func:function(b,a){var c=+a.getField("VALUE",a);return 0<=Entry.pressedKeys.indexOf(c)}},reach_something:{color:"#AEB8FF", -skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"collision",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_JUDGE},{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"reach_something"},paramsKeyMap:{VALUE:1},"class":"boolean_collision",isNotFor:[],func:function(b,a){if(!b.getVisible())return!1;var c=a.getField("VALUE", -a),d=b.object,e=/wall/.test(c),f=ndgmr.checkPixelCollision;if(e)switch(e=Entry.stage.wall,c){case "wall":if(f(d,e.up,.2,!0)||f(d,e.down,.2,!0)||f(d,e.left,.2,!0)||f(d,e.right,.2,!0))return!0;break;case "wall_up":if(f(d,e.up,.2,!0))return!0;break;case "wall_down":if(f(d,e.down,.2,!0))return!0;break;case "wall_right":if(f(d,e.right,.2,!0))return!0;break;case "wall_left":if(f(d,e.left,.2,!0))return!0}else{if("mouse"==c)return f=Entry.stage.canvas,f=d.globalToLocal(f.mouseX,f.mouseY),d.hitTest(f.x,f.y); -c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==b.type){f=c.object.getTransformedBounds();d=d.getTransformedBounds();if(Entry.checkCollisionRect(d,f))return!0;for(var c=c.parent.clonedEntities,e=0,g=c.length;e","BIGGER"]],value:"EQUAL",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"boolean_comparison"},paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a); -return"EQUAL"==c?d==e:"BIGGER"==c?d>e:d","BIGGER"]],value:"EQUAL",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"boolean_comparison"},paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND", +a);return"EQUAL"==c?d==e:"BIGGER"==c?d>e:d",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_bigger"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c>d}},boolean_smaller:{color:"#AEB8FF", skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"<",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_smaller"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],value:"EQUAL",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"text",params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},defs:[{params:[{type:"text", params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"LESS",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"LESS_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"}], -paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return+d>+e;case "LESS":return+d<+e;case "GREATER_OR_EQUAL":return+d>=+e;case "LESS_OR_EQUAL":return+d<=+e}}},show:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null], -type:"show"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!0);return a.callReturn()}},hide:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"hide"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!1);return a.callReturn()}},dialog_time:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Dropdown", -options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a),d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart= -!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS}, -{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()}},remove_dialog:{color:"#EC4466",skeleton:"basic", -statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"remove_dialog"},"class":"say",isNotFor:["textBox"],func:function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}},change_to_nth_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"pictures",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_nth_shape"}, -paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null, -null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var c;c="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(c);return a.callReturn()}},set_effect_volume:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11}, -{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness:"blur"!=c&&"opacity"==c&& -(b.effect.alpha+=d/100));b.applyFilter();return a.callReturn()}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect", -isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter();return a.callReturn()}},erase_all_effects:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"erase_all_effects"},"class":"effect", -isNotFor:["textBox"],func:function(b,a){b.resetFilter();return a.callReturn()}},change_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()* +paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return Number(d)>Number(e);case "LESS":return Number(d)=Number(e);case "LESS_OR_EQUAL":return Number(d)<=Number(e)}}},show:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator", +img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"show"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!0);return a.callReturn()}},hide:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"hide"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!1);return a.callReturn()}},dialog_time:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block", +accept:"string"},{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a), +d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]], +value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()}}, +remove_dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"remove_dialog"},"class":"say",isNotFor:["textBox"],func:function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}},change_to_nth_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"pictures",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null, +null],type:"change_to_nth_shape"},paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png", +size:12}],events:{},def:{params:[null,null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var c;c="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(c);return a.callReturn()}},set_effect_volume:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity, +"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness: +"blur"!=c&&"opacity"==c&&(b.effect.alpha+=d/100));b.applyFilter();return a.callReturn()}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0, +VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter();return a.callReturn()}},erase_all_effects:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"erase_all_effects"}, +"class":"effect",isNotFor:["textBox"],func:function(b,a){b.resetFilter();return a.callReturn()}},change_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()* c);return a.callReturn()}},set_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a)/100,d=b.snapshot_;b.setScaleX(c*d.scaleX);b.setScaleY(c*d.scaleY);return a.callReturn()}},change_scale_size:{color:"#EC4466", skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+c);return a.callReturn()}},set_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png", size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()}},flip_y:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_y"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}},flip_x:{color:"#EC4466", @@ -1655,29 +1628,29 @@ img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",p img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){function c(){var c=a.x-b.getX(),d=a.y-b.getY(),c=c/a.frameCount,d=d/a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1", a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a);1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0}, "class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(b, -a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+ +c);return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3", +a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3", skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic", statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE1",a);b.setX(c);c=a.getNumberValue("VALUE2",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}}, locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block", accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING}, -{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(+c);b.setY(+d);b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[], -params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){function c(){b.setX(b.getX()+a.dX);b.setY(b.getY()+a.dY);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(), --1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);var e=a.getNumberValue("VALUE2",a),f=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dX=e/a.frameCount;a.dY=f/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png", -size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}},bounce_wall:{color:"#A751E3", -skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE); -f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP):(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=b.collision== -Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()- -2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right, -b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+ -360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png", -size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse", -fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"mouse"==c?(c=Entry.stage.mouseCoordinate.y,d=Entry.stage.mouseCoordinate.x-d,e=c-e):(c=Entry.container.getEntity(c),d=c.getX()-d,e=c.getY()-e);e=0===d&&0===e? -b.getDirection()+b.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-d);return a.callReturn()}},see_angle_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b, -a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+c-d);return a.callReturn()}},rotate_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection()); -return a.callReturn()}},locate_object_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"locate_object_time"},paramsKeyMap:{VALUE:0,TARGET:1},"class":"move_absolute",isNotFor:[],func:function(b,a){if(!a.isStart){var c, -d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=+e.x,e=+e.y):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!= -a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b, -a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3", +{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic", +statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){function c(){b.setX(b.getX()+a.dX);b.setY(b.getY()+a.dY);a.frameCount--;b.brush&&!b.brush.stop&& +b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);var e=a.getNumberValue("VALUE2",a),f=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dX=e/a.frameCount;a.dY=f/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator", +img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}}, +bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&& +(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP):(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270> +d&&90<=d&&(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"== +c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT, +d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()- +2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[], +params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic", +value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"mouse"==c?(c=Entry.stage.mouseCoordinate.y,d=Entry.stage.mouseCoordinate.x-d,e=c-e):(c=Entry.container.getEntity(c),d= +c.getX()-d,e=c.getY()-e);e=0===d&&0===e?b.getDirection()+b.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-d);return a.callReturn()}},see_angle_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle_direction"},paramsKeyMap:{VALUE:0}, +"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+c-d);return a.callReturn()}},rotate_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE", +a);b.setDirection(c+b.getDirection());return a.callReturn()}},locate_object_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"locate_object_time"},paramsKeyMap:{VALUE:0,TARGET:1},"class":"move_absolute",isNotFor:[], +func:function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(), +-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute", +isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3", skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png", size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]}, null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", @@ -1873,7 +1846,7 @@ arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null,null],type:" params:[{type:"Dropdown",options:[["2","2"],["4","4"]],value:"2",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["\uc67c\ucabd","LEFT"],["\uc624\ub978\ucabd","LIGHT"]],value:"LEFT",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null,null],type:"dplay_get_tilt"},paramsKeyMap:{PORT:0,STATUS:1},"class":"dplay_get",isNotFor:["dplay"],func:function(b,a){var c=a.getField("PORT"),d=2;"2"==c?d=2:"4"==c&&(d=4);return"LIGHT"==a.getField("STATUS")?1== Entry.hw.getDigitalPortValue(d)?1:0:0==Entry.hw.getDigitalPortValue(d)?1:0}},dplay_toggle_led:{parent:"arduino_toggle_led",isNotFor:["dplay"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"dplay_toggle_led"},"class":"dplay_set"},dplay_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["dplay"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"dplay_toggle_pwm"},"class":"dplay_set"},dplay_select_led:{color:"#00979D",fontColor:"#FFF",skeleton:"basic", statements:[],template:"\ub514\uc9c0\ud138 %1 LED \uc0c1\ud0dc\ub97c %2 %3",params:[{type:"Dropdown",options:[["7","7"],["8","8"],["12","12"],["13","13"]],value:"7",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["\ucf1c\uae30","ON"],["\ub044\uae30","OFF"]],value:"ON",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"dplay_select_led"},paramsKeyMap:{PORT:0,OPERATOR:1}, -"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){var c=a.getField("PORT"),d=7;"7"==c?d=7:"8"==c?d=8:"12"==c?d=12:"13"==c&&(d=13);c="ON"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(d,c);return a.callReturn()}},dplay_DCmotor:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"%1 DC\ubaa8\ud130 \uc0c1\ud0dc\ub97c %2 %3",params:[{type:"Dropdown",options:[["\uc67c\ucabd","1"],["\uc624\ub978\ucabd","2"],["\uc591\ucabd","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}, +"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){var c=a.getField("PORT"),d=7;"7"==c?d=7:"8"==c?d=8:"12"==c?d=12:"13"==c&&(d=13);c=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(d,"ON"==c?255:0);return a.callReturn()}},dplay_DCmotor:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"%1 DC\ubaa8\ud130 \uc0c1\ud0dc\ub97c %2 %3",params:[{type:"Dropdown",options:[["\uc67c\ucabd","1"],["\uc624\ub978\ucabd","2"],["\uc591\ucabd","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}, {type:"Dropdown",options:[["\uc815\ubc29\ud5a5","FRONT"],["\uc5ed\ubc29\ud5a5","REAR"],["\uc815\uc9c0","OFF"]],value:"FRONT",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"dplay_DCmotor"},paramsKeyMap:{PORT:0,OPERATOR:1},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){var c=a.getField("PORT"),d=0,e=0,f=0,g=0;"1"==c?(d=3,e=5):"2"==c?(d=6,e=11):"3"==c&&(d=3,e=5,f=11,g=6);var c=Entry.dplay.vel_value, h=a.getField("OPERATOR"),k=0,l=0;"FRONT"==h?(k=c,l=0):"REAR"==h?(k=0,l=c):"OFF"==h&&(l=k=0);Entry.hw.setDigitalPortValue(d,l);Entry.hw.setDigitalPortValue(e,k);Entry.hw.setDigitalPortValue(f,l);Entry.hw.setDigitalPortValue(g,k);return a.callReturn()}},dplay_DCmotor_speed:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"%1 DC\ubaa8\ud130 \uc18d\ub3c4\ub97c %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",params:[{type:"Dropdown",options:[["\uc67c\ucabd","1"],["\uc624\ub978\ucabd", "2"],["\uc591\ucabd","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"dplay_DCmotor_speed"},paramsKeyMap:{PORT:0,VALUE:1},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,h=0,k=0,k=a.getField("PORT");"1"==k?(c=3,d=5):"2"==k?(c=11,d=6):"3"==k&&(c=3,d=5,e=11,f=6);k=a.getNumberValue("VALUE", @@ -1916,7 +1889,7 @@ b.getMode())&&Entry.GlobalSvg.addControl(a);else if(g.code&&(b=e.block,d=b.getTh this._boardBlockView;if(a){this.workspace.getBoard();this._boardBlockView=null;var b=Entry.GlobalSvg.left,d=Entry.GlobalSvg.width/2,a=a.getBoard().offset().left;return bthis._bannedClass.indexOf(a)&&this._bannedClass.push(a);this.align(b)};b.unbanClass=function(a,b){var d=this._bannedClass.indexOf(a);-1 Date: Mon, 27 Jun 2016 13:16:30 +0900 Subject: [PATCH 14/31] edit loader --- dist/entry.js | 2 +- dist/entry.min.js | 2 +- src/util/loader.js | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 8e2eabe9e1..2266372fa1 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -11856,7 +11856,7 @@ Entry.Loader.removeQueue = function(b) { this.queueCount || (Entry.dispatchEvent("loadComplete"), this.totalCount = 0); }; Entry.Loader.getLoadedPercent = function() { - return this.queueCount / this.totalCount; + return 0 === this.totalCount ? 1 : this.queueCount / this.totalCount; }; Entry.STATIC = {OBJECT:0, ENTITY:1, SPRITE:2, SOUND:3, VARIABLE:4, FUNCTION:5, SCENE:6, MESSAGE:7, BLOCK_MODEL:8, BLOCK_RENDER_MODEL:9, BOX_MODEL:10, THREAD_MODEL:11, DRAG_INSTANCE:12, BLOCK_STATIC:0, BLOCK_MOVE:1, BLOCK_FOLLOW:2, RETURN:0, CONTINUE:1, BREAK:2, PASS:3}; Entry.Utils = {}; diff --git a/dist/entry.min.js b/dist/entry.min.js index bcef191e01..6744b0ae9c 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1118,7 +1118,7 @@ this.definition.params.push(null),this._addToParamsKeyMap(b)):a.constructor==Blo a);return this};b.setColour=function(a){this.color=a};b.setInputsInline=function(){};b.setOutput=function(a,b){a&&(this.output=b)};b.setPreviousStatement=function(a){this.isPrev=a};b.setNextStatement=function(a){this.isNext=a};b.setEditable=function(a){};b.getFieldCount=function(){this.fieldCount++;return"%"+this.fieldCount};b._addToParamsKeyMap=function(a){a=a?a:"dummy_"+Entry.Utils.generateId();var b=this.paramsKeyMap;b[a]=Object.keys(b).length};b._addToStatementsKeyMap=function(a){a=a?a:"dummy_"+ Entry.Utils.generateId();var b=this.statementsKeyMap;b[a]=Object.keys(b).length}})(Entry.BlockMockup.prototype);Entry.ContextMenu={}; (function(b){b.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});Entry.Utils.disableContextmenu(this.dom);Entry.documentMousedown.attach(this,function(){this.hide()})};b.show=function(a,b){this.dom||this.createDom();if(0!==a.length){var d=this;void 0!==b&&(this._className=b,this.dom.addClass(b));var e=this.dom;e.empty();for(var f=0,g=a.length;fg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return this.queueCount/this.totalCount};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;dg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;d=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; Entry.Utils.colorDarken=function(b,a){function c(a){2!=a.length&&(a="0"+a);return a}var d,e,f;7===b.length?(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),f=parseInt(b.substr(5,2),16)):(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),f=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;d=c(Math.floor(d*a).toString(16));e=c(Math.floor(e*a).toString(16));f=c(Math.floor(f*a).toString(16));return"#"+d+e+f}; Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;var c=Entry.Utils.hexToHsl(b);c.l+=a/100;c.l=Math.min(1,Math.max(0,c.l));return Entry.Utils.hslToHex(c)};Entry.Utils.bound01=function(b,a){var c=b;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(b="100%");c="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));c&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; diff --git a/src/util/loader.js b/src/util/loader.js index 5a03d546ac..e60cf0811e 100644 --- a/src/util/loader.js +++ b/src/util/loader.js @@ -23,5 +23,6 @@ Entry.Loader.removeQueue = function(type) { }; Entry.Loader.getLoadedPercent = function() { - return this.queueCount / this.totalCount; + if (this.totalCount === 0) return 1; + else return this.queueCount / this.totalCount; }; From 89e70f309cdc4a6b54f36936dbd8dbf1644a76eb Mon Sep 17 00:00:00 2001 From: vivid Date: Wed, 6 Jul 2016 15:36:06 +0900 Subject: [PATCH 15/31] container bug fix --- dist/entry.js | 1 - dist/entry.min.js | 632 ++++++++++++++++++++++------------------------ src/container.js | 2 - 3 files changed, 295 insertions(+), 340 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index f016129ca3..eab5f54d41 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -6445,7 +6445,6 @@ Entry.Container.prototype.moveElementByBlock = function(b, a) { this.updateListView(); }; Entry.Container.prototype.getDropdownList = function(b) { - Entry.playground && Entry.playground.object || (b = null); var a = []; switch(b) { case "sprites": diff --git a/dist/entry.min.js b/dist/entry.min.js index 570d2bc192..a1a5f3f657 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -701,12 +701,12 @@ Entry.Container.prototype.getObject=function(b){!b&&Entry.playground&&Entry.play Entry.Container.prototype.getVariable=function(b){for(var a=0;a>>>>>> master Entry.EntryObject.prototype.initEntity=function(b){var a={};a.x=a.y=0;a.rotation=0;a.direction=90;if("sprite"==this.objectType){var c=b.sprite.pictures[0].dimension;a.regX=c.width/2;a.regY=c.height/2;a.scaleX=a.scaleY="background"==b.sprite.category.main?Math.max(270/c.height,480/c.width):"new"==b.sprite.category.main?1:200/(c.width+c.height);a.width=c.width;a.height=c.height}else if("textBox"==this.objectType)if(a.regX=25,a.regY=12,a.scaleX=a.scaleY=1.5,a.width=50,a.height=24,a.text=b.text,b.options){if(b= b.options,c="",b.bold&&(c+="bold "),b.italic&&(c+="italic "),a.underline=b.underline,a.strike=b.strike,a.font=c+"20px "+b.font.family,a.colour=b.colour,a.bgColor=b.background,a.lineBreak=b.lineBreak)a.width=256,a.height=.5625*a.width,a.regX=a.width/2,a.regY=a.height/2}else a.underline=!1,a.strike=!1,a.font="20px Nanum Gothic",a.colour="#000000",a.bgColor="#ffffff";return a}; Entry.EntryObject.prototype.updateThumbnailView=function(){if("sprite"==this.objectType)if(this.entity.picture.fileurl)this.thumbnailView_.style.backgroundImage='url("'+this.entity.picture.fileurl+'")';else{var b=this.entity.picture.filename;this.thumbnailView_.style.backgroundImage='url("'+Entry.defaultPath+"/uploads/"+b.substring(0,2)+"/"+b.substring(2,4)+"/thumb/"+b+'.png")'}else"textBox"==this.objectType&&(this.thumbnailView_.style.backgroundImage="url("+(Entry.mediaFilePath+"/text_icon.png")+ @@ -1207,11 +1173,7 @@ Entry.Func.setupMenuCode=function(){var b=Entry.playground.mainWorkspace;b&&(b=b Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.menuCode||this.setupMenuCode();var b=Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length;2>>>>>> master Entry.Func.generateBlock=function(b){b=Entry.block["func_"+b.id];var a={template:b.template,params:b.params},c=/(%\d)/mi,d=b.template.split(c),e="",f=0,g=0,h;for(h in d){var k=d[h];c.test(k)?(k=Number(k.split("%")[1])-1,k=b.params[k],"Indicator"!==k.type&&("boolean"===k.accept?(e+=Lang.template.function_param_boolean+(f?f:""),f++):(e+=Lang.template.function_param_string+(g?g:""),g++))):e+=k}return{block:a,description:e}}; Entry.Func.prototype.generateBlock=function(b){b=Entry.Func.generateBlock(this);this.block=b.block;this.description=b.description}; Entry.Func.generateWsBlock=function(b){this.unbindFuncChangeEvent();b=b?b:this.targetFunc;for(var a=b.content.getEventMap("funcDef")[0].params[0],c=0,d=0,e=[],f="",g=b.hashMap,h=b.paramMap;a;){var k=a.params[0];switch(a.type){case "function_field_label":f=f+" "+k;break;case "function_field_boolean":Entry.Mutator.mutate(k.type,{template:Lang.Blocks.FUNCTION_logical_variable+" "+(c?c:"")});g[k.type]=!1;h[k.type]=c+d;c++;e.push({type:"Block",accept:"boolean"});f+=" %"+(c+d);break;case "function_field_string":Entry.Mutator.mutate(k.type, @@ -1238,11 +1200,7 @@ JSON.parse(a.data);b.checkDevice(a);b.updatePortData(a)}.bind(this),a.onclose=fu Entry.dispatchEvent("hwChanged")}}catch(d){}};p.retryConnect=function(){this.connectTrial=0;this.initSocket()};p.initHardware=function(b){this.socket=b;this.connectTrial=0;this.connected=!0;Entry.dispatchEvent("hwChanged");Entry.playground&&Entry.playground.object&&Entry.playground.setMenu(Entry.playground.object.objectType)};p.setDigitalPortValue=function(b,a){this.sendQueue[b]=a;this.removePortReadable(b)};p.getAnalogPortValue=function(b){return this.connected?this.portData["a"+b]:0}; p.getDigitalPortValue=function(b){if(!this.connected)return 0;this.setPortReadable(b);return void 0!==this.portData[b]?this.portData[b]:0};p.setPortReadable=function(b){this.sendQueue.readablePorts||(this.sendQueue.readablePorts=[]);var a=!1,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=!0;break}a||this.sendQueue.readablePorts.push(b)}; p.removePortReadable=function(b){if(this.sendQueue.readablePorts||Array.isArray(this.sendQueue.readablePorts)){var a,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=Number(c);break}this.sendQueue.readablePorts=void 0!=a?this.sendQueue.readablePorts.slice(0,a).concat(this.sendQueue.readablePorts.slice(a+1,this.sendQueue.readablePorts.length)):[]}};p.update=function(){this.socket&&1==this.socket.readyState&&this.socket.send(JSON.stringify(this.sendQueue))}; -<<<<<<< HEAD -p.updatePortData=function(b){this.portData=b;this.hwMonitor&&this.hwMonitor.update()};p.closeConnection=function(){this.socket&&this.socket.close()};p.downloadConnector=function(){window.open("http://download.play-entry.org/apps/Entry_HW_1.5.5_Setup.exe","_blank").focus()};p.downloadSource=function(){window.open("http://play-entry.com/down/board.ino","_blank").focus()};p.setZero=function(){Entry.hw.hwModule&&Entry.hw.hwModule.setZero()}; -======= p.updatePortData=function(b){this.portData=b;this.hwMonitor&&this.hwMonitor.update()};p.closeConnection=function(){this.socket&&this.socket.close()};p.downloadConnector=function(){window.open("http://download.play-entry.org/apps/Entry_HW_1.5.6_Setup.exe","_blank").focus()};p.downloadSource=function(){window.open("http://play-entry.com/down/board.ino","_blank").focus()};p.setZero=function(){Entry.hw.hwModule&&Entry.hw.hwModule.setZero()}; ->>>>>>> master p.checkDevice=function(b){void 0!==b.company&&(b=""+b.company+b.model,b!=this.selectedDevice&&(this.selectedDevice=b,this.hwModule=this.hwInfo[b],Entry.dispatchEvent("hwChanged"),Entry.toast.success("\ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 \uc131\uacf5","\ud558\ub4dc\uc6e8\uc5b4 \uc544\uc774\ucf58\uc744 \ub354\ube14\ud074\ub9ad\ud558\uba74, \uc13c\uc11c\uac12\ub9cc \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.",!0),this.hwModule.monitorTemplate&&(this.hwMonitor?(this.hwMonitor._hwModule=this.hwModule, this.hwMonitor.initView()):this.hwMonitor=new Entry.HWMonitor(this.hwModule),Entry.propertyPanel.addMode("hw",this.hwMonitor),b=this.hwModule.monitorTemplate,"both"==b.mode?(b.mode="list",this.hwMonitor.generateListView(),b.mode="general",this.hwMonitor.generateView(),b.mode="both"):"list"==b.mode?this.hwMonitor.generateListView():this.hwMonitor.generateView())))};p.banHW=function(){var b=this.hwInfo,a;for(a in b)Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name,!0)};Entry.BlockModel=function(){Entry.Model(this)};Entry.BlockModel.prototype.schema={id:null,x:0,y:0,type:null,params:{},statements:{},prev:null,next:null,view:null};Entry.BlockRenderModel=function(){Entry.Model(this)};Entry.BlockRenderModel.prototype.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,width:0,height:0,magneting:!1};Entry.BoxModel=function(){Entry.Model(this)};Entry.BoxModel.prototype.schema={id:0,type:Entry.STATIC.BOX_MODEL,x:0,y:0,width:0,height:0};Entry.DragInstance=function(b){Entry.Model(this);this.set(b)};Entry.DragInstance.prototype.schema={type:Entry.STATIC.DRAG_INSTANCE,startX:0,startY:0,offsetX:0,offsetY:0,absX:0,absY:0,prev:null,height:0,mode:0,isNew:!1};Entry.ThreadModel=function(){Entry.Model(this)};Entry.ThreadModel.prototype.schema={id:0,type:Entry.STATIC.THREAD_MODEL,x:0,y:0,width:0,minWidth:0,height:0};Entry.Variable=function(b){Entry.assert("string"==typeof b.name,"Variable name must be given");this.name_=b.name;this.id_=b.id?b.id:Entry.generateHash();this.type=b.variableType?b.variableType:"variable";this.object_=b.object||null;this.isCloud_=b.isCloud||!1;var a=Entry.parseNumber(b.value);this.value_="number"==typeof a?a:b.value?b.value:0;"slide"==this.type?(this.minValue_=Number(b.minValue?b.minValue:0),this.maxValue_=Number(b.maxValue?b.maxValue:100)):"list"==this.type&&(this.array_=b.array? b.array:[]);b.isClone||(this.visible_=b.visible||"boolean"==typeof b.visible?b.visible:!0,this.x_=b.x?b.x:null,this.y_=b.y?b.y:null,"list"==this.type&&(this.width_=b.width?b.width:100,this.height_=b.height?b.height:120,this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; @@ -1641,290 +1599,290 @@ params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return Number(d)>Number(e);case "LESS":return Number(d)=Number(e);case "LESS_OR_EQUAL":return Number(d)<=Number(e)}}},show:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator", img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"show"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!0);return a.callReturn()}},hide:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"hide"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!1);return a.callReturn()}},dialog_time:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block", accept:"string"},{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a), -d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]], -value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()}}, -remove_dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"remove_dialog"},"class":"say",isNotFor:["textBox"],func:function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}},change_to_nth_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"pictures",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null, -null],type:"change_to_nth_shape"},paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png", -size:12}],events:{},def:{params:[null,null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var c;c="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(c);return a.callReturn()}},set_effect_volume:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity, -"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness: -"blur"!=c&&"opacity"==c&&(b.effect.alpha+=d/100));b.applyFilter();return a.callReturn()}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0, -VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter();return a.callReturn()}},erase_all_effects:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"erase_all_effects"}, -"class":"effect",isNotFor:["textBox"],func:function(b,a){b.resetFilter();return a.callReturn()}},change_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()* -c);return a.callReturn()}},set_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a)/100,d=b.snapshot_;b.setScaleX(c*d.scaleX);b.setScaleY(c*d.scaleY);return a.callReturn()}},change_scale_size:{color:"#EC4466", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+c);return a.callReturn()}},set_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png", -size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()}},flip_y:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_y"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}},flip_x:{color:"#EC4466", -skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_x"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleY(-1*b.getScaleY());return a.callReturn()}},set_object_order:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"objectSequence",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"set_object_order"}, -paramsKeyMap:{VALUE:0},"class":"z-index",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getCurrentObjects().indexOf(b.parent);if(-1f)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,f-1);break;case "BACKWARD":c=Math.min(e,f+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(f,c);return a.callReturn()}},move_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},move_x:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(b.getY()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){function c(){var c=a.x-b.getX(),d=a.y-b.getY(),c=c/a.frameCount,d=d/a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1", -a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a);1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0}, -"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(b, -a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3", -skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE1",a);b.setX(c);c=a.getNumberValue("VALUE2",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}}, -locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING}, -{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){function c(){b.setX(b.getX()+a.dX);b.setY(b.getY()+a.dY);a.frameCount--;b.brush&&!b.brush.stop&& -b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);var e=a.getNumberValue("VALUE2",a),f=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dX=e/a.frameCount;a.dY=f/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}}, -bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&& -(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP):(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270> -d&&90<=d&&(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"== -c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT, -d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()- -2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic", -value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"mouse"==c?(c=Entry.stage.mouseCoordinate.y,d=Entry.stage.mouseCoordinate.x-d,e=c-e):(c=Entry.container.getEntity(c),d= -c.getX()-d,e=c.getY()-e);e=0===d&&0===e?b.getDirection()+b.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-d);return a.callReturn()}},see_angle_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle_direction"},paramsKeyMap:{VALUE:0}, -"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+c-d);return a.callReturn()}},rotate_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE", -a);b.setDirection(c+b.getDirection());return a.callReturn()}},locate_object_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"locate_object_time"},paramsKeyMap:{VALUE:0,TARGET:1},"class":"move_absolute",isNotFor:[], -func:function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(), --1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute", -isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png", -size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]}, -null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setRotation(b.getRotation()+a.dAngle);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("VALUE",a);var e=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dAngle=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(), -a;delete a.isStart;delete a.frameCount;return a.callReturn()}},direction_relative_duration:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"},paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setDirection(b.getDirection()+ -a.dDirection);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("DURATION",a);var e=a.getNumberValue("AMOUNT",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dDirection=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()}},neobot_sensor_value:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8", -"IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{},def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c]}},neobot_sensor_convert_scale:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658", -params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["255"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"neobot_sensor_convert_scale"}, -paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){var c=a.getStringField("PORT"),c=Entry.hw.portData[c],d=a.getNumberValue("OMIN",a),e=a.getNumberValue("OMAX",a),f=a.getNumberValue("MIN",a),g=a.getNumberValue("MAX",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c=(g-f)/(e-d)*(c-d);c+=f;c=Math.min(g,c);c=Math.max(f,c);return Math.round(c)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3", -params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15", -null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=c+d;return a.callReturn()}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_left_motor"}, -"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL=0;return a.callReturn()}},neobot_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5", -"5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=c+d;return a.callReturn()}}, -neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCR=0;return a.callReturn()}},neobot_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c %1 %2\uc758 \uc18d\ub3c4\ub85c %3\ucd08 \ub3d9\uc548 \ud68c\uc804 %4", -params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","2"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc67c\ucabd \ub3cc\uae30","3"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc624\ub978\ucabd \ub3cc\uae30","4"],["\uc67c\ucabd\uc73c\ub85c \ub3cc\uae30","5"],["\uc624\ub978\ucabd\uc73c\ub85c \ub3cc\uae30","6"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"], -["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","15",{type:"number",params:["0"]}],type:"neobot_all_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.hw.sendQueue.DCL= -0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return a.callReturn()}var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION"),e=a.getNumberValue("DURATION");0>e&&(e=0);switch(d){case 1:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=16+c;break;case 2:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=32+c;break;case 3:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=16+c;break;case 4:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=32+c;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR= -16+c;break;case 6:Entry.hw.sendQueue.DCL=16+c,Entry.hw.sendQueue.DCR=0}if(0===e)return a.callReturn();a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3*e);return a}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_all_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL= -0;Entry.hw.sendQueue.DCR=0;return a.callReturn()}},neobot_set_servo:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c %2 \ub3c4 \uc774\ub3d9 %3",params:[{type:"Dropdown",options:[["OUT1","1"],["OUT2","2"],["OUT3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"neobot_set_servo"},paramsKeyMap:{PORT:0, -DEGREE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("PORT"),d=a.getNumberValue("DEGREE");0>d?d=0:180d?d=0:255d&&(d=0);return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}}, -robotis_openCM70_aux_led_module:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off,"0"],[Lang.Blocks.robotis_cm_led_right+Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on, -"2"],[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_on,"3"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"robotis_openCM70_aux_led_module"},paramsKeyMap:{PORT:0,LED_MODULE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("PORT",a),d=a.getField("LED_MODULE",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0], -g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_aux_custom:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", -size:12}],events:{},def:{params:[null,{type:"number",params:["0"]},null],type:"robotis_openCM70_aux_custom"},paramsKeyMap:{PORT:0,VALUE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("PORT",a),d=a.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}}, -robotis_openCM70_cm_custom:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"robotis_openCM70_cm_custom"},paramsKeyMap:{ADDRESS:0,VALUE:1},"class":"robotis_openCM70_custom",isNotFor:["robotis_openCM70"],func:function(b,a){var c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,d=0,e=0,d= -a.getNumberValue("ADDRESS"),e=a.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(a,[[c,d,65535c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}},sound_volume_set:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"sound_volume_set"},paramsKeyMap:{VALUE:0},"class":"sound_volume",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE", -a)/100;1c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}},sound_silent_all:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[null],type:"sound_silent_all"},"class":"sound_stop",isNotFor:[],func:function(b,a){createjs.Sound.stop();return a.callReturn()}},get_sounds:{color:"#A4D01D",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11, -arrowColor:EntryStatic.ARROW_COLOR_SOUNDS}],events:{},def:{params:[null],type:"get_sounds"},paramsKeyMap:{VALUE:0},func:function(b,a){return a.getStringField("VALUE")}},sound_something_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_play",isNotFor:[],func:function(b,a){var c= -a.getStringValue("VALUE",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id);return a.callReturn()}},sound_something_second_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds",id:"95dw"},{type:"number",params:["1"]},null],type:"sound_something_second_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_play",isNotFor:[], -func:function(b,a){var c=a.getStringValue("VALUE",a),d=a.getNumberValue("SECOND",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id,{startTime:0,duration:1E3*d});return a.callReturn()}},sound_something_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_wait_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_wait",isNotFor:[], -func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c))createjs.Sound.play(c.id),setTimeout(function(){a.playState=0},1E3*c.duration);return a}},sound_something_second_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}], -events:{},def:{params:[{type:"get_sounds"},{type:"number",params:["1"]},null],type:"sound_something_second_wait_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=createjs.Sound.play(c.id),c=a.getNumberValue("SECOND",a);setTimeout(function(){d.stop();a.playState=0}, -1E3*c);d.addEventListener("complete",function(a){})}return a}},sound_from_to:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_play",isNotFor:[],func:function(b,a){var c= -a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a);createjs.Sound.play(c.id,{startTime:Math.min(d,e),duration:Math.max(d,e)-Math.min(d,e)})}return a.callReturn()}},sound_from_to_and_wait:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"}, -{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to_and_wait"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),f=Math.min(d,e),d=Math.max(d,e)-f;createjs.Sound.play(c.id,{startTime:f, -duration:d});setTimeout(function(){a.playState=0},d)}return a}},when_run_button_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_play.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_run_button_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"start"},press_some_key:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png", -size:17,position:{x:0,y:-2}},{type:"Dropdown",options:[["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],["\uc704\ucabd \ud654\uc0b4\ud45c","38"],["\uc544\ub798\ucabd \ud654\uc0b4\ud45c","40"],["\uc67c\ucabd \ud654\uc0b4\ud45c","37"],["\uc624\ub978\ucabd \ud654\uc0b4\ud45c","39"],["\uc5d4\ud130","13"],["\uc2a4\ud398\uc774\uc2a4","32"]],value:"81",fontSize:11},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{VALUE:1}, -func:function(b,a){return a.callReturn()}},when_some_key_pressed:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Keyboard",value:"81"}],events:{},def:{params:[null,"81"],type:"when_some_key_pressed"},paramsKeyMap:{VALUE:1},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"keyPress"},mouse_clicked:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator", -img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_clicked"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"mouse_clicked"},mouse_click_cancled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_click_cancled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()}, -event:"mouse_click_cancled"},when_object_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_object_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click"},when_object_click_canceled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0, -y:-2}}],events:{},def:{params:[null],type:"when_object_click_canceled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click_canceled"},when_some_key_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null]},func:function(b,a){return a.callReturn()},event:"keyPress"},when_message_cast:{color:"#3BBD70",skeleton:"basic_event",statements:[], -params:[{type:"Indicator",img:"block_icon/start_icon_signal.png",size:17,position:{x:0,y:-2}},{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"when_message_cast"},paramsKeyMap:{VALUE:1},"class":"message",isNotFor:["message"],func:function(b, -a){return a.callReturn()},event:"when_message_cast"},message_cast:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast"}, -paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){var c=a.getField("VALUE",a),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",c]);return a.callReturn()}},message_cast_wait:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}, -{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast_wait"},paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){if(a.runningScript){for(var c=a.runningScript,d=c.length,e=0;ec.array_.length)throw Error("can not remove value from array");c.array_.splice(d-1,1);c.updateView();return a.callReturn()}},insert_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer; -a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"text",params:["10"]},null,{type:"text",params:["1"]},null],type:"insert_value_to_list"},paramsKeyMap:{DATA:0,LIST:1,INDEX:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||0==e||e>c.array_.length+1)throw Error("can not insert value to array"); -c.array_.splice(e-1,0,{data:d});c.updateView();return a.callReturn()}},change_value_list_index:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a= -Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"change_value_list_index"},paramsKeyMap:{LIST:0,INDEX:1,DATA:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||e>c.array_.length)throw Error("can not insert value to array");c.array_[e-1].data=d;c.updateView(); -return a.callReturn()}},value_of_index_from_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_3,color:"white"}], -events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"number",params:["1"]}],type:"value_of_index_from_list"},paramsKeyMap:{LIST:1,INDEX:3},"class":"list_element",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b),d=Entry.getListRealIndex(d,c);if(!c.array_|| -isNaN(d)||d>c.array_.length)throw Error("can not insert value to array");return c.array_[d-1].data}},length_of_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_2,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs", -b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null],type:"length_of_list"},paramsKeyMap:{LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);return Entry.variableContainer.getList(c,b).array_.length}},show_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator", -img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"show_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!0);return a.callReturn()}},hide_list:{color:"#E457DC",skeleton:"basic", -statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"hide_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b, -a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!1);return a.callReturn()}},options_for_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["\uccab\ubc88\uc9f8","FIRST"],["\ub9c8\uc9c0\ub9c9","LAST"],["\ubb34\uc791\uc704","RANDOM"]],value:"FIRST",fontSize:11}],events:{},def:{params:[null]},paramsKeyMap:{OPERATOR:0},func:function(b,a){return a.getField("OPERATOR",a)}},set_visible_answer:{color:"#E457DC",skeleton:"basic",statements:[], -params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_timer_visible_show,"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]],value:"SHOW",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{viewAdd:[function(b){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}]},def:{params:["HIDE",null],type:"set_visible_answer"},paramsKeyMap:{BOOL:0},"class":"ask", -isNotFor:[],func:function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return a.callReturn()}},is_included_in_list:{color:"#E457DC",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_2, -color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"text",params:["10"]},null],type:"is_included_in_list"},paramsKeyMap:{LIST:1,DATA:3},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST", -a),d=a.getStringValue("DATA",a),c=Entry.variableContainer.getList(c,b);if(!c)return!1;for(var c=c.array_,e=0,f=c.length;ek&&(k=Math.round(k-155),g=-k,h=0,Entry.dplay.vel_value=g);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,g),Entry.hw.setDigitalPortValue(f, -h),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var l=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(l)},50);Entry.dplay.timeouts.push(l);return a}}},dplay_buzzer:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub514\uc9c0\ud138 10\ubc88 \ubd80\uc800\ub97c %1 %2 %3 \ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30",params:[{type:"Dropdown",options:[["\ub3c4","1"],["\ub3c4#","2"],["\ub808","3"],["\ubbf8b", -"4"],["\ubbf8","5"],["\ud30c","6"],["\ud30c#","7"],["\uc194","8"],["\uc194#","9"],["\ub77c","10"],["\uc2dcb","11"],["\uc2dc","12"],["\ubb34\uc74c","100"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","1",{type:"text",params:["0.5"]},null],type:"dplay_buzzer"}, -paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;Entry.hw.setDigitalPortValue(10,100);delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;return a.callReturn()}var c=a.getNumberField("NOTE",a),d=a.getNumberField("OCTAVE",a),e=a.getNumberValue("VALUE"),d=c+12*(d-1),e=6E4*e/60;a.isStart=!0;a.timeFlag=1;100==c?Entry.hw.setDigitalPortValue(10,100):Entry.hw.setDigitalPortValue(10,d);if(100m?(n=Math.round(m-155),g=-n,h=0,Entry.dplay.Left_value=g):0==m&&(h=g=0,Entry.dplay.Left_value=0));"2"==q&&(e=6,f=11,0m?(n=Math.round(m-155),k=-n,l=0,Entry.dplay.Right_value=k):0==m&&(l=k=0,Entry.dplay.Right_value=k));"3"==q&&(c=3,d=5,e=6,f=11,0m?(n=Math.round(m-155),g=-n,h=0,k=-n,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==m&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f, -k),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var r=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(r)},50);Entry.dplay.timeouts.push(r);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,g=0,g=a.getNumberValue("L_VALUE",a),g=Math.max(g,-100),g=Math.min(g,100);0g?(g=Math.round(g-155),c=-g,d=0,Entry.dplay.Left_value=c):0==g&&(d=c=0,Entry.dplay.Left_value= -0);g=a.getNumberValue("R_VALUE",a);g=Math.max(g,-100);g=Math.min(g,100);0g?(g=Math.round(g-155),e=-g,f=0,Entry.dplay.Right_value=e):0==g&&(f=e=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(3,c),Entry.hw.setDigitalPortValue(5,d), -Entry.hw.setDigitalPortValue(6,f),Entry.hw.setDigitalPortValue(11,e),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var h=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(h)},50);Entry.dplay.timeouts.push(h);return a}}},dplay_robot_stop:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub85c\ubd07\uc744 \uc815\uc9c0\ud558\uae30 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], -events:{},def:{params:[null],type:"dplay_robot_stop"},paramsKeyMap:{},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){Entry.hw.setDigitalPortValue(3,0);Entry.hw.setDigitalPortValue(5,0);Entry.hw.setDigitalPortValue(11,0);Entry.hw.setDigitalPortValue(6,0);return a.callReturn()}},nemoino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"nemoino_get_number_sensor_value"},"class":"arduino_value"},nemoino_get_digital_value:{parent:"arduino_get_digital_value", -isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"}],type:"nemoino_get_digital_value"},"class":"arduino_value"},nemoino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"nemoino_toggle_led"},"class":"arduino_set"},nemoino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"nemoino_toggle_pwm"},"class":"arduino_set"}, -nemoino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"nemoino_convert_scale"},"class":"arduino"},sensorBoard_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_sensor_number"}],type:"sensorBoard_get_number_sensor_value"}, -"class":"arduino_value"},sensorBoard_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"}],type:"sensorBoard_get_digital_value"},"class":"arduino_value"},sensorBoard_toggle_led:{parent:"arduino_toggle_led",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"sensorBoard_toggle_led"},"class":"arduino_set"},sensorBoard_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_pwm_port_number"}, -{type:"arduino_text",params:["255"]},null],type:"sensorBoard_toggle_pwm"},"class":"arduino_set"},sensorBoard_convert_scale:{parent:"arduino_convert_scale",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"sensorBoard_convert_scale"},"class":"arduino"},CODEino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value", -isNotFor:["CODEino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"CODEino_get_number_sensor_value"},"class":"arduino_value"},CODEino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"}],type:"CODEino_get_digital_value"},"class":"arduino_value"},CODEino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"CODEino_toggle_led"},"class":"arduino_set"},CODEino_toggle_pwm:{parent:"arduino_toggle_pwm", -isNotFor:["CODEino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"CODEino_toggle_pwm"},"class":"arduino_set"},CODEino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"CODEino_convert_scale"},"class":"arduino"}, -ardublock_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_sensor_number"}],type:"ardublock_get_number_sensor_value"},"class":"arduino_value"},ardublock_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"}],type:"ardublock_get_digital_value"},"class":"arduino_value"},ardublock_toggle_led:{parent:"arduino_toggle_led",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"}, -null,null],type:"ardublock_toggle_led"},"class":"arduino_set"},ardublock_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"ardublock_toggle_pwm"},"class":"arduino_set"},ardublock_convert_scale:{parent:"arduino_convert_scale",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number", -params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"ardublock_convert_scale"},"class":"arduino"},joystick_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_sensor_number"}],type:"joystick_get_number_sensor_value"},"class":"arduino_value"},joystick_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"}],type:"joystick_get_digital_value"}, -"class":"arduino_value"},joystick_toggle_led:{parent:"arduino_toggle_led",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"joystick_toggle_led"},"class":"arduino_set"},joystick_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["joystick"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"joystick_toggle_pwm"},"class":"arduino_set"},joystick_convert_scale:{parent:"arduino_convert_scale",isNotFor:["joystick"],def:{params:[{type:"arduino_get_number_sensor_value", -params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"joystick_convert_scale"},"class":"arduino"},ebs_if:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null,"wall"]}]}},ebs_if2:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null,"cwz5"]}]}}}; -(function(){for(var b in Entry.block){var a=Entry.block[b];if(a.parent){var c=function(){};c.prototype=Entry.block[a.parent];var c=new c,d;for(d in a)c[d]=a[d];Entry.block[b]=c}}})();"object"==typeof exports&&(exports.block=Entry.block);Entry.BlockMenu=function(b,a,c,d){Entry.Model(this,!1);this._align=a||"CENTER";this._scroll=void 0!==d?d:!1;this._bannedClass=[];this._categories=[];this.suffix="blockMenu";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.visible=!0;this._svgId="blockMenu"+(new Date).getTime();this._clearCategory();this._categoryData=c;this._generateView(c);this._splitters=[];this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg, +d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}if(0==a.timeFlag)return delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn();b.dialog||(d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a),d||"number"==typeof d||(d=" "),d=Entry.convertToRoundedDecimals(d,3),new Entry.Dialog(b, +d,e),b.syncDialogVisible(b.getVisible()));return a}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b, +a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()}},remove_dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"remove_dialog"},"class":"say",isNotFor:["textBox"],func:function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}}, +change_to_nth_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"pictures",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_nth_shape"},paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown", +options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var c;c="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(c); +return a.callReturn()}},set_effect_volume:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b, +a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness:"blur"!=c&&"opacity"==c&&(b.effect.alpha+=d/100));b.applyFilter();return a.callReturn()}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color", +fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter(); +return a.callReturn()}},erase_all_effects:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"erase_all_effects"},"class":"effect",isNotFor:["textBox"],func:function(b,a){b.resetFilter();return a.callReturn()}},change_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number", +params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()*c);return a.callReturn()}},set_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_percent"},paramsKeyMap:{VALUE:0}, +"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a)/100,d=b.snapshot_;b.setScaleX(c*d.scaleX);b.setScaleY(c*d.scaleY);return a.callReturn()}},change_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE", +a);b.setSize(b.getSize()+c);return a.callReturn()}},set_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()}},flip_y:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator", +img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_y"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}},flip_x:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_x"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleY(-1*b.getScaleY());return a.callReturn()}},set_object_order:{color:"#EC4466",skeleton:"basic",statements:[], +params:[{type:"DropdownDynamic",value:null,menuName:"objectSequence",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"set_object_order"},paramsKeyMap:{VALUE:0},"class":"z-index",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getCurrentObjects().indexOf(b.parent);if(-1f)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,f-1);break;case "BACKWARD":c=Math.min(e,f+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(f,c);return a.callReturn()}}, +move_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI)); +b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},move_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()); +return a.callReturn()}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(b.getY()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_xy_time:{color:"#A751E3",skeleton:"basic", +statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){function c(){var c=a.x-b.getX(),d=a.y-b.getY(),c=c/a.frameCount,d=d/a.frameCount;b.setX(b.getX()+ +c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a);1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", +img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png", +size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate", +isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/ +c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE1", +a);b.setX(c);c=a.getNumberValue("VALUE2",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&& +!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}}, +locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c), +c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0, +VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){function c(){b.setX(b.getX()+a.dX);b.setY(b.getY()+a.dY);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);var e=a.getNumberValue("VALUE2",a),f=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dX=e/a.frameCount;a.dY=f/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount; +return a.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS); +a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE; +if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP):(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&& +e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(e=b.collision== +Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()- +2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right, +b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision= +Entry.Utils.COLLISION.LEFT)));return a.callReturn()}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+ +180);return a.callReturn()}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn(); +"mouse"==c?(c=Entry.stage.mouseCoordinate.y,d=Entry.stage.mouseCoordinate.x-d,e=c-e):(c=Entry.container.getEntity(c),d=c.getX()-d,e=c.getY()-e);e=0===d&&0===e?b.getDirection()+b.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-d);return a.callReturn()}},see_angle_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png", +size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+c-d);return a.callReturn()}},rotate_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]}, +null],type:"rotate_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},locate_object_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number", +params:["2"]},null,null],type:"locate_object_time"},paramsKeyMap:{VALUE:0,TARGET:1},"class":"move_absolute",isNotFor:[],func:function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=Number(e.x), +e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png", +size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate", +isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}}, +direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, +{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}}, +rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setRotation(b.getRotation()+a.dAngle);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("VALUE",a);var e=a.getNumberValue("ANGLE", +a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dAngle=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},direction_relative_duration:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"}, +paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setDirection(b.getDirection()+a.dDirection);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("DURATION",a);var e=a.getNumberValue("AMOUNT",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dDirection=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()}},neobot_sensor_value:{color:"#00979D", +skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{},def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c]}},neobot_sensor_convert_scale:{color:"#00979D", +skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{}, +def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["255"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"neobot_sensor_convert_scale"},paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){var c=a.getStringField("PORT"),c=Entry.hw.portData[c],d=a.getNumberValue("OMIN",a),e=a.getNumberValue("OMAX",a),f=a.getNumberValue("MIN",a),g=a.getNumberValue("MAX",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c=(g-f)/ +(e-d)*(c-d);c+=f;c=Math.min(g,c);c=Math.max(f,c);return Math.round(c)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"], +["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=c+d;return a.callReturn()}},neobot_stop_left_motor:{color:"#00979D", +skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_left_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL=0;return a.callReturn()}},neobot_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown", +options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"}, +paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=c+d;return a.callReturn()}},neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor", +isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCR=0;return a.callReturn()}},neobot_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c %1 %2\uc758 \uc18d\ub3c4\ub85c %3\ucd08 \ub3d9\uc548 \ud68c\uc804 %4",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","2"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc67c\ucabd \ub3cc\uae30","3"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc624\ub978\ucabd \ub3cc\uae30","4"],["\uc67c\ucabd\uc73c\ub85c \ub3cc\uae30", +"5"],["\uc624\ub978\ucabd\uc73c\ub85c \ub3cc\uae30","6"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","15", +{type:"number",params:["0"]}],type:"neobot_all_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return a.callReturn()}var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION"),e=a.getNumberValue("DURATION");0>e&&(e=0);switch(d){case 1:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR= +16+c;break;case 2:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=32+c;break;case 3:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=16+c;break;case 4:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=32+c;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+c;break;case 6:Entry.hw.sendQueue.DCL=16+c,Entry.hw.sendQueue.DCR=0}if(0===e)return a.callReturn();a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3*e);return a}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic", +statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_all_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;return a.callReturn()}},neobot_set_servo:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c %2 \ub3c4 \uc774\ub3d9 %3",params:[{type:"Dropdown", +options:[["OUT1","1"],["OUT2","2"],["OUT3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"neobot_set_servo"},paramsKeyMap:{PORT:0,DEGREE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("PORT"),d=a.getNumberValue("DEGREE");0>d?d=0:180d?d=0:255d&&(d=0);return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_aux_led_module:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_led_both+ +Lang.Blocks.robotis_common_off,"0"],[Lang.Blocks.robotis_cm_led_right+Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_on,"3"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"robotis_openCM70_aux_led_module"},paramsKeyMap:{PORT:0,LED_MODULE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b, +a){var c=a.getField("PORT",a),d=a.getField("LED_MODULE",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_aux_custom:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4, +"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["0"]},null],type:"robotis_openCM70_aux_custom"},paramsKeyMap:{PORT:0,VALUE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("PORT",a),d=a.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE, +f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_cm_custom:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null], +type:"robotis_openCM70_cm_custom"},paramsKeyMap:{ADDRESS:0,VALUE:1},"class":"robotis_openCM70_custom",isNotFor:["robotis_openCM70"],func:function(b,a){var c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,d=0,e=0,d=a.getNumberValue("ADDRESS"),e=a.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(a,[[c,d,65535c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}},sound_volume_set:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"sound_volume_set"}, +paramsKeyMap:{VALUE:0},"class":"sound_volume",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a)/100;1c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}},sound_silent_all:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[null],type:"sound_silent_all"},"class":"sound_stop",isNotFor:[],func:function(b,a){createjs.Sound.stop();return a.callReturn()}},get_sounds:{color:"#A4D01D",skeleton:"basic_string_field", +statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_SOUNDS}],events:{},def:{params:[null],type:"get_sounds"},paramsKeyMap:{VALUE:0},func:function(b,a){return a.getStringField("VALUE")}},sound_something_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_with_block"}, +paramsKeyMap:{VALUE:0},"class":"sound_play",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id);return a.callReturn()}},sound_something_second_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds",id:"95dw"},{type:"number",params:["1"]},null],type:"sound_something_second_with_block"}, +paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_play",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE",a),d=a.getNumberValue("SECOND",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id,{startTime:0,duration:1E3*d});return a.callReturn()}},sound_something_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_wait_with_block"}, +paramsKeyMap:{VALUE:0},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c))createjs.Sound.play(c.id),setTimeout(function(){a.playState=0},1E3*c.duration);return a}},sound_something_second_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"}, +{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"number",params:["1"]},null],type:"sound_something_second_wait_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=createjs.Sound.play(c.id),c=a.getNumberValue("SECOND", +a);setTimeout(function(){d.stop();a.playState=0},1E3*c);d.addEventListener("complete",function(a){})}return a}},sound_from_to:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_play", +isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a);createjs.Sound.play(c.id,{startTime:Math.min(d,e),duration:Math.max(d,e)-Math.min(d,e)})}return a.callReturn()}},sound_from_to_and_wait:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}], +events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to_and_wait"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),f=Math.min(d,e),d=Math.max(d, +e)-f;createjs.Sound.play(c.id,{startTime:f,duration:d});setTimeout(function(){a.playState=0},d)}return a}},when_run_button_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_play.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_run_button_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"start"},press_some_key:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator", +img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Dropdown",options:[["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],["\uc704\ucabd \ud654\uc0b4\ud45c","38"],["\uc544\ub798\ucabd \ud654\uc0b4\ud45c","40"],["\uc67c\ucabd \ud654\uc0b4\ud45c","37"],["\uc624\ub978\ucabd \ud654\uc0b4\ud45c","39"],["\uc5d4\ud130","13"],["\uc2a4\ud398\uc774\uc2a4","32"]],value:"81",fontSize:11},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{},def:{params:[null, +null,null]},paramsKeyMap:{VALUE:1},func:function(b,a){return a.callReturn()}},when_some_key_pressed:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Keyboard",value:"81"}],events:{},def:{params:[null,"81"],type:"when_some_key_pressed"},paramsKeyMap:{VALUE:1},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"keyPress"},mouse_clicked:{color:"#3BBD70",skeleton:"basic_event", +statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_clicked"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"mouse_clicked"},mouse_click_cancled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_click_cancled"},"class":"event",isNotFor:[], +func:function(b,a){return a.callReturn()},event:"mouse_click_cancled"},when_object_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_object_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click"},when_object_click_canceled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png", +size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_object_click_canceled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click_canceled"},when_some_key_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null]},func:function(b,a){return a.callReturn()},event:"keyPress"},when_message_cast:{color:"#3BBD70",skeleton:"basic_event", +statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_signal.png",size:17,position:{x:0,y:-2}},{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"when_message_cast"},paramsKeyMap:{VALUE:1},"class":"message",isNotFor:["message"], +func:function(b,a){return a.callReturn()},event:"when_message_cast"},message_cast:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null, +null],type:"message_cast"},paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){var c=a.getField("VALUE",a),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",c]);return a.callReturn()}},message_cast_wait:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages", +fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast_wait"},paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){if(a.runningScript){for(var c=a.runningScript,d=c.length,e=0;ec.array_.length)throw Error("can not remove value from array");c.array_.splice(d-1,1);c.updateView();return a.callReturn()}},insert_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE}, +{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"text",params:["10"]},null,{type:"text",params:["1"]},null],type:"insert_value_to_list"},paramsKeyMap:{DATA:0,LIST:1,INDEX:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST", +a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||0==e||e>c.array_.length+1)throw Error("can not insert value to array");c.array_.splice(e-1,0,{data:d});c.updateView();return a.callReturn()}},change_value_list_index:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Block",accept:"string"}, +{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"change_value_list_index"},paramsKeyMap:{LIST:0,INDEX:1,DATA:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA", +a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||e>c.array_.length)throw Error("can not insert value to array");c.array_[e-1].data=d;c.updateView();return a.callReturn()}},value_of_index_from_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text", +text:Lang.Blocks.VARIABLE_value_of_index_from_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"number",params:["1"]}],type:"value_of_index_from_list"},paramsKeyMap:{LIST:1,INDEX:3},"class":"list_element", +isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b),d=Entry.getListRealIndex(d,c);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not insert value to array");return c.array_[d-1].data}},length_of_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11, +arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_2,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null],type:"length_of_list"},paramsKeyMap:{LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);return Entry.variableContainer.getList(c, +b).array_.length}},show_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"show_list"},paramsKeyMap:{LIST:0}, +"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!0);return a.callReturn()}},hide_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs", +b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"hide_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!1);return a.callReturn()}},options_for_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["\uccab\ubc88\uc9f8","FIRST"],["\ub9c8\uc9c0\ub9c9", +"LAST"],["\ubb34\uc791\uc704","RANDOM"]],value:"FIRST",fontSize:11}],events:{},def:{params:[null]},paramsKeyMap:{OPERATOR:0},func:function(b,a){return a.getField("OPERATOR",a)}},set_visible_answer:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_timer_visible_show,"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]],value:"SHOW",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}], +events:{viewAdd:[function(b){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}]},def:{params:["HIDE",null],type:"set_visible_answer"},paramsKeyMap:{BOOL:0},"class":"ask",isNotFor:[],func:function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return a.callReturn()}},is_included_in_list:{color:"#E457DC",skeleton:"basic_boolean_field",statements:[], +params:[{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer; +a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"text",params:["10"]},null],type:"is_included_in_list"},paramsKeyMap:{LIST:1,DATA:3},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getStringValue("DATA",a),c=Entry.variableContainer.getList(c,b);if(!c)return!1;for(var c=c.array_,e=0,f=c.length;ek&&(k=Math.round(k-155),g=-k,h=0,Entry.dplay.vel_value=g);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c, +g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,g),Entry.hw.setDigitalPortValue(f,h),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var l=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(l)},50);Entry.dplay.timeouts.push(l);return a}}},dplay_buzzer:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub514\uc9c0\ud138 10\ubc88 \ubd80\uc800\ub97c %1 %2 %3 \ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30", +params:[{type:"Dropdown",options:[["\ub3c4","1"],["\ub3c4#","2"],["\ub808","3"],["\ubbf8b","4"],["\ubbf8","5"],["\ud30c","6"],["\ud30c#","7"],["\uc194","8"],["\uc194#","9"],["\ub77c","10"],["\uc2dcb","11"],["\uc2dc","12"],["\ubb34\uc74c","100"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],events:{},def:{params:["1","1",{type:"text",params:["0.5"]},null],type:"dplay_buzzer"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;Entry.hw.setDigitalPortValue(10,100);delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;return a.callReturn()}var c=a.getNumberField("NOTE",a),d=a.getNumberField("OCTAVE",a),e=a.getNumberValue("VALUE"),d=c+12*(d-1),e=6E4*e/60;a.isStart=!0;a.timeFlag=1;100== +c?Entry.hw.setDigitalPortValue(10,100):Entry.hw.setDigitalPortValue(10,d);if(100m?(n=Math.round(m-155),g=-n,h=0,Entry.dplay.Left_value=g):0==m&&(h=g=0,Entry.dplay.Left_value=0));"2"==q&&(e=6,f=11,0m?(n=Math.round(m-155),k=-n,l=0,Entry.dplay.Right_value= +k):0==m&&(l=k=0,Entry.dplay.Right_value=k));"3"==q&&(c=3,d=5,e=6,f=11,0m?(n=Math.round(m-155),g=-n,h=0,k=-n,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==m&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), +a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f,k),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var r=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(r)},50);Entry.dplay.timeouts.push(r);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3", +params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,g=0,g=a.getNumberValue("L_VALUE",a),g=Math.max(g,-100),g=Math.min(g,100);0 +g?(g=Math.round(g-155),c=-g,d=0,Entry.dplay.Left_value=c):0==g&&(d=c=0,Entry.dplay.Left_value=0);g=a.getNumberValue("R_VALUE",a);g=Math.max(g,-100);g=Math.min(g,100);0g?(g=Math.round(g-155),e=-g,f=0,Entry.dplay.Right_value=e):0==g&&(f=e=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), +a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(3,c),Entry.hw.setDigitalPortValue(5,d),Entry.hw.setDigitalPortValue(6,f),Entry.hw.setDigitalPortValue(11,e),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var h=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(h)},50);Entry.dplay.timeouts.push(h);return a}}},dplay_robot_stop:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub85c\ubd07\uc744 \uc815\uc9c0\ud558\uae30 %1", +params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"dplay_robot_stop"},paramsKeyMap:{},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){Entry.hw.setDigitalPortValue(3,0);Entry.hw.setDigitalPortValue(5,0);Entry.hw.setDigitalPortValue(11,0);Entry.hw.setDigitalPortValue(6,0);return a.callReturn()}},nemoino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_sensor_number"}], +type:"nemoino_get_number_sensor_value"},"class":"arduino_value"},nemoino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"}],type:"nemoino_get_digital_value"},"class":"arduino_value"},nemoino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"nemoino_toggle_led"},"class":"arduino_set"},nemoino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_pwm_port_number"}, +{type:"arduino_text",params:["255"]},null],type:"nemoino_toggle_pwm"},"class":"arduino_set"},nemoino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"nemoino_convert_scale"},"class":"arduino"},sensorBoard_get_number_sensor_value:{parent:"arduino_get_number_sensor_value", +isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_sensor_number"}],type:"sensorBoard_get_number_sensor_value"},"class":"arduino_value"},sensorBoard_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"}],type:"sensorBoard_get_digital_value"},"class":"arduino_value"},sensorBoard_toggle_led:{parent:"arduino_toggle_led",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"sensorBoard_toggle_led"}, +"class":"arduino_set"},sensorBoard_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"sensorBoard_toggle_pwm"},"class":"arduino_set"},sensorBoard_convert_scale:{parent:"arduino_convert_scale",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number", +params:["0"]},{type:"number",params:["100"]}],type:"sensorBoard_convert_scale"},"class":"arduino"},CODEino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"CODEino_get_number_sensor_value"},"class":"arduino_value"},CODEino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"}],type:"CODEino_get_digital_value"},"class":"arduino_value"},CODEino_toggle_led:{parent:"arduino_toggle_led", +isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"CODEino_toggle_led"},"class":"arduino_set"},CODEino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"CODEino_toggle_pwm"},"class":"arduino_set"},CODEino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]}, +{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"CODEino_convert_scale"},"class":"arduino"},ardublock_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_sensor_number"}],type:"ardublock_get_number_sensor_value"},"class":"arduino_value"},ardublock_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"}], +type:"ardublock_get_digital_value"},"class":"arduino_value"},ardublock_toggle_led:{parent:"arduino_toggle_led",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"ardublock_toggle_led"},"class":"arduino_set"},ardublock_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"ardublock_toggle_pwm"},"class":"arduino_set"},ardublock_convert_scale:{parent:"arduino_convert_scale", +isNotFor:["ardublock"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"ardublock_convert_scale"},"class":"arduino"},joystick_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_sensor_number"}],type:"joystick_get_number_sensor_value"},"class":"arduino_value"}, +joystick_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"}],type:"joystick_get_digital_value"},"class":"arduino_value"},joystick_toggle_led:{parent:"arduino_toggle_led",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"joystick_toggle_led"},"class":"arduino_set"},joystick_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["joystick"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text", +params:["255"]},null],type:"joystick_toggle_pwm"},"class":"arduino_set"},joystick_convert_scale:{parent:"arduino_convert_scale",isNotFor:["joystick"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"joystick_convert_scale"},"class":"arduino"},ebs_if:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null, +"wall"]}]}},ebs_if2:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null,"cwz5"]}]}}};(function(){for(var b in Entry.block){var a=Entry.block[b];if(a.parent){var c=function(){};c.prototype=Entry.block[a.parent];var c=new c,d;for(d in a)c[d]=a[d];Entry.block[b]=c}}})();"object"==typeof exports&&(exports.block=Entry.block);Entry.BlockMenu=function(b,a,c,d){Entry.Model(this,!1);this._align=a||"CENTER";this._scroll=void 0!==d?d:!1;this._bannedClass=[];this._categories=[];this.suffix="blockMenu";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.visible=!0;this._svgId="blockMenu"+(new Date).getTime();this._clearCategory();this._categoryData=c;this._generateView(c);this._splitters=[];this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg, this.suffix);this.patternRect=Entry.Utils.addBlockPattern(this.svg,this.suffix);this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;this.changeEvent=new Entry.Event(this);c&&this._generateCategoryCodes(c);this.observe(this,"_handleDragBlock",["dragBlock"]);this._scroll&&(this._scroller=new Entry.BlockMenuScroller(this),this._addControl(b));Entry.documentMousedown&&Entry.documentMousedown.attach(this, this.setSelectedBlock);this._categoryCodes&&Entry.keyPressed&&Entry.keyPressed.attach(this,this._captureKeyEvent);Entry.windowResized&&(b=_.debounce(this.updateOffset,200),Entry.windowResized.attach(this,b))}; (function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(a){var b=this.view,d=this;a&&(this._categoryCol=Entry.Dom("ul",{class:"entryCategoryListWorkspace",parent:b}),this._generateCategoryView(a));this.blockMenuContainer=Entry.Dom("div",{"class":"blockMenuContainer",parent:b});this.svgDom=Entry.Dom($(''),{parent:this.blockMenuContainer});this.svgDom.mouseenter(function(a){d._scroller&& diff --git a/src/container.js b/src/container.js index edfed206df..f44fe042cd 100644 --- a/src/container.js +++ b/src/container.js @@ -494,8 +494,6 @@ Entry.Container.prototype.moveElementByBlock = function(currentIndex, targetInde * @param {string} menuName */ Entry.Container.prototype.getDropdownList = function(menuName) { - if (!Entry.playground || !Entry.playground.object) - menuName = null; var result = []; switch (menuName) { case 'sprites': From 46d708a78171aa513bcaca988fa2ed692284dd8d Mon Sep 17 00:00:00 2001 From: vivid Date: Wed, 6 Jul 2016 16:41:54 +0900 Subject: [PATCH 16/31] ua test --- dist/entry.js | 80 +++++++++++++++++++----------------- dist/entry.min.js | 82 ++++++++++++++++++------------------- src/workspace/block_view.js | 18 +++++++- 3 files changed, 101 insertions(+), 79 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index eab5f54d41..f02029d3c2 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -9852,40 +9852,40 @@ Entry.Painter.prototype.generateView = function(b) { this.attrLineArea = Entry.createElement("div", "painterAttrLineStyle"); this.attrLineArea.addClass("entryPlaygroundPainterAttrLineStyle"); g.appendChild(this.attrLineArea); - var t = Entry.createElement("div"); - t.addClass("entryPlaygroundPainterAttrLineStyleLine"); - this.attrLineArea.appendChild(t); var u = Entry.createElement("div"); - u.addClass("entryPlaygroundPaitnerAttrLineArea"); + u.addClass("entryPlaygroundPainterAttrLineStyleLine"); this.attrLineArea.appendChild(u); + var t = Entry.createElement("div"); + t.addClass("entryPlaygroundPaitnerAttrLineArea"); + this.attrLineArea.appendChild(t); d = Entry.createElement("div"); d.addClass("entryPlaygroundPainterAttrLineStyleLine1"); - u.appendChild(d); + t.appendChild(d); d.value = "line"; var v = Entry.createElement("div"); v.addClass("painterAttrLineStyleBackgroundLine"); - t.bindOnClick(function(a) { - u.removeClass("entryRemove"); + u.bindOnClick(function(a) { + t.removeClass("entryRemove"); }); - u.blur = function(a) { + t.blur = function(a) { this.addClass("entryRemove"); }; - u.onmouseleave = function(a) { + t.onmouseleave = function(a) { this.addClass("entryRemove"); }; d.bindOnClick(function(a) { - this.attrLineArea.removeClass(t); + this.attrLineArea.removeClass(u); this.attrLineArea.appendChild(v); this.attrLineArea.onchange(a); - u.blur(); + t.blur(); }); v.bindOnClick(function(a) { - u.removeClass("entryRemove"); + t.removeClass("entryRemove"); }); this.attrLineArea.onchange = function(b) { a.stroke.style = b.target.value; }; - u.blur(); + t.blur(); } }; Entry.Painter.prototype.restoreHandle = function() { @@ -11670,8 +11670,8 @@ Entry.BlockDriver = function() { return d; } for (var e = 0;e < a.length;e++) { - var f = a[e], g = f.tagName, h = $(f).children()[0], t = f.getAttribute("name"); - "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(b(h)), d.index[t] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[t] = d.params.length - 1); + var f = a[e], g = f.tagName, h = $(f).children()[0], u = f.getAttribute("name"); + "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(b(h)), d.index[u] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[u] = d.params.length - 1); } return d; } @@ -16202,12 +16202,12 @@ Entry.BlockView.pngMap = {}; }; b.getDataUrl = function(a) { function b() { - f = f.replace("(svgGroup)", (new XMLSerializer).serializeToString(g)).replace("(defs)", (new XMLSerializer).serializeToString(l[0])).replace(/>\s+/g, ">").replace(/\s+\s+/g, ">").replace(/\s+>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.move_line=function(){this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").moveTo(this.oldPt.x,this.oldPt.y).lineTo(this.stage.mouseX,this.stage.mouseY);this.file.modified=!0;this.stage.update()}; @@ -968,19 +968,19 @@ e.addClass("entryPlaygroundPainterAttrResizeXTop");e.innerHTML="X";c.appendChild c.innerHTML="x";d.appendChild(c);c=Entry.createElement("div");c.addClass("entryPlaygroundAttrReiszeY");d.appendChild(c);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrResizeYTop");d.innerHTML="Y";c.appendChild(d);this.objectHeightInput=Entry.createElement("input","entryPainterAttrHeight");this.objectHeightInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;a.handle.height=this.value;a.updateImageHandle()}; this.objectHeightInput.addClass("entryPlaygroundPainterNumberInput");c.appendChild(this.objectHeightInput);this.attrRotateArea=Entry.createElement("div","painterAttrRotateArea");this.attrRotateArea.addClass("painterAttrRotateArea");g.appendChild(this.attrRotateArea);d=Entry.createElement("div");d.addClass("painterAttrRotateName");d.innerHTML=Lang.Workspace.picture_rotation;this.attrRotateArea.appendChild(d);d=Entry.createElement("fieldset","entryPainterAttrRotate");d.addClass("entryPlaygroundPainterAttrRotate"); this.attrRotateArea.appendChild(d);c=Entry.createElement("div");c.addClass("painterAttrRotateTop");c.innerHTML="\u03bf";d.appendChild(c);this.objectRotateInput=Entry.createElement("input","entryPainterAttrDegree");this.objectRotateInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;360<=this.value?this.value%=360:0>this.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); -this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var n=Entry.createElement("div");n.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(n);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); +this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var q=Entry.createElement("div");q.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(q);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); Entry.getColourCodes().forEach(function(b){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=b;c.bindOnClick(function(c){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= -b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});n.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); -var q=Entry.createElement("fieldset","entryPainterAttrThick");q.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(q);d=Entry.createElement("div");d.addClass("paintAttrThickTop");q.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);q.appendChild(e); -d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);q.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;q.bindOnClick(function(){m.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(a){q.style.zIndex= +b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});q.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); +var n=Entry.createElement("fieldset","entryPainterAttrThick");n.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(n);d=Entry.createElement("div");d.addClass("paintAttrThickTop");n.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);n.appendChild(e); +d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);n.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;n.bindOnClick(function(){m.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); +g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(a){n.style.zIndex= "1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", "entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(b){a.font.style=b.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;dd.style.opacity&&(clearInterval(a),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryRemove");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.BlockDriver=function(){}; -(function(b){b.convert=function(){var a=new Date,b;for(b in Entry.block)"function"===typeof Entry.block[b]&&this._convertBlock(b);console.log((new Date).getTime()-a.getTime())};b._convertBlock=function(a){function b(a){var d={type:a.getAttribute("type"),index:{}};a=$(a).children();if(!a)return d;for(var e=0;eg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;dg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;d=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; Entry.Utils.colorDarken=function(b,a){function c(a){2!=a.length&&(a="0"+a);return a}var d,e,f;7===b.length?(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),f=parseInt(b.substr(5,2),16)):(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),f=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;d=c(Math.floor(d*a).toString(16));e=c(Math.floor(e*a).toString(16));f=c(Math.floor(f*a).toString(16));return"#"+d+e+f}; Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;var c=Entry.Utils.hexToHsl(b);c.l+=a/100;c.l=Math.min(1,Math.max(0,c.l));return Entry.Utils.hslToHex(c)};Entry.Utils.bound01=function(b,a){var c=b;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(b="100%");c="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));c&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; @@ -1191,8 +1191,8 @@ b[h],0d-(l.width+n.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; +b,tP,h),this._movePort(rPort,b,bP,k))};b._alignNS=function(a,b,d){for(var e=-this._rect.width/2,f=this._rect.width/2,g=this._rect.width,h=0,k=0;kd-(l.width+q.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+d+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,12:Entry.SensorBoard,13:Entry.CODEino,14:Entry.joystick,15:Entry.dplay,16:Entry.nemoino,17:Entry.Xbot,18:Entry.ardublock,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick,42:Entry.Arduino,51:Entry.Neobot, 71:Entry.Robotis_carCont,72:Entry.Robotis_openCM70,81:Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,c;this.connected=!1;this.connectTrial++;if(-1m?(n=Math.round(m-155),g=-n,h=0,Entry.dplay.Left_value=g):0==m&&(h=g=0,Entry.dplay.Left_value=0));"2"==q&&(e=6,f=11,0m?(n=Math.round(m-155),k=-n,l=0,Entry.dplay.Right_value= -k):0==m&&(l=k=0,Entry.dplay.Right_value=k));"3"==q&&(c=3,d=5,e=6,f=11,0m?(n=Math.round(m-155),g=-n,h=0,k=-n,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==m&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), +VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,h=0,k=0,l=0,q=0,n=a.getField("PORT"),m=a.getNumberValue("VALUE",a),m=Math.max(m,-100),m=Math.min(m,100);"1"==n&&(c=3,d=5,0m?(q=Math.round(m-155),g=-q,h=0,Entry.dplay.Left_value=g):0==m&&(h=g=0,Entry.dplay.Left_value=0));"2"==n&&(e=6,f=11,0m?(q=Math.round(m-155),k=-q,l=0,Entry.dplay.Right_value= +k):0==m&&(l=k=0,Entry.dplay.Right_value=k));"3"==n&&(c=3,d=5,e=6,f=11,0m?(q=Math.round(m-155),g=-q,h=0,k=-q,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==m&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f,k),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var r=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(r)},50);Entry.dplay.timeouts.push(r);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3", params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,g=0,g=a.getNumberValue("L_VALUE",a),g=Math.max(g,-100),g=Math.min(g,100);0 g?(g=Math.round(g-155),c=-g,d=0,Entry.dplay.Left_value=c):0==g&&(d=c=0,Entry.dplay.Left_value=0);g=a.getNumberValue("R_VALUE",a);g=Math.max(g,-100);g=Math.min(g,100);0g?(g=Math.round(g-155),e=-g,f=0,Entry.dplay.Right_value=e):0==g&&(f=e=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), @@ -1924,7 +1924,7 @@ b.onMouseDown=function(a){function c(a){a.stopPropagation();var c=e.workspace.ge Entry.DRAG_MODE_DRAG,m.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(m,c),a=!0),this.animating&&this.set({animating:!1}),0===m.dragInstance.height&&m.dragInstance.set({height:-1+m.height}),c=m.dragInstance,m._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),m.originPos||(m.originPos={x:m.x,y:m.y}),a&&e.generateCodeMagnetMap(),m._updateCloseBlock()))}function d(a){$(document).unbind(".block");m.terminateDrag(a);e&&e.set({dragBlock:null}); m._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete m.dragInstance}a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();this._changeFill(!1);var e=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(a);if(!this.readOnly&&!e.viewOnly){e.setSelectedBlock(this);this.dominate();if(0===a.button||a.originalEvent&&a.originalEvent.touches){var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;this.mouseDownCoordinate= {x:f.pageX,y:f.pageY};var g=$(document);g.bind("mousemove.block touchmove.block",c);g.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:f.pageX,startY:f.pageY,offsetX:f.pageX,offsetY:f.pageY,height:0,mode:!0});e.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN}else if(Entry.Utils.isRightButton(a)){var h=this,k=h.block;if(this.isInBlockMenu)return;f=[];var g={text:Lang.Blocks.Duplication_option,enable:this.copyable,callback:function(){Entry.do("cloneBlock", -k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},n={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},q={text:"\uc774\ubbf8\uc9c0\ub85c \uc800\uc7a5\ud558\uae30",callback:function(){h.downloadAsImage()}};f.push(g);f.push(l);f.push(n);Entry.Utils.isChrome()&&"workspace"==Entry.type&&f.push(q);Entry.ContextMenu.show(f)}var m=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&& +k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},q={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},n={text:"\uc774\ubbf8\uc9c0\ub85c \uc800\uc7a5\ud558\uae30",callback:function(){h.downloadAsImage()}};f.push(g);f.push(l);f.push(q);Entry.Utils.isChrome()&&"workspace"==Entry.type&&f.push(n);Entry.ContextMenu.show(f)}var m=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&& a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(d===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg;a=!1;var h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode=d,b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE, Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x, @@ -1940,12 +1940,12 @@ b._updateOpacity=function(){this.svgGroup.attr({opacity:!1===this.visible?0:1}); a.separate(),a.view.bumpAway(null,100))}}else if(a=this.block.getPrevBlock())this._toLocalCoordinate(a.view._nextGroup),(a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)};b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y;return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)}; b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()};b._updateColor=function(){var a=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g,">").replace(/\s+(svgGroup)(defs)',g=this.svgGroup.cloneNode(!0),h=this._skeleton.box(this),k=a?1:1.5;g.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X",-h.offsetX).replace("%Y",-h.offsetY).replace("%SCALE",k)); -for(var l=this.getBoard().svgDom.find("defs"),n=this.svgGroup.getBoundingClientRect(),q=g.getElementsByTagName("image"),h=g.getElementsByTagName("text"),m=["\u2265","\u2264"],r="\u2265\u2264-><=+-x/".split(""),k=0;k\s+/g,">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.cloneNode(!0),k=this._skeleton.box(this),l=a?1:1.5,q=e()? +.85:.95;console.log(e());h.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X",-k.offsetX).replace("%Y",-k.offsetY).replace("%SCALE",l));for(var n=this.getBoard().svgDom.find("defs"),m=this.svgGroup.getBoundingClientRect(),r=h.getElementsByTagName("image"),k=h.getElementsByTagName("text"),u=["\u2265","\u2264"],t="\u2265\u2264-><=+-x/".split(""),l=0;le||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;fg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint=f.point}this._magnetMap[b]=d}};b._getCodeBlocks=function(a,b){var d= -a.getThreads(),e=[],f;switch(b){case "previous":f=this._getNextMagnets;break;case "next":f=this._getPreviousMagnets;break;case "string":f=this._getFieldMagnets;break;case "boolean":f=this._getFieldMagnets;break;case "param":f=this._getOutputMagnets;break;default:return[]}for(var g=0;gd.endPoint)f=h+1;else{e=d.blocks;for(f=0;f -1) { text.setAttribute('font-size', (size) + 'px'); - } else text.setAttribute('font-size', (size * 0.95) + 'px'); + } else { + text.setAttribute('font-size', (size * fontWeight) + 'px'); + } + text.setAttribute('alignment-baseline', 'baseline'); })(texts[i]); @@ -1134,6 +1140,16 @@ Entry.BlockView.pngMap = {}; img.src = src; return deferred.promise(); } + + function isWindow7() { + var platform = window.platform; + console.log(platform); + if (platform && platform.name.toLowerCase() === 'windows' && + platform.name.version[0] === '7') { + return true; + } + return false; + } }; p.downloadAsImage = function() { From efc52420bb95974a70400d73e35a1d7a73f19d7a Mon Sep 17 00:00:00 2001 From: vivid Date: Wed, 6 Jul 2016 16:50:16 +0900 Subject: [PATCH 17/31] typo --- dist/entry.js | 2 +- dist/entry.min.js | 4 ++-- src/workspace/block_view.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index f02029d3c2..cf58d99e5b 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -16239,7 +16239,7 @@ Entry.BlockView.pngMap = {}; function e() { var a = window.platform; console.log(a); - return a && "windows" === a.name.toLowerCase() && "7" === a.name.version[0] ? !0 : !1; + return a && "windows" === a.name.toLowerCase() && "7" === a.version[0] ? !0 : !1; } var f = $.Deferred(), g = '(svgGroup)(defs)', h = this.svgGroup.cloneNode(!0), k = this._skeleton.box(this), l = a ? 1 : 1.5, q = e() ? .85 : .95; console.log(e()); diff --git a/dist/entry.min.js b/dist/entry.min.js index 8caa338823..7ccddb6e6b 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1942,8 +1942,8 @@ b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none" this._observers;a.length;)a.pop().destroy()};b._changeFill=function(a){var b=this.getBoard();if(b.patternRect&&!b.dragBlock){var d=this._path,e=this._fillColor;a&&(b=this.getBoard(),b.setPatternRectFill(e),e="url(#blockHoverPattern_"+this.getBoard().suffix+")");d.attr({fill:e})}};b.addActivated=function(){this.svgGroup.addClass("activated")};b.removeActivated=function(){this.svgGroup.removeClass("activated")};b.reDraw=function(){if(this.visible){var a=this.block;requestAnimationFrame(this._updateContents.bind(this)); var b=a.params;if(b)for(var d=0;d\s+/g,">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.cloneNode(!0),k=this._skeleton.box(this),l=a?1:1.5,q=e()? -.85:.95;console.log(e());h.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X",-k.offsetX).replace("%Y",-k.offsetY).replace("%SCALE",l));for(var n=this.getBoard().svgDom.find("defs"),m=this.svgGroup.getBoundingClientRect(),r=h.getElementsByTagName("image"),k=h.getElementsByTagName("text"),u=["\u2265","\u2264"],t="\u2265\u2264-><=+-x/".split(""),l=0;l(svgGroup)(defs)',h=this.svgGroup.cloneNode(!0),k=this._skeleton.box(this),l=a?1:1.5,q=e()?.85:.95; +console.log(e());h.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X",-k.offsetX).replace("%Y",-k.offsetY).replace("%SCALE",l));for(var n=this.getBoard().svgDom.find("defs"),m=this.svgGroup.getBoundingClientRect(),r=h.getElementsByTagName("image"),k=h.getElementsByTagName("text"),u=["\u2265","\u2264"],t="\u2265\u2264-><=+-x/".split(""),l=0;l Date: Wed, 6 Jul 2016 16:56:40 +0900 Subject: [PATCH 18/31] adjustment --- dist/entry.js | 2 +- dist/entry.min.js | 2 +- src/workspace/block_view.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index cf58d99e5b..7741cc59e9 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -16241,7 +16241,7 @@ Entry.BlockView.pngMap = {}; console.log(a); return a && "windows" === a.name.toLowerCase() && "7" === a.version[0] ? !0 : !1; } - var f = $.Deferred(), g = '(svgGroup)(defs)', h = this.svgGroup.cloneNode(!0), k = this._skeleton.box(this), l = a ? 1 : 1.5, q = e() ? .85 : .95; + var f = $.Deferred(), g = '(svgGroup)(defs)', h = this.svgGroup.cloneNode(!0), k = this._skeleton.box(this), l = a ? 1 : 1.5, q = e() ? .88 : .95; console.log(e()); h.setAttribute("transform", "scale(%SCALE) translate(%X,%Y)".replace("%X", -k.offsetX).replace("%Y", -k.offsetY).replace("%SCALE", l)); for (var n = this.getBoard().svgDom.find("defs"), m = this.svgGroup.getBoundingClientRect(), r = h.getElementsByTagName("image"), k = h.getElementsByTagName("text"), u = ["\u2265", "\u2264"], t = "\u2265\u2264-><=+-x/".split(""), l = 0;l < k.length;l++) { diff --git a/dist/entry.min.js b/dist/entry.min.js index 7ccddb6e6b..4029b8e39d 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1942,7 +1942,7 @@ b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none" this._observers;a.length;)a.pop().destroy()};b._changeFill=function(a){var b=this.getBoard();if(b.patternRect&&!b.dragBlock){var d=this._path,e=this._fillColor;a&&(b=this.getBoard(),b.setPatternRectFill(e),e="url(#blockHoverPattern_"+this.getBoard().suffix+")");d.attr({fill:e})}};b.addActivated=function(){this.svgGroup.addClass("activated")};b.removeActivated=function(){this.svgGroup.removeClass("activated")};b.reDraw=function(){if(this.visible){var a=this.block;requestAnimationFrame(this._updateContents.bind(this)); var b=a.params;if(b)for(var d=0;d\s+/g,">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.cloneNode(!0),k=this._skeleton.box(this),l=a?1:1.5,q=e()?.85:.95; +0,0,b,c);var d=g.toDataURL("image/png");/\.png$/.test(a)&&(Entry.BlockView.pngMap[a]=d);e.resolve(d)};f.onerror=function(){e.reject("error occured")};f.src=a;return e.promise()}function e(){var a=window.platform;console.log(a);return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}var f=$.Deferred(),g='(svgGroup)(defs)',h=this.svgGroup.cloneNode(!0),k=this._skeleton.box(this),l=a?1:1.5,q=e()?.88:.95; console.log(e());h.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X",-k.offsetX).replace("%Y",-k.offsetY).replace("%SCALE",l));for(var n=this.getBoard().svgDom.find("defs"),m=this.svgGroup.getBoundingClientRect(),r=h.getElementsByTagName("image"),k=h.getElementsByTagName("text"),u=["\u2265","\u2264"],t="\u2265\u2264-><=+-x/".split(""),l=0;l Date: Wed, 6 Jul 2016 17:08:02 +0900 Subject: [PATCH 19/31] font weight applied --- dist/entry.js | 39 +++++++++++++++++-------------------- dist/entry.min.js | 12 ++++++------ src/workspace/block_view.js | 4 +--- 3 files changed, 25 insertions(+), 30 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 7741cc59e9..2ab119205a 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -16202,12 +16202,12 @@ Entry.BlockView.pngMap = {}; }; b.getDataUrl = function(a) { function b() { - g = g.replace("(svgGroup)", (new XMLSerializer).serializeToString(h)).replace("(defs)", (new XMLSerializer).serializeToString(n[0])).replace(/>\s+/g, ">").replace(/\s+\s+/g, ">").replace(/\s+\s+/g,">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.cloneNode(!0),k=this._skeleton.box(this),l=a?1:1.5,q=e()?.88:.95; -console.log(e());h.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X",-k.offsetX).replace("%Y",-k.offsetY).replace("%SCALE",l));for(var n=this.getBoard().svgDom.find("defs"),m=this.svgGroup.getBoundingClientRect(),r=h.getElementsByTagName("image"),k=h.getElementsByTagName("text"),u=["\u2265","\u2264"],t="\u2265\u2264-><=+-x/".split(""),l=0;l\s+/g,">").replace(/\s+(svgGroup)(defs)',g=this.svgGroup.cloneNode(!0),h=this._skeleton.box(this),k=a?1:1.5,l=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;g.setAttribute("transform", +"scale(%SCALE) translate(%X,%Y)".replace("%X",-h.offsetX).replace("%Y",-h.offsetY).replace("%SCALE",k));for(var q=this.getBoard().svgDom.find("defs"),n=this.svgGroup.getBoundingClientRect(),m=g.getElementsByTagName("image"),h=g.getElementsByTagName("text"),r=["\u2265","\u2264"],u="\u2265\u2264-><=+-x/".split(""),k=0;ke||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;f Date: Wed, 6 Jul 2016 18:18:24 +0900 Subject: [PATCH 20/31] dropdown dynamic --- dist/entry.js | 128 ++++++++++++------------- dist/entry.min.js | 22 ++--- src/container.js | 18 ++-- src/variable_container.js | 3 +- src/workspace/field/dropdownDynamic.js | 3 +- 5 files changed, 89 insertions(+), 85 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 2ab119205a..b96af5b0b2 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -6444,104 +6444,104 @@ Entry.Container.prototype.moveElementByBlock = function(b, a) { Entry.stage.sortZorder(); this.updateListView(); }; -Entry.Container.prototype.getDropdownList = function(b) { - var a = []; +Entry.Container.prototype.getDropdownList = function(b, a) { + var c = []; switch(b) { case "sprites": - var c = this.getCurrentObjects(), d = c.length; - for (b = 0;b < d;b++) { - var e = c[b]; - a.push([e.name, e.id]); + for (var d = this.getCurrentObjects(), e = d.length, f = 0;f < e;f++) { + a = d[f], c.push([a.name, a.id]); } break; case "spritesWithMouse": - c = this.getCurrentObjects(); - d = c.length; - for (b = 0;b < d;b++) { - e = c[b], a.push([e.name, e.id]); + d = this.getCurrentObjects(); + e = d.length; + for (f = 0;f < e;f++) { + a = d[f], c.push([a.name, a.id]); } - a.push([Lang.Blocks.mouse_pointer, "mouse"]); + c.push([Lang.Blocks.mouse_pointer, "mouse"]); break; case "spritesWithSelf": - c = this.getCurrentObjects(); - d = c.length; - for (b = 0;b < d;b++) { - e = c[b], a.push([e.name, e.id]); + d = this.getCurrentObjects(); + e = d.length; + for (f = 0;f < e;f++) { + a = d[f], c.push([a.name, a.id]); } - a.push([Lang.Blocks.self, "self"]); + c.push([Lang.Blocks.self, "self"]); break; case "collision": - a.push([Lang.Blocks.mouse_pointer, "mouse"]); - c = this.getCurrentObjects(); - d = c.length; - for (b = 0;b < d;b++) { - e = c[b], a.push([e.name, e.id]); + c.push([Lang.Blocks.mouse_pointer, "mouse"]); + d = this.getCurrentObjects(); + e = d.length; + for (f = 0;f < e;f++) { + a = d[f], c.push([a.name, a.id]); } - a.push([Lang.Blocks.wall, "wall"]); - a.push([Lang.Blocks.wall_up, "wall_up"]); - a.push([Lang.Blocks.wall_down, "wall_down"]); - a.push([Lang.Blocks.wall_right, "wall_right"]); - a.push([Lang.Blocks.wall_left, "wall_left"]); + c.push([Lang.Blocks.wall, "wall"]); + c.push([Lang.Blocks.wall_up, "wall_up"]); + c.push([Lang.Blocks.wall_down, "wall_down"]); + c.push([Lang.Blocks.wall_right, "wall_right"]); + c.push([Lang.Blocks.wall_left, "wall_left"]); break; case "pictures": - if (!Entry.playground.object) { + a = Entry.playground.object || a; + if (!a) { break; } - c = Entry.playground.object.pictures; - for (b = 0;b < c.length;b++) { - d = c[b], a.push([d.name, d.id]); + d = a.pictures; + for (f = 0;f < d.length;f++) { + e = d[f], c.push([e.name, e.id]); } break; case "messages": - c = Entry.variableContainer.messages_; - for (b = 0;b < c.length;b++) { - d = c[b], a.push([d.name, d.id]); + d = Entry.variableContainer.messages_; + for (f = 0;f < d.length;f++) { + e = d[f], c.push([e.name, e.id]); } break; case "variables": - c = Entry.variableContainer.variables_; - for (b = 0;b < c.length;b++) { - d = c[b], d.object_ && d.object_ != Entry.playground.object.id || a.push([d.getName(), d.getId()]); + d = Entry.variableContainer.variables_; + for (f = 0;f < d.length;f++) { + e = d[f], e.object_ && Entry.playground.object && e.object_ != Entry.playground.object.id || c.push([e.getName(), e.getId()]); } - a && 0 !== a.length || a.push([Lang.Blocks.VARIABLE_variable, "null"]); + c && 0 !== c.length || c.push([Lang.Blocks.VARIABLE_variable, "null"]); break; case "lists": - c = Entry.variableContainer.lists_; - for (b = 0;b < c.length;b++) { - d = c[b], a.push([d.getName(), d.getId()]); + d = Entry.variableContainer.lists_; + for (f = 0;f < d.length;f++) { + e = d[f], c.push([e.getName(), e.getId()]); } - a && 0 !== a.length || a.push([Lang.Blocks.VARIABLE_list, "null"]); + c && 0 !== c.length || c.push([Lang.Blocks.VARIABLE_list, "null"]); break; case "scenes": - c = Entry.scene.scenes_; - for (b = 0;b < c.length;b++) { - d = c[b], a.push([d.name, d.id]); + d = Entry.scene.scenes_; + for (f = 0;f < d.length;f++) { + e = d[f], c.push([e.name, e.id]); } break; case "sounds": - if (!Entry.playground.object) { + a = Entry.playground.object || a; + if (!a) { break; } - c = Entry.playground.object.sounds; - for (b = 0;b < c.length;b++) { - d = c[b], a.push([d.name, d.id]); + d = a.sounds; + for (f = 0;f < d.length;f++) { + e = d[f], c.push([e.name, e.id]); } break; case "clone": - a.push([Lang.Blocks.oneself, "self"]); - d = this.objects_.length; - for (b = 0;b < d;b++) { - e = this.objects_[b], a.push([e.name, e.id]); + c.push([Lang.Blocks.oneself, "self"]); + e = this.objects_.length; + for (f = 0;f < e;f++) { + a = this.objects_[f], c.push([a.name, a.id]); } break; case "objectSequence": - for (d = this.getCurrentObjects().length, b = 0;b < d;b++) { - a.push([(b + 1).toString(), b.toString()]); + for (e = this.getCurrentObjects().length, f = 0;f < e;f++) { + c.push([(f + 1).toString(), f.toString()]); } ; } - a.length || (a = [[Lang.Blocks.no_target, "null"]]); - return a; + c.length || (c = [[Lang.Blocks.no_target, "null"]]); + return c; }; Entry.Container.prototype.clearRunningState = function() { this.mapObject(function(b) { @@ -14683,7 +14683,7 @@ Entry.VariableContainer.prototype.updateCloudVariables = function() { } }; Entry.VariableContainer.prototype.addRef = function(b, a) { - if (this.view_ && Entry.playground.mainWorkspace.getMode() === Entry.Workspace.MODE_BOARD) { + if (this.view_ && Entry.playground.mainWorkspace && Entry.playground.mainWorkspace.getMode() === Entry.Workspace.MODE_BOARD) { var c = {object:a.getCode().object, block:a}; a.funcBlock && (c.funcBlock = a.funcBlock, delete a.funcBlock); this[b].push(c); @@ -14704,7 +14704,7 @@ Entry.VariableContainer.prototype.addRef = function(b, a) { } }; Entry.VariableContainer.prototype.removeRef = function(b, a) { - if (Entry.playground.mainWorkspace.getMode() === Entry.Workspace.MODE_BOARD) { + if (Entry.playground.mainWorkspace && Entry.playground.mainWorkspace.getMode() === Entry.Workspace.MODE_BOARD) { for (var c = this[b], d = 0;d < c.length;d++) { if (c[d].block == a) { c.splice(d, 1); @@ -17183,12 +17183,12 @@ Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); (function(b) { b.constructor = Entry.FieldDropDownDynamic; b._updateValue = function() { - var a = []; - Entry.container && (a = this._menuName ? Entry.container.getDropdownList(this._menuName) : this._menuGenerator()); - this._contents.options = a; - var a = this._contents.options, b = this.getValue(); - b && "null" != b || (b = 0 !== a.length ? a[0][1] : null); - this.setValue(b); + var a = this._block.getCode().object, b = []; + Entry.container && (b = this._menuName ? Entry.container.getDropdownList(this._menuName, a) : this._menuGenerator()); + this._contents.options = b; + b = this._contents.options; + (a = this.getValue()) && "null" != a || (a = 0 !== b.length ? b[0][1] : null); + this.setValue(a); }; b.renderOptions = function() { var a = this; diff --git a/dist/entry.min.js b/dist/entry.min.js index 80458f815d..99035454fb 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -701,10 +701,10 @@ Entry.Container.prototype.getObject=function(b){!b&&Entry.playground&&Entry.play Entry.Container.prototype.getVariable=function(b){for(var a=0;a Date: Thu, 7 Jul 2016 15:39:18 +0900 Subject: [PATCH 21/31] edit stage --- dist/entry.js | 19 +++++++++++----- dist/entry.min.js | 43 ++++++++++++++++++------------------ src/stage.js | 1 + src/workspace/block_view.js | 6 ++++- src/workspace/field/field.js | 1 + 5 files changed, 42 insertions(+), 28 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index b96af5b0b2..7210b85424 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -11228,11 +11228,13 @@ Entry.Stage.prototype.initStage = function(b) { this.render(); }; Entry.Stage.prototype.render = function() { - Entry.stage.timer && clearTimeout(Entry.stage.timer); - var b = (new Date).getTime(); - Entry.stage.update(); - b = (new Date).getTime() - b; - Entry.stage.timer = setTimeout(Entry.stage.render, 16 - b % 16 + 16 * Math.floor(b / 16)); + if (!Entry.stage.stopped) { + Entry.stage.timer && clearTimeout(Entry.stage.timer); + var b = (new Date).getTime(); + Entry.stage.update(); + b = (new Date).getTime() - b; + Entry.stage.timer = setTimeout(Entry.stage.render, 16 - b % 16 + 16 * Math.floor(b / 16)); + } }; Entry.Stage.prototype.update = function() { Entry.engine.isState("stop") && this.objectUpdated ? (this.canvas.update(), this.objectUpdated = !1) : this.canvas.update(); @@ -16013,6 +16015,7 @@ Entry.BlockView.pngMap = {}; this._board = this._board.code.board; }; b.destroy = function(a) { + $(this.svgGroup).unbind(".blockViewMousedown"); this._destroyObservers(); var b = this.svgGroup; a ? $(b).fadeOut(100, function() { @@ -16204,11 +16207,14 @@ Entry.BlockView.pngMap = {}; function b() { f = f.replace("(svgGroup)", (new XMLSerializer).serializeToString(g)).replace("(defs)", (new XMLSerializer).serializeToString(q[0])).replace(/>\s+/g, ">").replace(/\s+\s+/g,">").replace(/\s+(svgGroup)(defs)',g=this.svgGroup.cloneNode(!0),h=this._skeleton.box(this),k=a?1:1.5,l=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;g.setAttribute("transform", -"scale(%SCALE) translate(%X,%Y)".replace("%X",-h.offsetX).replace("%Y",-h.offsetY).replace("%SCALE",k));for(var q=this.getBoard().svgDom.find("defs"),n=this.svgGroup.getBoundingClientRect(),m=g.getElementsByTagName("image"),h=g.getElementsByTagName("text"),r=["\u2265","\u2264"],u="\u2265\u2264-><=+-x/".split(""),k=0;k\s+/g,">").replace(/\s+(svgGroup)(defs)',g=this.svgGroup.cloneNode(!0),h=this._skeleton.box(this),k=a?1:1.5,l=function(){var a=window.platform;return a&&"windows"=== +a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;g.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X",-h.offsetX).replace("%Y",-h.offsetY).replace("%SCALE",k));for(var q=this.getBoard().svgDom.find("defs"),n=this.svgGroup.getBoundingClientRect(),m=g.getElementsByTagName("image"),h=g.getElementsByTagName("text"),r=["\u2265","\u2264"],u="\u2265\u2264-><=+-x/".split(""),k=0;kb&&(d+="...");return d};b.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};b.getValue=function(){return this._block.params[this._index]};b.setValue=function(a,b){this.value!=a&&(this.value=a,this._block.params[this._index]=a,b&&this._blockView.reDraw())};b._isEditable=function(){if(this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1;var a=this._block.view,b=a.getBoard();if(!0===b.disableMouseEvent)return!1;var d=b.workspace.selectedBlockView; -if(!d||b!=d.getBoard())return!1;b=a.getSvgRoot();return b==d.svgGroup||$(b).has($(a.svgGroup))};b._selectBlockView=function(){var a=this._block.view;a.getBoard().setSelectedBlock(a)};b._bindRenderOptions=function(){var a=this;$(this.svgGroup).bind("mouseup touchend",function(b){a._isEditable()&&(a.destroyOption(),a._startValue=a.getValue(),a.renderOptions())})};b.pointer=function(a){a=a||[];a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)}})(Entry.Field.prototype);Entry.FieldAngle=function(b,a,c){this._block=a.block;this._blockView=a;this.box=new Entry.BoxModel;this.svgGroup=null;this.position=b.position;this._contents=b;this._index=c;b=this.getValue();this.setValue(this.modValue(void 0!==b?b:90));this.renderStart()};Entry.Utils.inherit(Entry.Field,Entry.FieldAngle); +(function(b){b.TEXT_LIMIT_LENGTH=20;b.destroy=function(){$(this.svgGroup).unbind("mouseup touchend");this.destroyOption()};b.command=function(){this._startValue&&(this._startValue===this.getValue()||this._blockView.isInBlockMenu||Entry.do("setFieldValue",this._block,this,this.pointer(),this._startValue,this.getValue()));delete this._startValue};b.destroyOption=function(){this.documentDownEvent&&(Entry.documentMousedown.detach(this.documentDownEvent),delete this.documentDownEvent);this.disposeEvent&& +(Entry.disposeEvent.detach(this.disposeEvent),delete this.documentDownEvent);this.optionGroup&&(this.optionGroup.remove(),delete this.optionGroup);this.command()};b._attachDisposeEvent=function(a){var b=this;b.disposeEvent=Entry.disposeEvent.attach(b,a||function(){b.destroyOption()})};b.align=function(a,b,d){var e=this.svgGroup;this._position&&(this._position.x&&(a=this._position.x),this._position.y&&(b=this._position.y));var f="translate("+a+","+b+")";void 0===d||d?e.animate({transform:f},300,mina.easeinout): +e.attr({transform:f});this.box.set({x:a,y:b})};b.getAbsolutePosFromBoard=function(){var a=this._block.view,b=a.getContentPos(),a=a.getAbsoluteCoordinate();return{x:a.x+this.box.x+b.x,y:a.y+this.box.y+b.y}};b.getAbsolutePosFromDocument=function(){var a=this._block.view,b=a.getContentPos(),d=a.getAbsoluteCoordinate(),a=a.getBoard().svgDom.offset();return{x:d.x+this.box.x+b.x+a.left,y:d.y+this.box.y+b.y+a.top}};b.getRelativePos=function(){var a=this._block.view.getContentPos(),b=this.box;return{x:b.x+ +a.x,y:b.y+a.y}};b.truncate=function(){var a=String(this.getValue()),b=this.TEXT_LIMIT_LENGTH,d=a.substring(0,b);a.length>b&&(d+="...");return d};b.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};b.getValue=function(){return this._block.params[this._index]};b.setValue=function(a,b){this.value!=a&&(this.value=a,this._block.params[this._index]=a,b&&this._blockView.reDraw())};b._isEditable=function(){if(this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1;var a= +this._block.view,b=a.getBoard();if(!0===b.disableMouseEvent)return!1;var d=b.workspace.selectedBlockView;if(!d||b!=d.getBoard())return!1;b=a.getSvgRoot();return b==d.svgGroup||$(b).has($(a.svgGroup))};b._selectBlockView=function(){var a=this._block.view;a.getBoard().setSelectedBlock(a)};b._bindRenderOptions=function(){var a=this;$(this.svgGroup).bind("mouseup touchend",function(b){a._isEditable()&&(a.destroyOption(),a._startValue=a.getValue(),a.renderOptions())})};b.pointer=function(a){a=a||[];a.unshift(this._index); +a.unshift(Entry.PARAM);return this._block.pointer(a)}})(Entry.Field.prototype);Entry.FieldAngle=function(b,a,c){this._block=a.block;this._blockView=a;this.box=new Entry.BoxModel;this.svgGroup=null;this.position=b.position;this._contents=b;this._index=c;b=this.getValue();this.setValue(this.modValue(void 0!==b?b:90));this.renderStart()};Entry.Utils.inherit(Entry.Field,Entry.FieldAngle); (function(b){b.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-input-field"});this.textElement=this.svgGroup.elem("text",{x:4,y:4,"font-size":"11px"});this.textElement.textContent=this.getText();var a=this.getTextWidth(),b=this.position&&this.position.y?this.position.y:0;this._header=this.svgGroup.elem("rect",{x:0,y:b-8,rx:3,ry:3,width:a,height:16,rx:3,ry:3,fill:"#fff","fill-opacity":.4});this.svgGroup.appendChild(this.textElement); this._bindRenderOptions();this.box.set({x:0,y:0,width:a,height:16})};b.renderOptions=function(){var a=this;this._attachDisposeEvent(function(){a.applyValue();a.destroyOption()});this.optionGroup=Entry.Dom("input",{class:"entry-widget-input-field",parent:$("body")});this.optionGroup.val(this.value);this.optionGroup.on("mousedown",function(a){a.stopPropagation()});this.optionGroup.on("keyup",function(b){var c=b.keyCode||b.which;a.applyValue(b);-1<[13,27].indexOf(c)&&a.destroyOption()});var b=this.getAbsolutePosFromDocument(); b.y-=this.box.height/2;this.optionGroup.css({height:16,left:b.x,top:b.y,width:a.box.width});this.optionGroup.select();this.svgOptionGroup=this.appendSvgOptionGroup();this.svgOptionGroup.elem("circle",{x:0,y:0,r:49,class:"entry-field-angle-circle"});this._dividerGroup=this.svgOptionGroup.elem("g");for(b=0;360>b;b+=15)this._dividerGroup.elem("line",{x1:49,y1:0,x2:49-(0===b%45?10:5),y2:0,transform:"rotate("+b+", 0, 0)",class:"entry-angle-divider"});b=this.getAbsolutePosFromBoard();b.x+=this.box.width/ diff --git a/src/stage.js b/src/stage.js index d4387bf07e..ae81e2ecbc 100644 --- a/src/stage.js +++ b/src/stage.js @@ -133,6 +133,7 @@ Entry.Stage.prototype.initStage = function(canvas) { this.render(); }; Entry.Stage.prototype.render = function() { + if (Entry.stage.stopped) return; if (Entry.stage.timer) clearTimeout(Entry.stage.timer); var time = new Date().getTime(); diff --git a/src/workspace/block_view.js b/src/workspace/block_view.js index 4b0fe3f685..fe23201432 100644 --- a/src/workspace/block_view.js +++ b/src/workspace/block_view.js @@ -689,6 +689,7 @@ Entry.BlockView.pngMap = {}; }; p.destroy = function(animate) { + $(this.svgGroup).unbind('.blockViewMousedown'); this._destroyObservers(); var svgGroup = this.svgGroup; @@ -1084,15 +1085,18 @@ Entry.BlockView.pngMap = {}; .replace('(defs)', new XMLSerializer().serializeToString( defs[0] )) .replace(/>\s+/g, ">").replace(/\s+ Date: Thu, 7 Jul 2016 15:50:02 +0900 Subject: [PATCH 22/31] save as image lang --- dist/entry.js | 4 +-- dist/entry.min.js | 50 ++++++++++++++++++------------------- src/workspace/block_view.js | 2 +- src/workspace/board.js | 2 +- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 7210b85424..1724dbdc6d 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -15935,7 +15935,7 @@ Entry.BlockView.pngMap = {}; h.block.copyToClipboard(); }}, q = {text:Lang.Blocks.Delete_Blocks, enable:k.isDeletable(), callback:function() { Entry.do("destroyBlock", h.block); - }}, n = {text:"\uc774\ubbf8\uc9c0\ub85c \uc800\uc7a5\ud558\uae30", callback:function() { + }}, n = {text:Lang.Menus.save_as_image, callback:function() { h.downloadAsImage(); }}; f.push(g); @@ -18418,7 +18418,7 @@ Entry.Board.OPTION_DOWNLOAD = 3; a.alignThreads(); }}}, {activated:!0, option:{text:Lang.Blocks.Clear_all_blocks, callback:function() { a.code.clear(); - }}}, {activated:"workspace" === Entry.type && Entry.Utils.isChrome(), option:{text:"\ubaa8\ub4e0 \ube14\ub7ed \uc774\ubbf8\uc9c0\ub85c \uc800\uc7a5\ud558\uae30", enable:!0, callback:function() { + }}}, {activated:"workspace" === Entry.type && Entry.Utils.isChrome(), option:{text:Lang.Menus.save_as_image_all, enable:!0, callback:function() { a.code.getThreads().forEach(function(a) { (a = a.getFirstBlock()) && a.view.downloadAsImage(); }); diff --git a/dist/entry.min.js b/dist/entry.min.js index c2231ff75b..767fd18ab4 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1924,28 +1924,28 @@ b.onMouseDown=function(a){function c(a){a.stopPropagation();var c=e.workspace.ge Entry.DRAG_MODE_DRAG,m.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(m,c),a=!0),this.animating&&this.set({animating:!1}),0===m.dragInstance.height&&m.dragInstance.set({height:-1+m.height}),c=m.dragInstance,m._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),m.originPos||(m.originPos={x:m.x,y:m.y}),a&&e.generateCodeMagnetMap(),m._updateCloseBlock()))}function d(a){$(document).unbind(".block");m.terminateDrag(a);e&&e.set({dragBlock:null}); m._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete m.dragInstance}a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();this._changeFill(!1);var e=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(a);if(!this.readOnly&&!e.viewOnly){e.setSelectedBlock(this);this.dominate();if(0===a.button||a.originalEvent&&a.originalEvent.touches){var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;this.mouseDownCoordinate= {x:f.pageX,y:f.pageY};var g=$(document);g.bind("mousemove.block touchmove.block",c);g.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:f.pageX,startY:f.pageY,offsetX:f.pageX,offsetY:f.pageY,height:0,mode:!0});e.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN}else if(Entry.Utils.isRightButton(a)){var h=this,k=h.block;if(this.isInBlockMenu)return;f=[];var g={text:Lang.Blocks.Duplication_option,enable:this.copyable,callback:function(){Entry.do("cloneBlock", -k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},q={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},n={text:"\uc774\ubbf8\uc9c0\ub85c \uc800\uc7a5\ud558\uae30",callback:function(){h.downloadAsImage()}};f.push(g);f.push(l);f.push(q);Entry.Utils.isChrome()&&"workspace"==Entry.type&&f.push(n);Entry.ContextMenu.show(f)}var m=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&& -a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof -Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(d===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg;a=!1;var h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode=d,b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE, -Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x, -d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"),f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}b.setMagnetedBlock(null);a&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};b._updateCloseBlock=function(){var a=this.getBoard(),b;if(this._skeleton.magnets){for(var d in this.magnet)if(b="next"===d?this.getBoard().getNearestMagnet(this.x,this.y+this.getBelowHeight(), -d):this.getBoard().getNearestMagnet(this.x,this.y,d))return a.setMagnetedBlock(b.view,d);a.setMagnetedBlock(null)}};b.dominate=function(){this.block.getThread().view.dominate()};b.getSvgRoot=function(){for(var a=this.getBoard().svgBlockGroup,b=this.svgGroup;b.parentNode!==a;)b=b.parentNode;return b};b.getBoard=function(){return this._board};b._setBoard=function(){this._board=this._board.code.board};b.destroy=function(a){$(this.svgGroup).unbind(".blockViewMousedown");this._destroyObservers();var b= -this.svgGroup;a?$(b).fadeOut(100,function(){b.remove()}):b.remove();this._contents.forEach(function(a){a.constructor!==Entry.Block&&a.destroy()});var d=this.block;a=d.events.viewDestroy;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(d)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};b.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow)); -return this._shadow};b.destroyShadow=function(){this._shadow&&(this._shadow.remove(),delete this._shadow)};b._updateMagnet=function(){if(this._skeleton.magnets){var a=this._skeleton.magnets(this);a.next&&this._nextGroup.attr("transform","translate("+a.next.x+","+a.next.y+")");this.magnet=a;this.block.getThread().changeEvent.notify()}};b._updateBG=function(){if(this._board.dragBlock&&this._board.dragBlock.dragInstance){var a=this.svgGroup;if(this.magnet.next){if(a=this.magneting){var b=this._board.dragBlock.getShadow(), -d=this.getAbsoluteCoordinate(),e;if("previous"===a)e=this.magnet.next,e="translate("+(d.x+e.x)+","+(d.y+e.y)+")";else if("next"===a){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(d.x+e.x)+","+(d.y+e.y-f)+")"}$(b).attr({transform:e,display:"block"});this._clonedShadow=b;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===a&&(a=this._board.dragBlock.getBelowHeight()+this.offsetY, -this.originalHeight=this.offsetY,this.set({offsetY:a}))}else this._clonedShadow&&(this._clonedShadow.attr({display:"none"}),delete this._clonedShadow),a=this.originalHeight,void 0!==a&&(this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground),this.set({offsetY:a}),delete this.originalHeight);(a=this.block.thread.changeEvent)&&a.notify()}else this.magneting?(a.attr({filter:"url(#entryBlockHighlightFilter_"+this.getBoard().suffix+")"}), -a.addClass("outputHighlight")):(a.removeClass("outputHighlight"),a.removeAttr("filter"))}};b.addDragging=function(){this.svgGroup.addClass("dragging")};b.removeDragging=function(){this.svgGroup.removeClass("dragging")};b.addSelected=function(){this.svgGroup.addClass("selected")};b.removeSelected=function(){this.svgGroup.removeClass("selected")};b.getSkeleton=function(){return this._skeleton};b.getContentPos=function(){return this._skeleton.contentPos(this)};b.renderText=function(){this._startContentRender(Entry.Workspace.MODE_VIMBOARD)}; -b.renderBlock=function(){this._startContentRender(Entry.Workspace.MODE_BOARD)};b._updateOpacity=function(){this.svgGroup.attr({opacity:!1===this.visible?0:1});this.visible&&this._setPosition()};b._updateShadow=function(){this.shadow&&Entry.Utils.colorDarken(this._schema.color,.7)};b._setMovable=function(){this.movable=null!==this.block.isMovable()?this.block.isMovable():void 0!==this._skeleton.movable?this._skeleton.movable:!0};b._setReadOnly=function(){this.readOnly=null!==this.block.isReadOnly()? -this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly:!1};b._setCopyable=function(){this.copyable=null!==this.block.isCopyable()?this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable:!0};b.bumpAway=function(a,b){var d=this;a=a||15;b?window.setTimeout(function(){d._moveBy(a,a,!1)},b):d._moveBy(a,a,!1)};b.bindPrev=function(a){if(a){if(this._toLocalCoordinate(a.view._nextGroup),(a=a.getNextBlock())&&a!==this.block){var b=this.block.getLastBlock(); -b.view.magnet.next?a.view._toLocalCoordinate(b.view._nextGroup):(a.view._toGlobalCoordinate(),a.separate(),a.view.bumpAway(null,100))}}else if(a=this.block.getPrevBlock())this._toLocalCoordinate(a.view._nextGroup),(a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)};b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y; -return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()};b._updateColor=function(){var a=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g,">").replace(/\s+(svgGroup)(defs)',g=this.svgGroup.cloneNode(!0),h=this._skeleton.box(this),k=a?1:1.5,l=function(){var a=window.platform;return a&&"windows"=== -a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;g.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X",-h.offsetX).replace("%Y",-h.offsetY).replace("%SCALE",k));for(var q=this.getBoard().svgDom.find("defs"),n=this.svgGroup.getBoundingClientRect(),m=g.getElementsByTagName("image"),h=g.getElementsByTagName("text"),r=["\u2265","\u2264"],u="\u2265\u2264-><=+-x/".split(""),k=0;k\s+/g,">").replace(/\s+(svgGroup)(defs)',g=this.svgGroup.cloneNode(!0),h=this._skeleton.box(this),k=a?1:1.5,l=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;g.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X",-h.offsetX).replace("%Y",-h.offsetY).replace("%SCALE", +k));for(var q=this.getBoard().svgDom.find("defs"),n=this.svgGroup.getBoundingClientRect(),m=g.getElementsByTagName("image"),h=g.getElementsByTagName("text"),r=["\u2265","\u2264"],u="\u2265\u2264-><=+-x/".split(""),k=0;ke||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;f Date: Fri, 8 Jul 2016 09:43:35 +0900 Subject: [PATCH 23/31] remove useless --- dist/entry.js | 12 +++++------- dist/entry.min.js | 2 +- src/stage.js | 1 - 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 1724dbdc6d..0c76f73896 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -11228,13 +11228,11 @@ Entry.Stage.prototype.initStage = function(b) { this.render(); }; Entry.Stage.prototype.render = function() { - if (!Entry.stage.stopped) { - Entry.stage.timer && clearTimeout(Entry.stage.timer); - var b = (new Date).getTime(); - Entry.stage.update(); - b = (new Date).getTime() - b; - Entry.stage.timer = setTimeout(Entry.stage.render, 16 - b % 16 + 16 * Math.floor(b / 16)); - } + Entry.stage.timer && clearTimeout(Entry.stage.timer); + var b = (new Date).getTime(); + Entry.stage.update(); + b = (new Date).getTime() - b; + Entry.stage.timer = setTimeout(Entry.stage.render, 16 - b % 16 + 16 * Math.floor(b / 16)); }; Entry.Stage.prototype.update = function() { Entry.engine.isState("stop") && this.objectUpdated ? (this.canvas.update(), this.objectUpdated = !1) : this.canvas.update(); diff --git a/dist/entry.min.js b/dist/entry.min.js index 767fd18ab4..cbbd2a6674 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1074,7 +1074,7 @@ Entry.Stage.prototype.initStage=function(b){this.canvas=new createjs.Stage(b.id) function(a){Entry.dispatchEvent("canvasClick",a);Entry.stage.isClick=!0},b.ontouchend=function(a){Entry.stage.isClick=!1;Entry.dispatchEvent("canvasClickCanceled",a)};else{var a=function(a){Entry.dispatchEvent("canvasClick",a);Entry.stage.isClick=!0};b.onmousedown=a;b.ontouchstart=a;a=function(a){Entry.stage.isClick=!1;Entry.dispatchEvent("canvasClickCanceled",a)};b.onmouseup=a;b.ontouchend=a;$(document).click(function(a){Entry.stage.focused="entryCanvas"===a.target.id?!0:!1})}Entry.addEventListener("canvasClick", function(a){Entry.stage.isObjectClick=!1});a=function(a){a.preventDefault();var b=this.getBoundingClientRect(),e;-1 Date: Fri, 8 Jul 2016 13:06:23 +0900 Subject: [PATCH 24/31] text block icon --- images/block_icon/text.png | Bin 0 -> 547 bytes src/workspace/block_entry.js | 34 +++++++++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 images/block_icon/text.png diff --git a/images/block_icon/text.png b/images/block_icon/text.png new file mode 100644 index 0000000000000000000000000000000000000000..1af21314b7b505b011729c2d164060939eabc3c2 GIT binary patch literal 547 zcmV+;0^I$HP);aURpXM@5IXV}*v^KyKtO)Fn+t45y0}1VAo=}~k&>aS<1Jsb#XKI)!nSca z9g|*~vRx;qxxn?&a0<(h6%)=L&yW-^seWbwX)$=h5&=J@>EA2XvG6lgp)JVr5qM6Khn4*ZRE7?pBI*TZNq6Jy`0 zILEtZEnQf|3~jCJ8TAb91IgF+dXn9?;34J$>LTb`))v(0D#QXJfB(~61^$R>V@)GV l9clp@N=@n^I^u5u1_1R{v@+iBviSf2002ovPDHLkV1fWt^C|!U literal 0 HcmV?d00001 diff --git a/src/workspace/block_entry.js b/src/workspace/block_entry.js index fa8ca2d002..510745dbb5 100644 --- a/src/workspace/block_entry.js +++ b/src/workspace/block_entry.js @@ -14355,6 +14355,11 @@ Entry.block = { { "type": "Block", "accept": "string" + }, + { + "type": "Indicator", + "img": "block_icon/text.png", + "size": 12 } ], "events": {}, @@ -14363,7 +14368,8 @@ Entry.block = { { "type": "text", "params": [ Lang.Blocks.entry ] - } + }, + null ], "type": "text_write" }, @@ -14387,6 +14393,11 @@ Entry.block = { { "type": "Block", "accept": "string" + }, + { + "type": "Indicator", + "img": "block_icon/text.png", + "size": 12 } ], "events": {}, @@ -14395,7 +14406,8 @@ Entry.block = { { "type": "text", "params": [ Lang.Blocks.entry ] - } + }, + null ], "type": "text_append" }, @@ -14419,6 +14431,11 @@ Entry.block = { { "type": "Block", "accept": "string" + }, + { + "type": "Indicator", + "img": "block_icon/text.png", + "size": 12 } ], "events": {}, @@ -14427,7 +14444,8 @@ Entry.block = { { "type": "text", "params": [ Lang.Blocks.entry ] - } + }, + null ], "type": "text_prepend" }, @@ -14447,10 +14465,16 @@ Entry.block = { "color": "#FFCA36", "skeleton": "basic", "statements": [], - "params": [], + "params": [ + { + "type": "Indicator", + "img": "block_icon/text.png", + "size": 12 + } + ], "events": {}, "def": { - "params": [], + "params": [null], "type": "text_flush" }, "class": "text", From cea59cb7363058eef7c4eb3eedd0a821a6d3e87e Mon Sep 17 00:00:00 2001 From: vivid Date: Fri, 8 Jul 2016 13:06:59 +0900 Subject: [PATCH 25/31] missing min --- dist/entry.min.js | 194 +++++++++++++++++++++++----------------------- 1 file changed, 97 insertions(+), 97 deletions(-) diff --git a/dist/entry.min.js b/dist/entry.min.js index cbbd2a6674..c5fc34613f 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1758,103 +1758,103 @@ func:function(b,a){return a.callReturn()},event:"when_message_cast"},message_cas null],type:"message_cast"},paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){var c=a.getField("VALUE",a),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",c]);return a.callReturn()}},message_cast_wait:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages", fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast_wait"},paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){if(a.runningScript){for(var c=a.runningScript,d=c.length,e=0;ec.array_.length)throw Error("can not remove value from array");c.array_.splice(d-1,1);c.updateView();return a.callReturn()}},insert_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE}, -{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"text",params:["10"]},null,{type:"text",params:["1"]},null],type:"insert_value_to_list"},paramsKeyMap:{DATA:0,LIST:1,INDEX:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST", -a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||0==e||e>c.array_.length+1)throw Error("can not insert value to array");c.array_.splice(e-1,0,{data:d});c.updateView();return a.callReturn()}},change_value_list_index:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Block",accept:"string"}, -{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"change_value_list_index"},paramsKeyMap:{LIST:0,INDEX:1,DATA:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA", -a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||e>c.array_.length)throw Error("can not insert value to array");c.array_[e-1].data=d;c.updateView();return a.callReturn()}},value_of_index_from_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text", -text:Lang.Blocks.VARIABLE_value_of_index_from_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"number",params:["1"]}],type:"value_of_index_from_list"},paramsKeyMap:{LIST:1,INDEX:3},"class":"list_element", -isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b),d=Entry.getListRealIndex(d,c);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not insert value to array");return c.array_[d-1].data}},length_of_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11, -arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_2,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null],type:"length_of_list"},paramsKeyMap:{LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);return Entry.variableContainer.getList(c, -b).array_.length}},show_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"show_list"},paramsKeyMap:{LIST:0}, -"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!0);return a.callReturn()}},hide_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs", -b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"hide_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!1);return a.callReturn()}},options_for_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["\uccab\ubc88\uc9f8","FIRST"],["\ub9c8\uc9c0\ub9c9", -"LAST"],["\ubb34\uc791\uc704","RANDOM"]],value:"FIRST",fontSize:11}],events:{},def:{params:[null]},paramsKeyMap:{OPERATOR:0},func:function(b,a){return a.getField("OPERATOR",a)}},set_visible_answer:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_timer_visible_show,"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]],value:"SHOW",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}], -events:{viewAdd:[function(b){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}]},def:{params:["HIDE",null],type:"set_visible_answer"},paramsKeyMap:{BOOL:0},"class":"ask",isNotFor:[],func:function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return a.callReturn()}},is_included_in_list:{color:"#E457DC",skeleton:"basic_boolean_field",statements:[], -params:[{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer; -a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"text",params:["10"]},null],type:"is_included_in_list"},paramsKeyMap:{LIST:1,DATA:3},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getStringValue("DATA",a),c=Entry.variableContainer.getList(c,b);if(!c)return!1;for(var c=c.array_,e=0,f=c.length;ek&&(k=Math.round(k-155),g=-k,h=0,Entry.dplay.vel_value=g);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c, -g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,g),Entry.hw.setDigitalPortValue(f,h),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var l=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(l)},50);Entry.dplay.timeouts.push(l);return a}}},dplay_buzzer:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub514\uc9c0\ud138 10\ubc88 \ubd80\uc800\ub97c %1 %2 %3 \ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30", +def:{params:[],type:"text"},paramsKeyMap:{NAME:0},func:function(b,a){return a.getField("NAME",a)},isPrimitive:!0},text_write:{color:"#FFCA36",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/text.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.entry]},null],type:"text_write"},paramsKeyMap:{VALUE:0},"class":"text",isNotFor:["sprite"],func:function(b,a){var c=a.getStringValue("VALUE",a),c=Entry.convertToRoundedDecimals(c, +3);b.setText(c);return a.callReturn()}},text_append:{color:"#FFCA36",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/text.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.entry]},null],type:"text_append"},paramsKeyMap:{VALUE:0},"class":"text",isNotFor:["sprite"],func:function(b,a){var c=a.getStringValue("VALUE",a);b.setText(Entry.convertToRoundedDecimals(b.getText(),3)+Entry.convertToRoundedDecimals(c,3));return a.callReturn()}}, +text_prepend:{color:"#FFCA36",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/text.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.entry]},null],type:"text_prepend"},paramsKeyMap:{VALUE:0},"class":"text",isNotFor:["sprite"],func:function(b,a){var c=a.getStringValue("VALUE",a);b.setText(Entry.convertToRoundedDecimals(c,3)+Entry.convertToRoundedDecimals(b.getText(),3));return a.callReturn()}},text_flush:{color:"#FFCA36", +skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/text.png",size:12}],events:{},def:{params:[null],type:"text_flush"},"class":"text",isNotFor:["sprite"],func:function(b,a){b.setText("");return a.callReturn()}},variableAddButton:{skeleton:"basic_button",color:"#eee",params:[{type:"Text",text:Lang.Workspace.variable_create,color:"#333",align:"center"}],events:{mousedown:[function(){Entry.variableContainer.openVariableAddPanel("variable")}]}},listAddButton:{skeleton:"basic_button", +color:"#eee",params:[{type:"Text",text:Lang.Workspace.create_list_block,color:"#333",align:"center"}],events:{mousedown:[function(){Entry.variableContainer.openVariableAddPanel("list")}]}},change_variable:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"variables",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a= +Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,{type:"text",params:["10"]},null],type:"change_variable"},paramsKeyMap:{VARIABLE:0,VALUE:1},"class":"variable",isNotFor:["variable","variableNotExist"],func:function(b,a){var c=a.getField("VARIABLE",a),d=a.getNumberValue("VALUE",a),e=0,d=Entry.parseNumber(d);if(0==d&&"boolean"==typeof d)throw Error("Type is not correct");c=Entry.variableContainer.getVariable(c, +b);e=Entry.getMaxFloatPoint([d,c.getValue()]);c.setValue((d+c.getValue()).toFixed(e));return a.callReturn()}},set_variable:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"variables",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a= +Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,{type:"text",params:["10"]},null],type:"set_variable"},paramsKeyMap:{VARIABLE:0,VALUE:1},"class":"variable",isNotFor:["variable","variableNotExist"],func:function(b,a){var c=a.getField("VARIABLE",a),d=a.getValue("VALUE",a);Entry.variableContainer.getVariable(c,b).setValue(d);return a.callReturn()}},show_variable:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"variables", +fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"show_variable"},paramsKeyMap:{VARIABLE:0},"class":"variable_visibility",isNotFor:["variable","variableNotExist"],func:function(b,a){var c=a.getField("VARIABLE",a),c=Entry.variableContainer.getVariable(c, +b);c.setVisible(!0);c.updateView();return a.callReturn()}},hide_variable:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"variables",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null, +null],type:"hide_variable"},paramsKeyMap:{VARIABLE:0},"class":"variable_visibility",isNotFor:["variable","variableNotExist"],func:function(b,a){var c=a.getField("VARIABLE",a);Entry.variableContainer.getVariable(c,b).setVisible(!1);return a.callReturn()}},get_variable:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"variables",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_get_variable_1, +color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null],type:"get_variable"},paramsKeyMap:{VARIABLE:0},"class":"variable",isNotFor:["variable","variableNotExist"],func:function(b,a){var c=a.getField("VARIABLE",a);return Entry.variableContainer.getVariable(c,b).getValue()}},ask_and_wait:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block", +accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{viewAdd:[function(){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}]},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null],type:"ask_and_wait"},paramsKeyMap:{VALUE:0},"class":"ask",isNotFor:[],func:function(b,a){var c=Entry.container.inputValue,d=Entry.stage.inputField,e=a.getValue("VALUE",a);if(!e)throw Error("message can not be empty"); +if(c.sprite==b&&d&&!d._isHidden)return b.dialog||(e=Entry.convertToRoundedDecimals(e,3),new Entry.Dialog(b,e,"speak")),a;if(c.sprite!=b&&a.isInit)return b.dialog&&b.dialog.remove(),delete a.isInit,a.callReturn();if(c.complete&&c.sprite==b&&d._isHidden&&a.isInit)return b.dialog&&b.dialog.remove(),delete c.complete,delete a.isInit,a.callReturn();e=Entry.convertToRoundedDecimals(e,3);new Entry.Dialog(b,e,"speak");Entry.stage.showInputField();c.script=a;c.sprite=b;a.isInit=!0;return a}},get_canvas_input_value:{color:"#E457DC", +skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_get_canvas_input_value,color:"#fff"}],events:{viewAdd:[function(){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}]},def:{params:[null],type:"get_canvas_input_value"},"class":"ask",isNotFor:[],func:function(b,a){return Entry.container.getInputValue()}},add_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block", +accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"text",params:["10"]},null,null],type:"add_value_to_list"},paramsKeyMap:{VALUE:0,LIST:1},"class":"list",isNotFor:["list", +"listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("VALUE",a),c=Entry.variableContainer.getList(c,b);c.array_||(c.array_=[]);c.array_.push({data:d});c.updateView();return a.callReturn()}},remove_value_from_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a= +Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"number",params:["1"]},null,null],type:"remove_value_from_list"},paramsKeyMap:{VALUE:0,LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("VALUE",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not remove value from array"); +c.array_.splice(d-1,1);c.updateView();return a.callReturn()}},insert_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer; +a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"text",params:["10"]},null,{type:"text",params:["1"]},null],type:"insert_value_to_list"},paramsKeyMap:{DATA:0,LIST:1,INDEX:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||0==e||e>c.array_.length+1)throw Error("can not insert value to array");c.array_.splice(e-1,0,{data:d});c.updateView(); +return a.callReturn()}},change_value_list_index:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs", +b)}]},def:{params:[null,{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"change_value_list_index"},paramsKeyMap:{LIST:0,INDEX:1,DATA:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||e>c.array_.length)throw Error("can not insert value to array");c.array_[e-1].data=d;c.updateView();return a.callReturn()}},value_of_index_from_list:{color:"#E457DC", +skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs", +b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"number",params:["1"]}],type:"value_of_index_from_list"},paramsKeyMap:{LIST:1,INDEX:3},"class":"list_element",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b),d=Entry.getListRealIndex(d,c);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not insert value to array");return c.array_[d- +1].data}},length_of_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_2,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs", +b)}]},def:{params:[null,null,null],type:"length_of_list"},paramsKeyMap:{LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);return Entry.variableContainer.getList(c,b).array_.length}},show_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a= +Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"show_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!0);return a.callReturn()}},hide_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists", +fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"hide_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!1); +return a.callReturn()}},options_for_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["\uccab\ubc88\uc9f8","FIRST"],["\ub9c8\uc9c0\ub9c9","LAST"],["\ubb34\uc791\uc704","RANDOM"]],value:"FIRST",fontSize:11}],events:{},def:{params:[null]},paramsKeyMap:{OPERATOR:0},func:function(b,a){return a.getField("OPERATOR",a)}},set_visible_answer:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_timer_visible_show, +"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]],value:"SHOW",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{viewAdd:[function(b){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}]},def:{params:["HIDE",null],type:"set_visible_answer"},paramsKeyMap:{BOOL:0},"class":"ask",isNotFor:[],func:function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1): +Entry.container.inputValue.setVisible(!0);return a.callReturn()}},is_included_in_list:{color:"#E457DC",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_3, +color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"text",params:["10"]},null],type:"is_included_in_list"},paramsKeyMap:{LIST:1,DATA:3},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getStringValue("DATA",a),c=Entry.variableContainer.getList(c,b);if(!c)return!1;for(var c= +c.array_,e=0,f=c.length;ek&&(k=Math.round(k-155),g=-k,h=0,Entry.dplay.vel_value=g);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11, +0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,g),Entry.hw.setDigitalPortValue(f,h),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var l=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(l)},50);Entry.dplay.timeouts.push(l);return a}}},dplay_buzzer:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub514\uc9c0\ud138 10\ubc88 \ubd80\uc800\ub97c %1 %2 %3 \ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30", params:[{type:"Dropdown",options:[["\ub3c4","1"],["\ub3c4#","2"],["\ub808","3"],["\ubbf8b","4"],["\ubbf8","5"],["\ud30c","6"],["\ud30c#","7"],["\uc194","8"],["\uc194#","9"],["\ub77c","10"],["\uc2dcb","11"],["\uc2dc","12"],["\ubb34\uc74c","100"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", size:12}],events:{},def:{params:["1","1",{type:"text",params:["0.5"]},null],type:"dplay_buzzer"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;Entry.hw.setDigitalPortValue(10,100);delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;return a.callReturn()}var c=a.getNumberField("NOTE",a),d=a.getNumberField("OCTAVE",a),e=a.getNumberValue("VALUE"),d=c+12*(d-1),e=6E4*e/60;a.isStart=!0;a.timeFlag=1;100== c?Entry.hw.setDigitalPortValue(10,100):Entry.hw.setDigitalPortValue(10,d);if(100 Date: Fri, 8 Jul 2016 16:25:23 +0900 Subject: [PATCH 26/31] clone option for for extracting --- dist/entry.js | 56 ++++++++++++++--------------- dist/entry.min.js | 72 ++++++++++++++++++------------------- src/workspace/block_view.js | 6 ++-- 3 files changed, 67 insertions(+), 67 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 0c76f73896..4cc1d7ab2d 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -16201,20 +16201,20 @@ Entry.BlockView.pngMap = {}; b.getParam = function(a) { return this._paramMap[a]; }; - b.getDataUrl = function(a) { - function b() { - f = f.replace("(svgGroup)", (new XMLSerializer).serializeToString(g)).replace("(defs)", (new XMLSerializer).serializeToString(q[0])).replace(/>\s+/g, ">").replace(/\s+\s+/g, ">").replace(/\s+>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.move_line=function(){this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").moveTo(this.oldPt.x,this.oldPt.y).lineTo(this.stage.mouseX,this.stage.mouseY);this.file.modified=!0;this.stage.update()}; @@ -968,13 +968,13 @@ e.addClass("entryPlaygroundPainterAttrResizeXTop");e.innerHTML="X";c.appendChild c.innerHTML="x";d.appendChild(c);c=Entry.createElement("div");c.addClass("entryPlaygroundAttrReiszeY");d.appendChild(c);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrResizeYTop");d.innerHTML="Y";c.appendChild(d);this.objectHeightInput=Entry.createElement("input","entryPainterAttrHeight");this.objectHeightInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;a.handle.height=this.value;a.updateImageHandle()}; this.objectHeightInput.addClass("entryPlaygroundPainterNumberInput");c.appendChild(this.objectHeightInput);this.attrRotateArea=Entry.createElement("div","painterAttrRotateArea");this.attrRotateArea.addClass("painterAttrRotateArea");g.appendChild(this.attrRotateArea);d=Entry.createElement("div");d.addClass("painterAttrRotateName");d.innerHTML=Lang.Workspace.picture_rotation;this.attrRotateArea.appendChild(d);d=Entry.createElement("fieldset","entryPainterAttrRotate");d.addClass("entryPlaygroundPainterAttrRotate"); this.attrRotateArea.appendChild(d);c=Entry.createElement("div");c.addClass("painterAttrRotateTop");c.innerHTML="\u03bf";d.appendChild(c);this.objectRotateInput=Entry.createElement("input","entryPainterAttrDegree");this.objectRotateInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;360<=this.value?this.value%=360:0>this.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); -this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var q=Entry.createElement("div");q.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(q);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); +this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var n=Entry.createElement("div");n.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(n);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); Entry.getColourCodes().forEach(function(b){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=b;c.bindOnClick(function(c){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= -b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});q.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); -var n=Entry.createElement("fieldset","entryPainterAttrThick");n.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(n);d=Entry.createElement("div");d.addClass("paintAttrThickTop");n.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);n.appendChild(e); -d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);n.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;n.bindOnClick(function(){m.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(a){n.style.zIndex= +b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});n.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); +var q=Entry.createElement("fieldset","entryPainterAttrThick");q.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(q);d=Entry.createElement("div");d.addClass("paintAttrThickTop");q.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);q.appendChild(e); +d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);q.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;q.bindOnClick(function(){m.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); +g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(a){q.style.zIndex= "1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", "entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); @@ -1117,8 +1117,8 @@ this.definition.params.push(this.def.params[this.def.index[b]]):this.definition. this.definition.params.push(null),this._addToParamsKeyMap(b)):a.constructor==Blockly.FieldKeydownInput?(this.params.push({type:"Keyboard",value:81}),this.templates.push(this.getFieldCount()),void 0!==this.def.index[b]?this.definition.params.push(this.def.params[this.def.index[b]]):this.definition.params.push(void 0),this._addToParamsKeyMap(b)):a.constructor==Blockly.FieldColour?(this.params.push({type:"Color"}),this.templates.push(this.getFieldCount()),this._addToParamsKeyMap(b)):console.log("else", a);return this};b.setColour=function(a){this.color=a};b.setInputsInline=function(){};b.setOutput=function(a,b){a&&(this.output=b)};b.setPreviousStatement=function(a){this.isPrev=a};b.setNextStatement=function(a){this.isNext=a};b.setEditable=function(a){};b.getFieldCount=function(){this.fieldCount++;return"%"+this.fieldCount};b._addToParamsKeyMap=function(a){a=a?a:"dummy_"+Entry.Utils.generateId();var b=this.paramsKeyMap;b[a]=Object.keys(b).length};b._addToStatementsKeyMap=function(a){a=a?a:"dummy_"+ Entry.Utils.generateId();var b=this.statementsKeyMap;b[a]=Object.keys(b).length}})(Entry.BlockMockup.prototype);Entry.ContextMenu={}; -(function(b){b.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});Entry.Utils.disableContextmenu(this.dom);Entry.documentMousedown.attach(this,function(){this.hide()})};b.show=function(a,b){this.dom||this.createDom();if(0!==a.length){var d=this;void 0!==b&&(this._className=b,this.dom.addClass(b));var e=this.dom;e.empty();for(var f=0,g=a.length;fg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;dg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;d=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; Entry.Utils.colorDarken=function(b,a){function c(a){2!=a.length&&(a="0"+a);return a}var d,e,f;7===b.length?(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),f=parseInt(b.substr(5,2),16)):(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),f=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;d=c(Math.floor(d*a).toString(16));e=c(Math.floor(e*a).toString(16));f=c(Math.floor(f*a).toString(16));return"#"+d+e+f}; Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;var c=Entry.Utils.hexToHsl(b);c.l+=a/100;c.l=Math.min(1,Math.max(0,c.l));return Entry.Utils.hslToHex(c)};Entry.Utils.bound01=function(b,a){var c=b;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(b="100%");c="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));c&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; @@ -1191,8 +1191,8 @@ b[h],0d-(l.width+q.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; +b,tP,h),this._movePort(rPort,b,bP,k))};b._alignNS=function(a,b,d){for(var e=-this._rect.width/2,f=this._rect.width/2,g=this._rect.width,h=0,k=0;kd-(l.width+n.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+d+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,12:Entry.SensorBoard,13:Entry.CODEino,14:Entry.joystick,15:Entry.dplay,16:Entry.nemoino,17:Entry.Xbot,18:Entry.ardublock,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick,42:Entry.Arduino,51:Entry.Neobot, 71:Entry.Robotis_carCont,72:Entry.Robotis_openCM70,81:Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,c;this.connected=!1;this.connectTrial++;if(-1m?(q=Math.round(m-155),g=-q,h=0,Entry.dplay.Left_value=g):0==m&&(h=g=0,Entry.dplay.Left_value=0));"2"==n&&(e=6,f=11,0m?(q=Math.round(m-155),k=-q,l=0,Entry.dplay.Right_value= -k):0==m&&(l=k=0,Entry.dplay.Right_value=k));"3"==n&&(c=3,d=5,e=6,f=11,0m?(q=Math.round(m-155),g=-q,h=0,k=-q,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==m&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), +VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,h=0,k=0,l=0,n=0,q=a.getField("PORT"),m=a.getNumberValue("VALUE",a),m=Math.max(m,-100),m=Math.min(m,100);"1"==q&&(c=3,d=5,0m?(n=Math.round(m-155),g=-n,h=0,Entry.dplay.Left_value=g):0==m&&(h=g=0,Entry.dplay.Left_value=0));"2"==q&&(e=6,f=11,0m?(n=Math.round(m-155),k=-n,l=0,Entry.dplay.Right_value= +k):0==m&&(l=k=0,Entry.dplay.Right_value=k));"3"==q&&(c=3,d=5,e=6,f=11,0m?(n=Math.round(m-155),g=-n,h=0,k=-n,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==m&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f,k),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var r=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(r)},50);Entry.dplay.timeouts.push(r);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3", params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,g=0,g=a.getNumberValue("L_VALUE",a),g=Math.max(g,-100),g=Math.min(g,100);0 g?(g=Math.round(g-155),c=-g,d=0,Entry.dplay.Left_value=c):0==g&&(d=c=0,Entry.dplay.Left_value=0);g=a.getNumberValue("R_VALUE",a);g=Math.max(g,-100);g=Math.min(g,100);0g?(g=Math.round(g-155),e=-g,f=0,Entry.dplay.Right_value=e):0==g&&(f=e=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), @@ -1924,7 +1924,7 @@ b.onMouseDown=function(a){function c(a){a.stopPropagation();var c=e.workspace.ge Entry.DRAG_MODE_DRAG,m.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(m,c),a=!0),this.animating&&this.set({animating:!1}),0===m.dragInstance.height&&m.dragInstance.set({height:-1+m.height}),c=m.dragInstance,m._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),m.originPos||(m.originPos={x:m.x,y:m.y}),a&&e.generateCodeMagnetMap(),m._updateCloseBlock()))}function d(a){$(document).unbind(".block");m.terminateDrag(a);e&&e.set({dragBlock:null}); m._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete m.dragInstance}a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();this._changeFill(!1);var e=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(a);if(!this.readOnly&&!e.viewOnly){e.setSelectedBlock(this);this.dominate();if(0===a.button||a.originalEvent&&a.originalEvent.touches){var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;this.mouseDownCoordinate= {x:f.pageX,y:f.pageY};var g=$(document);g.bind("mousemove.block touchmove.block",c);g.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:f.pageX,startY:f.pageY,offsetX:f.pageX,offsetY:f.pageY,height:0,mode:!0});e.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN}else if(Entry.Utils.isRightButton(a)){var h=this,k=h.block;if(this.isInBlockMenu)return;f=[];var g={text:Lang.Blocks.Duplication_option,enable:this.copyable,callback:function(){Entry.do("cloneBlock", -k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},q={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},n={text:Lang.Menus.save_as_image,callback:function(){h.downloadAsImage()}};f.push(g);f.push(l);f.push(q);Entry.Utils.isChrome()&&"workspace"==Entry.type&&f.push(n);Entry.ContextMenu.show(f)}var m=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", +k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},n={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},q={text:Lang.Menus.save_as_image,callback:function(){h.downloadAsImage()}};f.push(g);f.push(l);f.push(n);Entry.Utils.isChrome()&&"workspace"==Entry.type&&f.push(q);Entry.ContextMenu.show(f)}var m=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", event))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(d===Entry.DRAG_MODE_DRAG){var f= this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg;a=!1;var h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode=d,b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock", e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"), @@ -1940,11 +1940,11 @@ this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable (a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)};b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y;return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()}; b._updateColor=function(){var a=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g,">").replace(/\s+(svgGroup)(defs)',g=this.svgGroup.cloneNode(!0),h=this._skeleton.box(this),k=a?1:1.5,l=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;g.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X",-h.offsetX).replace("%Y",-h.offsetY).replace("%SCALE", -k));for(var q=this.getBoard().svgDom.find("defs"),n=this.svgGroup.getBoundingClientRect(),m=g.getElementsByTagName("image"),h=g.getElementsByTagName("text"),r=["\u2265","\u2264"],u="\u2265\u2264-><=+-x/".split(""),k=0;k\s+/g,">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=a?this.svgGroup:this.svgGroup.cloneNode(!0),l=this._skeleton.box(this),n=b?1:1.5,q=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;k.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X", +-l.offsetX).replace("%Y",-l.offsetY).replace("%SCALE",n));for(var m=this.getBoard().svgDom.find("defs"),r=k.getElementsByTagName("image"),l=k.getElementsByTagName("text"),u=["\u2265","\u2264"],t="\u2265\u2264-><=+-x/".split(""),n=0;ne||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;fg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint=f.point}this._magnetMap[b]=d}};b._getCodeBlocks=function(a,b){var d= -a.getThreads(),e=[],f;switch(b){case "previous":f=this._getNextMagnets;break;case "next":f=this._getPreviousMagnets;break;case "string":f=this._getFieldMagnets;break;case "boolean":f=this._getFieldMagnets;break;case "param":f=this._getOutputMagnets;break;default:return[]}for(var g=0;gd.endPoint)f=h+1;else{e=d.blocks;for(f=0;f Date: Fri, 8 Jul 2016 16:59:33 +0900 Subject: [PATCH 27/31] func save --- dist/entry.js | 1 + dist/entry.min.js | 8 ++++---- src/workspace/block_view.js | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 4cc1d7ab2d..5eef7ac328 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -16244,6 +16244,7 @@ Entry.BlockView.pngMap = {}; var a = window.platform; return a && "windows" === a.name.toLowerCase() && "7" === a.version[0] ? !0 : !1; }() ? .9 : .95; + -1 < this.type.indexOf("func_") && (n *= .99); k.setAttribute("transform", "scale(%SCALE) translate(%X,%Y)".replace("%X", -l.offsetX).replace("%Y", -l.offsetY).replace("%SCALE", q)); for (var m = this.getBoard().svgDom.find("defs"), r = k.getElementsByTagName("image"), l = k.getElementsByTagName("text"), u = ["\u2265", "\u2264"], t = "\u2265\u2264-><=+-x/".split(""), q = 0;q < l.length;q++) { (function(a) { diff --git a/dist/entry.min.js b/dist/entry.min.js index 8898a03d79..33d121d3b5 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1942,10 +1942,10 @@ b._updateColor=function(){var a=this._schema.color;this.block.deletable===Entry. this._path,e=this._fillColor;a&&(b=this.getBoard(),b.setPatternRectFill(e),e="url(#blockHoverPattern_"+this.getBoard().suffix+")");d.attr({fill:e})}};b.addActivated=function(){this.svgGroup.addClass("activated")};b.removeActivated=function(){this.svgGroup.removeClass("activated")};b.reDraw=function(){if(this.visible){var a=this.block;requestAnimationFrame(this._updateContents.bind(this));var b=a.params;if(b)for(var d=0;d\s+/g,">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=a?this.svgGroup:this.svgGroup.cloneNode(!0),l=this._skeleton.box(this),n=b?1:1.5,q=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;k.setAttribute("transform","scale(%SCALE) translate(%X,%Y)".replace("%X", --l.offsetX).replace("%Y",-l.offsetY).replace("%SCALE",n));for(var m=this.getBoard().svgDom.find("defs"),r=k.getElementsByTagName("image"),l=k.getElementsByTagName("text"),u=["\u2265","\u2264"],t="\u2265\u2264-><=+-x/".split(""),n=0;n(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=a?this.svgGroup:this.svgGroup.cloneNode(!0),l=this._skeleton.box(this),n=b?1:1.5,q=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;-1<=+-x/".split(""),n=0;ne||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;f -1) + fontWeight *= 0.99; svgGroup.setAttribute( 'transform', 'scale(%SCALE) translate(%X,%Y)' From 9a9f9d7cb62281bd853e4a3b817393ac175b1f23 Mon Sep 17 00:00:00 2001 From: vivid Date: Fri, 8 Jul 2016 17:22:33 +0900 Subject: [PATCH 28/31] font loader --- dist/entry.js | 28 +++++++++++++++++++++++++ dist/entry.min.js | 4 +++- src/util/utils.js | 53 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 1 deletion(-) diff --git a/dist/entry.js b/dist/entry.js index 5eef7ac328..50b4ef9ded 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -12443,6 +12443,34 @@ Entry.Utils.stopProjectWithToast = function(b, a) { Entry.Utils.isChrome = function() { return /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); }; +Entry.Utils.waitForWebfonts = function(b, a) { + for (var c = 0, d = 0, e = b.length;d < e;++d) { + (function(d) { + function e() { + h && h.offsetWidth != k && (++c, h.parentNode.removeChild(h), h = null); + if (c >= b.length && (l && clearInterval(l), c == b.length)) { + return a(), !0; + } + } + var h = document.createElement("span"); + h.innerHTML = "giItT1WQy@!-/#"; + h.style.position = "absolute"; + h.style.left = "-10000px"; + h.style.top = "-10000px"; + h.style.fontSize = "300px"; + h.style.fontFamily = "sans-serif"; + h.style.fontVariant = "normal"; + h.style.fontStyle = "normal"; + h.style.fontWeight = "normal"; + h.style.letterSpacing = "0"; + document.body.appendChild(h); + var k = h.offsetWidth; + h.style.fontFamily = d; + var l; + e() || (l = setInterval(e, 50)); + })(b[d]); + } +}; Entry.Model = function(b, a) { var c = Entry.Model; c.generateSchema(b); diff --git a/dist/entry.min.js b/dist/entry.min.js index 33d121d3b5..2bf5f0d1de 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1156,7 +1156,9 @@ Entry.Utils.addFilters=function(b,a){var c=b.elem("defs"),d=c.elem("filter",{id: {result:"matrixOut",in:"offOut",type:"matrix",values:"0.7 0 0 0 0 0 0.7 0 0 0 0 0 0.7 0 0 0 0 0 1 0"});d.elem("feBlend",{in:"SourceGraphic",in1:"offOut",mode:"normal"});c=c.elem("filter",{id:"entryBlockHighlightFilter_"+a});c.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:0});c.elem("feColorMatrix",{result:"matrixOut",in:"offOut",type:"matrix",values:"1.3 0 0 0 0 0 1.3 0 0 0 0 0 1.3 0 0 0 0 0 1 0"})}; Entry.Utils.addBlockPattern=function(b,a){for(var c=b.elem("pattern",{id:"blockHoverPattern_"+a,class:"blockHoverPattern",patternUnits:"userSpaceOnUse",patternTransform:"translate(12, 0)",x:0,y:0,width:125,height:33}).elem("g"),d=c.elem("rect",{x:0,y:0,width:125,height:33}),e=Entry.mediaFilePath+"block_pattern_(order).png",f=1;5>f;f++)c.elem("image",{class:"pattern"+f,href:e.replace("(order)",f),x:0,y:0,width:125,height:33});return d};Entry.Utils.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4}; Entry.Utils.createMouseEvent=function(b,a){var c=document.createEvent("MouseEvent");c.initMouseEvent(b,!0,!0,window,0,0,0,a.clientX,a.clientY,!1,!1,!1,!1,0,null);return c};Entry.Utils.xmlToJsonData=function(b){b=$.parseXML(b);var a=[];b=b.childNodes[0].childNodes;for(var c in b){var d=b[c];if(d.tagName){var e={category:d.getAttribute("id"),blocks:[]},d=d.childNodes;for(c in d){var f=d[c];f.tagName&&(f=f.getAttribute("type"))&&e.blocks.push(f)}a.push(e)}}return a}; -Entry.Utils.stopProjectWithToast=function(b,a){a=a||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(Entry.container.selectObject(b.getCode().object.id,!0),b.view.getBoard().activateBlock(b));throw Error(a);};Entry.Utils.isChrome=function(){return/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())};Entry.Model=function(b,a){var c=Entry.Model;c.generateSchema(b);c.generateSetter(b);c.generateObserve(b);(void 0===a||a)&&Object.seal(b);return b}; +Entry.Utils.stopProjectWithToast=function(b,a){a=a||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(Entry.container.selectObject(b.getCode().object.id,!0),b.view.getBoard().activateBlock(b));throw Error(a);};Entry.Utils.isChrome=function(){return/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())}; +Entry.Utils.waitForWebfonts=function(b,a){for(var c=0,d=0,e=b.length;d=b.length&&(l&&clearInterval(l),c==b.length))return a(),!0}var h=document.createElement("span");h.innerHTML="giItT1WQy@!-/#";h.style.position="absolute";h.style.left="-10000px";h.style.top="-10000px";h.style.fontSize="300px";h.style.fontFamily="sans-serif";h.style.fontVariant="normal";h.style.fontStyle="normal";h.style.fontWeight= +"normal";h.style.letterSpacing="0";document.body.appendChild(h);var k=h.offsetWidth;h.style.fontFamily=d;var l;e()||(l=setInterval(e,50))})(b[d])};Entry.Model=function(b,a){var c=Entry.Model;c.generateSchema(b);c.generateSetter(b);c.generateObserve(b);(void 0===a||a)&&Object.seal(b);return b}; (function(b){b.generateSchema=function(a){var b=a.schema;if(void 0!==b){b=JSON.parse(JSON.stringify(b));a.data={};for(var d in b)(function(d){a.data[d]=b[d];Object.defineProperty(a,d,{get:function(){return a.data[d]}})})(d);a._toJSON=this._toJSON}};b.generateSetter=function(a){a.set=this.set};b.set=function(a,b){var d={},e;for(e in this.data)void 0!==a[e]&&(a[e]===this.data[e]?delete a[e]:(d[e]=this.data[e],this.data[e]=a[e]instanceof Array?a[e].concat():a[e]));b||this.notify(Object.keys(a),d)};b.generateObserve= function(a){a.observers=[];a.observe=this.observe;a.unobserve=this.unobserve;a.notify=this.notify};b.observe=function(a,b,d,e){d=new Entry.Observer(this.observers,a,b,d);if(!1!==e)a[b]([]);return d};b.unobserve=function(a){a.destroy()};b.notify=function(a,b){"string"===typeof a&&(a=[a]);var d=this;d.observers.map(function(e){var f=a;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,a));if(f.length)e.object[e.funcName](f.map(function(a){return{name:a,object:d,oldValue:b[a]}}))})};b._toJSON=function(){var a= {},b;for(b in this.data)a[b]=this.data[b];return a}})(Entry.Model);Entry.Func=function(b){this.id=b?b.id:Entry.generateHash();this.content=b?new Entry.Code(b.content):new Entry.Code([[{type:"function_create",copyable:!1,deletable:!1,x:40,y:40}]]);this.blockMenuBlock=this.block=null;this.hashMap={};this.paramMap={};var a=function(){};a.prototype=Entry.block.function_general;a=new a;a.changeEvent=new Entry.Event;a.template=Lang.template.function_general;Entry.block["func_"+this.id]=a;if(b){b=this.content._blockMap;for(var c in b)Entry.Func.registerParamBlock(b[c].type); diff --git a/src/util/utils.js b/src/util/utils.js index fea2f2a8ff..6d92e0425a 100644 --- a/src/util/utils.js +++ b/src/util/utils.js @@ -1158,3 +1158,56 @@ Entry.Utils.isChrome = function() { return /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); }; +Entry.Utils.waitForWebfonts = function(fonts, callback) { + var loadedFonts = 0; + for(var i = 0, l = fonts.length; i < l; ++i) { + (function(font) { + var node = document.createElement('span'); + // Characters that vary significantly among different fonts + node.innerHTML = 'giItT1WQy@!-/#'; + // Visible - so we can measure it - but not on the screen + node.style.position = 'absolute'; + node.style.left = '-10000px'; + node.style.top = '-10000px'; + // Large font size makes even subtle changes obvious + node.style.fontSize = '300px'; + // Reset any font properties + node.style.fontFamily = 'sans-serif'; + node.style.fontVariant = 'normal'; + node.style.fontStyle = 'normal'; + node.style.fontWeight = 'normal'; + node.style.letterSpacing = '0'; + document.body.appendChild(node); + + // Remember width with no applied web font + var width = node.offsetWidth; + + node.style.fontFamily = font; + + var interval; + function checkFont() { + // Compare current width with original width + if(node && node.offsetWidth != width) { + ++loadedFonts; + node.parentNode.removeChild(node); + node = null; + } + + // If all fonts have been loaded + if(loadedFonts >= fonts.length) { + if(interval) { + clearInterval(interval); + } + if(loadedFonts == fonts.length) { + callback(); + return true; + } + } + }; + + if(!checkFont()) { + interval = setInterval(checkFont, 50); + } + })(fonts[i]); + } +}; From 2678fcbcfc3433bc8481bd658f4240b36ac36a8a Mon Sep 17 00:00:00 2001 From: vivid Date: Mon, 11 Jul 2016 10:49:33 +0900 Subject: [PATCH 29/31] remove useless code --- dist/entry.js | 1 - dist/entry.min.js | 6 +++--- src/workspace/field/dropdownDynamic.js | 2 -- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 3592932997..2badb36258 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -17114,7 +17114,6 @@ Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); var a = this._block.getCode().object, b = []; Entry.container && (b = this._menuName ? Entry.container.getDropdownList(this._menuName, a) : this._menuGenerator()); this._contents.options = b; - b = this._contents.options; (a = this.getValue()) && "null" != a || (a = 0 !== b.length ? b[0][1] : null); this.setValue(a); }; diff --git a/dist/entry.min.js b/dist/entry.min.js index a50db34a47..04a721e088 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1990,9 +1990,9 @@ Entry.FieldColor.getWidgetColorList=function(){return["#FFFFFF #CCCCCC #C0C0C0 # {class:"rect",parent:this.optionGroup}),k=Entry.Dom("span",{class:"left",parent:h});Entry.Dom("span",{class:"right",parent:h}).text(g);this.getValue()==f&&k.text("\u2713");(function(b,c){b.bind("mousedown touchstart",function(a){a.stopPropagation()});b.bind("mouseup touchend",function(b){b.stopPropagation();a.applyValue(c);a.destroyOption();a._selectBlockView()})})(h,f)}this._position()};b._position=function(){var a=this.getAbsolutePosFromDocument();a.y+=this.box.height/2;var b=$(document).height(), d=this.optionGroup.height(),e=this.optionGroup.width()+30;if(b Date: Mon, 11 Jul 2016 13:11:03 +0900 Subject: [PATCH 30/31] add viewBox for making png --- dist/entry.js | 78 ++++++++++++++++----------------- dist/entry.min.js | 86 ++++++++++++++++++------------------- src/workspace/block_view.js | 11 +++-- 3 files changed, 87 insertions(+), 88 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 2badb36258..c8af09a83e 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -9746,40 +9746,40 @@ Entry.Painter.prototype.generateView = function(b) { this.attrLineArea = Entry.createElement("div", "painterAttrLineStyle"); this.attrLineArea.addClass("entryPlaygroundPainterAttrLineStyle"); g.appendChild(this.attrLineArea); + var v = Entry.createElement("div"); + v.addClass("entryPlaygroundPainterAttrLineStyleLine"); + this.attrLineArea.appendChild(v); var u = Entry.createElement("div"); - u.addClass("entryPlaygroundPainterAttrLineStyleLine"); + u.addClass("entryPlaygroundPaitnerAttrLineArea"); this.attrLineArea.appendChild(u); - var t = Entry.createElement("div"); - t.addClass("entryPlaygroundPaitnerAttrLineArea"); - this.attrLineArea.appendChild(t); d = Entry.createElement("div"); d.addClass("entryPlaygroundPainterAttrLineStyleLine1"); - t.appendChild(d); + u.appendChild(d); d.value = "line"; - var v = Entry.createElement("div"); - v.addClass("painterAttrLineStyleBackgroundLine"); - u.bindOnClick(function(a) { - t.removeClass("entryRemove"); + var t = Entry.createElement("div"); + t.addClass("painterAttrLineStyleBackgroundLine"); + v.bindOnClick(function(a) { + u.removeClass("entryRemove"); }); - t.blur = function(a) { + u.blur = function(a) { this.addClass("entryRemove"); }; - t.onmouseleave = function(a) { + u.onmouseleave = function(a) { this.addClass("entryRemove"); }; d.bindOnClick(function(a) { - this.attrLineArea.removeClass(u); - this.attrLineArea.appendChild(v); + this.attrLineArea.removeClass(v); + this.attrLineArea.appendChild(t); this.attrLineArea.onchange(a); - t.blur(); + u.blur(); }); - v.bindOnClick(function(a) { - t.removeClass("entryRemove"); + t.bindOnClick(function(a) { + u.removeClass("entryRemove"); }); this.attrLineArea.onchange = function(b) { a.stroke.style = b.target.value; }; - t.blur(); + u.blur(); } }; Entry.Painter.prototype.restoreHandle = function() { @@ -11564,8 +11564,8 @@ Entry.BlockDriver = function() { return d; } for (var e = 0;e < a.length;e++) { - var f = a[e], g = f.tagName, h = $(f).children()[0], u = f.getAttribute("name"); - "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(b(h)), d.index[u] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[u] = d.params.length - 1); + var f = a[e], g = f.tagName, h = $(f).children()[0], v = f.getAttribute("name"); + "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(b(h)), d.index[v] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[v] = d.params.length - 1); } return d; } @@ -16125,7 +16125,7 @@ Entry.BlockView.pngMap = {}; }; b.getDataUrl = function(a, b) { function d() { - g = g.replace("(svgGroup)", (new XMLSerializer).serializeToString(k)).replace("(defs)", (new XMLSerializer).serializeToString(m[0])).replace(/>\s+/g, ">").replace(/\s+\s+/g, ">").replace(/\s+>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.move_line=function(){this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").moveTo(this.oldPt.x,this.oldPt.y).lineTo(this.stage.mouseX,this.stage.mouseY);this.file.modified=!0;this.stage.update()}; @@ -959,19 +959,19 @@ e.addClass("entryPlaygroundPainterAttrResizeXTop");e.innerHTML="X";c.appendChild c.innerHTML="x";d.appendChild(c);c=Entry.createElement("div");c.addClass("entryPlaygroundAttrReiszeY");d.appendChild(c);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrResizeYTop");d.innerHTML="Y";c.appendChild(d);this.objectHeightInput=Entry.createElement("input","entryPainterAttrHeight");this.objectHeightInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;a.handle.height=this.value;a.updateImageHandle()}; this.objectHeightInput.addClass("entryPlaygroundPainterNumberInput");c.appendChild(this.objectHeightInput);this.attrRotateArea=Entry.createElement("div","painterAttrRotateArea");this.attrRotateArea.addClass("painterAttrRotateArea");g.appendChild(this.attrRotateArea);d=Entry.createElement("div");d.addClass("painterAttrRotateName");d.innerHTML=Lang.Workspace.picture_rotation;this.attrRotateArea.appendChild(d);d=Entry.createElement("fieldset","entryPainterAttrRotate");d.addClass("entryPlaygroundPainterAttrRotate"); this.attrRotateArea.appendChild(d);c=Entry.createElement("div");c.addClass("painterAttrRotateTop");c.innerHTML="\u03bf";d.appendChild(c);this.objectRotateInput=Entry.createElement("input","entryPainterAttrDegree");this.objectRotateInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;360<=this.value?this.value%=360:0>this.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); -this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var n=Entry.createElement("div");n.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(n);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); +this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var q=Entry.createElement("div");q.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(q);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); Entry.getColourCodes().forEach(function(b){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=b;c.bindOnClick(function(c){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= -b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});n.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); -var q=Entry.createElement("fieldset","entryPainterAttrThick");q.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(q);d=Entry.createElement("div");d.addClass("paintAttrThickTop");q.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);q.appendChild(e); -d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);q.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;q.bindOnClick(function(){m.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(a){q.style.zIndex= +b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});q.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); +var n=Entry.createElement("fieldset","entryPainterAttrThick");n.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(n);d=Entry.createElement("div");d.addClass("paintAttrThickTop");n.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);n.appendChild(e); +d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);n.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;n.bindOnClick(function(){m.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); +g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(a){n.style.zIndex= "1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", "entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(b){a.font.style=b.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;dd.style.opacity&&(clearInterval(a),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryRemove");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.BlockDriver=function(){}; -(function(b){b.convert=function(){var a=new Date,b;for(b in Entry.block)"function"===typeof Entry.block[b]&&this._convertBlock(b);console.log((new Date).getTime()-a.getTime())};b._convertBlock=function(a){function b(a){var d={type:a.getAttribute("type"),index:{}};a=$(a).children();if(!a)return d;for(var e=0;eg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;dg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;d=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; Entry.Utils.colorDarken=function(b,a){function c(a){2!=a.length&&(a="0"+a);return a}var d,e,f;7===b.length?(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),f=parseInt(b.substr(5,2),16)):(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),f=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;d=c(Math.floor(d*a).toString(16));e=c(Math.floor(e*a).toString(16));f=c(Math.floor(f*a).toString(16));return"#"+d+e+f}; Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;var c=Entry.Utils.hexToHsl(b);c.l+=a/100;c.l=Math.min(1,Math.max(0,c.l));return Entry.Utils.hslToHex(c)};Entry.Utils.bound01=function(b,a){var c=b;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(b="100%");c="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));c&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; @@ -1184,8 +1184,8 @@ b[h],0d-(l.width+n.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; +b,tP,h),this._movePort(rPort,b,bP,k))};b._alignNS=function(a,b,d){for(var e=-this._rect.width/2,f=this._rect.width/2,g=this._rect.width,h=0,k=0;kd-(l.width+q.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+d+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,12:Entry.SensorBoard,13:Entry.CODEino,14:Entry.joystick,15:Entry.dplay,16:Entry.nemoino,17:Entry.Xbot,18:Entry.ardublock,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick,42:Entry.Arduino,51:Entry.Neobot, 71:Entry.Robotis_carCont,72:Entry.Robotis_openCM70,81:Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,c;this.connected=!1;this.connectTrial++;if(-1m?(n=Math.round(m-155),g=-n,h=0,Entry.dplay.Left_value=g):0==m&&(h=g=0,Entry.dplay.Left_value=0));"2"==q&&(e=6,f=11,0m?(n=Math.round(m-155),k=-n,l=0,Entry.dplay.Right_value= -k):0==m&&(l=k=0,Entry.dplay.Right_value=k));"3"==q&&(c=3,d=5,e=6,f=11,0m?(n=Math.round(m-155),g=-n,h=0,k=-n,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==m&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), +VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,h=0,k=0,l=0,q=0,n=a.getField("PORT"),m=a.getNumberValue("VALUE",a),m=Math.max(m,-100),m=Math.min(m,100);"1"==n&&(c=3,d=5,0m?(q=Math.round(m-155),g=-q,h=0,Entry.dplay.Left_value=g):0==m&&(h=g=0,Entry.dplay.Left_value=0));"2"==n&&(e=6,f=11,0m?(q=Math.round(m-155),k=-q,l=0,Entry.dplay.Right_value= +k):0==m&&(l=k=0,Entry.dplay.Right_value=k));"3"==n&&(c=3,d=5,e=6,f=11,0m?(q=Math.round(m-155),g=-q,h=0,k=-q,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==m&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f,k),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var r=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(r)},50);Entry.dplay.timeouts.push(r);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3", params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,g=0,g=a.getNumberValue("L_VALUE",a),g=Math.max(g,-100),g=Math.min(g,100);0 g?(g=Math.round(g-155),c=-g,d=0,Entry.dplay.Left_value=c):0==g&&(d=c=0,Entry.dplay.Left_value=0);g=a.getNumberValue("R_VALUE",a);g=Math.max(g,-100);g=Math.min(g,100);0g?(g=Math.round(g-155),e=-g,f=0,Entry.dplay.Right_value=e):0==g&&(f=e=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), @@ -1918,7 +1918,7 @@ b.onMouseDown=function(a){function c(a){a.stopPropagation();var c=e.workspace.ge Entry.DRAG_MODE_DRAG,m.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(m,c),a=!0),this.animating&&this.set({animating:!1}),0===m.dragInstance.height&&m.dragInstance.set({height:-1+m.height}),c=m.dragInstance,m._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),m.originPos||(m.originPos={x:m.x,y:m.y}),a&&e.generateCodeMagnetMap(),m._updateCloseBlock()))}function d(a){$(document).unbind(".block");m.terminateDrag(a);e&&e.set({dragBlock:null}); m._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete m.dragInstance}a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();this._changeFill(!1);var e=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(a);if(!this.readOnly&&!e.viewOnly){e.setSelectedBlock(this);this.dominate();if(0===a.button||a.originalEvent&&a.originalEvent.touches){var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;this.mouseDownCoordinate= {x:f.pageX,y:f.pageY};var g=$(document);g.bind("mousemove.block touchmove.block",c);g.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:f.pageX,startY:f.pageY,offsetX:f.pageX,offsetY:f.pageY,height:0,mode:!0});e.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN}else if(Entry.Utils.isRightButton(a)){var h=this,k=h.block;if(this.isInBlockMenu)return;f=[];var g={text:Lang.Blocks.Duplication_option,enable:this.copyable,callback:function(){Entry.do("cloneBlock", -k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},n={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},q={text:Lang.Menus.save_as_image,callback:function(){h.downloadAsImage()}};f.push(g);f.push(l);f.push(n);Entry.Utils.isChrome()&&"workspace"==Entry.type&&f.push(q);Entry.ContextMenu.show(f)}var m=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", +k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},q={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},n={text:Lang.Menus.save_as_image,callback:function(){h.downloadAsImage()}};f.push(g);f.push(l);f.push(q);Entry.Utils.isChrome()&&"workspace"==Entry.type&&f.push(n);Entry.ContextMenu.show(f)}var m=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", event))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(d===Entry.DRAG_MODE_DRAG){var f= this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg;a=!1;var h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode=d,b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock", e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"), @@ -1934,12 +1934,12 @@ this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable (a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)};b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y;return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()}; b._updateColor=function(){var a=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g,">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=a?this.svgGroup:this.svgGroup.cloneNode(!0),l=this._skeleton.box(this),n=b?1:1.5,q=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;-1<=+-x/".split(""),n=0;n\s+/g,">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=a?this.svgGroup:this.svgGroup.cloneNode(!0),l=this._skeleton.box(this),q=b?1:1.5,n=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;-1<=+-x/".split(""),t=0;te||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;fg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint=f.point}this._magnetMap[b]=d}};b._getCodeBlocks=function(a,b){var d= -a.getThreads(),e=[],f;switch(b){case "previous":f=this._getNextMagnets;break;case "next":f=this._getPreviousMagnets;break;case "string":f=this._getFieldMagnets;break;case "boolean":f=this._getFieldMagnets;break;case "param":f=this._getOutputMagnets;break;default:return[]}for(var g=0;gd.endPoint)f=h+1;else{e=d.blocks;for(f=0;f -1) { + if (notResizeTypes.indexOf(content) > -1) text.setAttribute('font-size', (size) + 'px'); - } else { + else text.setAttribute('font-size', (size * fontWeight) + 'px'); - } - - text.setAttribute('alignment-baseline', 'baseline'); })(texts[i]); } @@ -1084,6 +1081,8 @@ Entry.BlockView.pngMap = {}; function processSvg() { svgData = svgData .replace('(svgGroup)', new XMLSerializer().serializeToString( svgGroup )) + .replace('%W', bBox.width * scale) + .replace('%H', bBox.height * scale) .replace('(defs)', new XMLSerializer().serializeToString( defs[0] )) .replace(/>\s+/g, ">").replace(/\s+ Date: Mon, 11 Jul 2016 13:25:04 +0900 Subject: [PATCH 31/31] paste lang --- dist/entry.js | 2 +- dist/entry.min.js | 2 +- src/workspace/board.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index c8af09a83e..907f1563d9 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -18332,7 +18332,7 @@ Entry.Board.OPTION_DOWNLOAD = 3; }; b._initContextOptions = function() { var a = this; - this._contextOptions = [{activated:!0, option:{text:"\ubd99\uc5ec\ub123\uae30", enable:!!Entry.clipboard, callback:function() { + this._contextOptions = [{activated:!0, option:{text:Lang.Blocks.Paste_blocks, enable:!!Entry.clipboard, callback:function() { Entry.do("addThread", Entry.clipboard).value.getFirstBlock().copyToClipboard(); }}}, {activated:!0, option:{text:Lang.Blocks.tidy_up_block, callback:function() { a.alignThreads(); diff --git a/dist/entry.min.js b/dist/entry.min.js index 5b876ddbf8..3216dc248d 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -2059,7 +2059,7 @@ b+k.box.x,d+k.box.y,e+.01,f)))))}return h};b.getNearestMagnet=function(a,b,d){va (this.svgBlockGroup.appendChild(a.view.svgGroup),this.code.dominate(a.thread))};b.setPatternRectFill=function(a){this.patternRect.attr({fill:a})};b._removeActivated=function(){this._activatedBlockView&&(this._activatedBlockView.removeActivated(),this._activatedBlockView=null)};b.activateBlock=function(a){a=a.view;var b=a.getAbsoluteCoordinate(),d=this.svgDom,e=b.x,b=b.y,e=d.width()/2-e,d=d.height()/2-b-100;this.scroller.scroll(e,d);a.addActivated();this._activatedBlockView=a};b.reDraw=function(){this.code.view.reDraw()}; b.separate=function(a,b){"string"===typeof a&&(a=this.findById(a));a.view&&a.view._toGlobalCoordinate();var d=a.getPrevBlock();a.separate(b);d&&d.getNextBlock()&&d.getNextBlock().view.bindPrev()};b.insert=function(a,b,d){"string"===typeof a&&(a=this.findById(a));this.separate(a,d);3===b.length?a.moveTo(b[0],b[1]):4===b.length&&0===b[3]?(b=this.code.getThreads()[b[2]],a.thread.cut(a),b.insertToTop(a),a.getNextBlock().view.bindPrev()):(b=b instanceof Array?this.code.getTargetByPointer(b):b,b instanceof Entry.Block?("basic"===a.getBlockType()&&a.view.bindPrev(b),a.doInsert(b)):b instanceof Entry.FieldStatement?(a.view.bindPrev(b),b.insertTopBlock(a)):a.doInsert(b))};b.adjustThreadsPosition=function(){var a=this.code;a&&(a=a.getThreads())&&0!==a.length&&(a=a.sort(function(a,b){return a.getFirstBlock().view.x-b.getFirstBlock().view.x}),a=a[0].getFirstBlock())&&(a=a.view,a=a.getAbsoluteCoordinate(),this.scroller.scroll(50-a.x,30-a.y))};b._initContextOptions=function(){var a=this;this._contextOptions= -[{activated:!0,option:{text:"\ubd99\uc5ec\ub123\uae30",enable:!!Entry.clipboard,callback:function(){Entry.do("addThread",Entry.clipboard).value.getFirstBlock().copyToClipboard()}}},{activated:!0,option:{text:Lang.Blocks.tidy_up_block,callback:function(){a.alignThreads()}}},{activated:!0,option:{text:Lang.Blocks.Clear_all_blocks,callback:function(){a.code.clear()}}},{activated:"workspace"===Entry.type&&Entry.Utils.isChrome(),option:{text:Lang.Menus.save_as_image_all,enable:!0,callback:function(){a.code.getThreads().forEach(function(a){(a= +[{activated:!0,option:{text:Lang.Blocks.Paste_blocks,enable:!!Entry.clipboard,callback:function(){Entry.do("addThread",Entry.clipboard).value.getFirstBlock().copyToClipboard()}}},{activated:!0,option:{text:Lang.Blocks.tidy_up_block,callback:function(){a.alignThreads()}}},{activated:!0,option:{text:Lang.Blocks.Clear_all_blocks,callback:function(){a.code.clear()}}},{activated:"workspace"===Entry.type&&Entry.Utils.isChrome(),option:{text:Lang.Menus.save_as_image_all,enable:!0,callback:function(){a.code.getThreads().forEach(function(a){(a= a.getFirstBlock())&&a.view.downloadAsImage()})}}}]};b.activateContextOption=function(a){this._contextOptions[a].activated=!0};b.deActivateContextOption=function(a){this._contextOptions[a].activated=!1};b._bindEvent=function(){Entry.documentMousedown&&(Entry.documentMousedown.attach(this,this.setSelectedBlock),Entry.documentMousedown.attach(this,this._removeActivated));Entry.keyPressed&&Entry.keyPressed.attach(this,this._keyboardControl);if(Entry.windowResized){var a=_.debounce(this.updateOffset,200); Entry.windowResized.attach(this,a)}};b.offset=function(){(!this._offset||0===this._offset.top&&0===this._offset.left)&&this.updateOffset();return this._offset}})(Entry.Board.prototype);Entry.skeleton=function(){}; Entry.skeleton.basic={path:function(b){var a=b.contentWidth;b=b.contentHeight;b=Math.max(30,b+2);a=Math.max(0,a+9-b/2);return"m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh h -%w l -8,8 -8,-8 v -%wh z".replace(/%wh/gi,b).replace(/%w/gi,a).replace(/%h/gi,b/2)},box:function(b){return{offsetX:-8,offsetY:0,width:(b?b.contentWidth:150)+30,height:Math.max(30,(b?b.contentHeight:28)+2),marginBottom:0}},magnets:function(b){return{previous:{x:0,y:0},next:{x:0,y:(b?Math.max(b.height,30):30)+1+b.offsetY}}},contentPos:function(b){return{x:14, diff --git a/src/workspace/board.js b/src/workspace/board.js index 78ae0255cf..e6a21e2e0a 100644 --- a/src/workspace/board.js +++ b/src/workspace/board.js @@ -890,7 +890,7 @@ Entry.Board.OPTION_DOWNLOAD = 3; { activated: true, option: { - text: '붙여넣기', + text: Lang.Blocks.Paste_blocks, enable: !!Entry.clipboard, callback: function(){ Entry.do('addThread', Entry.clipboard).value