Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
chanlee committed Oct 19, 2016
2 parents dd05451 + 6f8da14 commit 11d6b17
Show file tree
Hide file tree
Showing 7 changed files with 755 additions and 712 deletions.
142 changes: 81 additions & 61 deletions dist/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,8 @@ Blockly.Blocks.arduino_toggle_led = {init:function() {
this.setNextStatement(!0);
}};
Entry.block.arduino_toggle_led = function(b, a) {
var d = a.getNumberValue("VALUE"), c = a.getField("OPERATOR");
Entry.hw.setDigitalPortValue(d, "on" == c ? 255 : 0);
var d = a.getNumberValue("VALUE"), c = "on" == a.getField("OPERATOR") ? 255 : 0;
Entry.hw.setDigitalPortValue(d, c);
return a.callReturn();
};
Blockly.Blocks.arduino_toggle_pwm = {init:function() {
Expand Down Expand Up @@ -1170,8 +1170,8 @@ Blockly.Blocks.dplay_select_led = {init:function() {
Entry.block.dplay_select_led = function(b, a) {
var d = a.getField("PORT"), c = 7;
"7" == d ? c = 7 : "8" == d ? c = 8 : "9" == d ? c = 9 : "10" == d && (c = 10);
d = a.getField("OPERATOR");
Entry.hw.setDigitalPortValue(c, "on" == d ? 255 : 0);
d = "on" == a.getField("OPERATOR") ? 255 : 0;
Entry.hw.setDigitalPortValue(c, d);
return a.callReturn();
};
Blockly.Blocks.dplay_get_switch_status = {init:function() {
Expand Down Expand Up @@ -2604,10 +2604,10 @@ Entry.block.wait_second = function(b, a) {
}
a.isStart = !0;
a.timeFlag = 1;
var d = a.getNumberValue("SECOND", a);
var d = a.getNumberValue("SECOND", a), d = 60 / (Entry.FPS || 60) * d * 1E3;
setTimeout(function() {
a.timeFlag = 0;
}, 60 / (Entry.FPS || 60) * d * 1E3);
}, d);
return a;
};
Blockly.Blocks.repeat_basic = {init:function() {
Expand Down Expand Up @@ -5057,8 +5057,8 @@ Blockly.Blocks.roduino_set_digital = {init:function() {
this.setNextStatement(!0);
}};
Entry.block.roduino_set_digital = function(b, a) {
var d = a.getNumberValue("VALUE"), c = a.getField("OPERATOR");
Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_WRITE, d, "on" == c ? 1 : 0]);
var d = a.getNumberValue("VALUE"), c = "on" == a.getField("OPERATOR") ? 1 : 0;
Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_WRITE, d, c]);
return a.callReturn();
};
Blockly.Blocks.roduino_motor = {init:function() {
Expand Down Expand Up @@ -5134,8 +5134,8 @@ Blockly.Blocks.schoolkit_set_output = {init:function() {
this.setNextStatement(!0);
}};
Entry.block.schoolkit_set_output = function(b, a) {
var d = a.getNumberValue("VALUE"), c = a.getField("OPERATOR");
Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_WRITE, d, "on" == c ? 1 : 0]);
var d = a.getNumberValue("VALUE"), c = "on" == a.getField("OPERATOR") ? 1 : 0;
Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_WRITE, d, c]);
return a.callReturn();
};
Blockly.Blocks.schoolkit_get_in_port_number = {init:function() {
Expand Down Expand Up @@ -5171,9 +5171,9 @@ Blockly.Blocks.schoolkit_motor = {init:function() {
this.setNextStatement(!0);
}};
Entry.block.schoolkit_motor = function(b, a) {
var d = 0, d = a.getField("MODE"), c = a.getField("OPERATOR"), e = a.getNumberValue("VALUE"), d = "motor1" == d ? 7 : 8;
255 < e ? e = 255 : 0 > e && (e = 0);
"cw" == c ? Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 1, d, e]) : "ccw" == c ? Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 2, d, e]) : "stop" == c && Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 0, d, e]);
var d = 0, c = 0, d = a.getField("MODE"), e = a.getField("OPERATOR"), f = a.getNumberValue("VALUE"), d = "motor1" == d ? 7 : 8;
255 < f ? f = 255 : 0 > f && (f = 0);
"cw" == e ? Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 1, d, f]) : "ccw" == e ? Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 2, d, f]) : "stop" == e && Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, c, d, f]);
return a.callReturn();
};
Blockly.Blocks.schoolkit_set_servo_value = {init:function() {
Expand Down Expand Up @@ -7005,7 +7005,8 @@ Entry.Container.prototype.removeObject = function(b) {
this.objects_.splice(a, 1);
this.setCurrentObjects();
Entry.stage.sortZorder();
this.objects_.length && 0 !== a ? 0 < this.getCurrentObjects().length ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : Entry.container.selectObject() : this.objects_.length && 0 === a ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : (Entry.container.selectObject(), Entry.playground.flushPlayground());
a = this.getCurrentObjects();
a.length ? this.selectObject(a[0].id) : (this.selectObject(), Entry.playground.flushPlayground());
Entry.toast.success(Lang.Workspace.remove_object, b.name + " " + Lang.Workspace.remove_object_msg);
Entry.variableContainer.removeLocalVariables(b.id);
Entry.playground.reloadPlayground();
Expand Down Expand Up @@ -10668,6 +10669,7 @@ Entry.Painter.prototype.selectToolbox = function(b) {
};
Entry.Painter2 = function(b) {
this.view = b;
this.baseUrl = Entry.painterBaseUrl || "/lib/literallycanvas/lib/img";
this.file = {id:Entry.generateHash(), name:"\uc0c8\uadf8\ub9bc", modified:!1, mode:"new"};
Entry.addEventListener("pictureImport", function(a) {
this.addPicture(a);
Expand All @@ -10677,10 +10679,10 @@ Entry.Painter2 = function(b) {
(function(b) {
b.initialize = function() {
if (!this.lc) {
var a = new Image;
a.src = "/lib/literallycanvas/lib/img/transparent-pattern.png";
this.lc = LC.init(this.view, {imageURLPrefix:"/lib/literallycanvas/lib/img", zoomMax:3, zoomMin:.5, toolbarPosition:"bottom", imageSize:{width:960, height:540}, backgroundShapes:[LC.createShape("Rectangle", {x:0, y:0, width:960, height:540, strokeWidth:0, strokeColor:"transparent"})]});
a.onload = function() {
var a = this.baseUrl, b = new Image;
b.src = a + "/transparent-pattern.png";
this.lc = LC.init(this.view, {imageURLPrefix:a, zoomMax:3, zoomMin:.5, toolbarPosition:"bottom", imageSize:{width:960, height:540}, backgroundShapes:[LC.createShape("Rectangle", {x:0, y:0, width:960, height:540, strokeWidth:0, strokeColor:"transparent"})]});
b.onload = function() {
this.lc.repaintLayer("background");
}.bind(this);
a = function(a) {
Expand Down Expand Up @@ -12382,7 +12384,10 @@ Entry.TextCodingUtil = function() {
return a.join("\n");
};
b.eventBlockSyntaxFilter = function(a) {
return "entry_event_start" == a || "entry_event_key" == a || "entry_event_mouse_down" == a || "entry_event_mouse_up" == a || "entry_event_object_down" == a || "entry_event_signal" == a || "entry_event_scene_start" == a || "entry_event_clone_create" == a ? "def " + a : a;
if ("entry_event_start" == a || "entry_event_key" == a || "entry_event_mouse_down" == a || "entry_event_mouse_up" == a || "entry_event_object_down" == a || "entry_event_signal" == a || "entry_event_scene_start" == a || "entry_event_clone_create" == a) {
a = "def " + a;
}
return a;
};
b.isEntryEventFunc = function(a) {
return "def entry_event_start" == a || "def entry_event_key" == a || "def entry_event_mouse_down" == a || "def entry_event_mouse_up" == a || "def entry_event_object_down" == a || "def entry_event_signal" == a || "def entry_event_scene_start" == a || "def entry_event_clone_create" == a ? !0 : !1;
Expand Down Expand Up @@ -13349,7 +13354,7 @@ Entry.PyToBlockParser = function(b) {
console.log("ExpressionStatement component", a);
var b = {};
a = a.expression;
a.type && (a = this[a.type](a), console.log("ExpressionStatement expressionData", a), a.type && a.params ? (b.type = a.type, b.params = a.params, result = b) : a.type ? (b.type = a.type, result = b) : result = a);
a.type && (a = this[a.type](a), console.log("ExpressionStatement expressionData", a), a.type && a.params ? (b.type = a.type, b.params = a.params) : a.type ? b.type = a.type : b = a, result = b);
console.log("ExpressionStatement result", result);
return result;
};
Expand Down Expand Up @@ -13609,13 +13614,14 @@ Entry.PyToBlockParser = function(b) {
console.log("Literal value", e);
b || (b = {type:"Block"}, c || (c = "number" == typeof e ? {type:"number"} : {type:"text"}));
if ("Indicator" == b.type) {
var f;
return null;
}
if ("Text" == b.type) {
return "";
}
console.log("Literal paramMeta", b, "paramDefMeta", c);
null != a.value ? (b = this["Param" + b.type](e, b, c), console.log("Literal param", void 0)) : (b = [], c = this[a.left.type](a.left), b.push(c), b.push(a.operator), a = this[a.right.type](a.right), b.push(a));
null != a.value ? (b = this["Param" + b.type](e, b, c), console.log("Literal param", f)) : (b = [], f = this[a.left.type](a.left), b.push(f), b.push(a.operator), a = this[a.right.type](a.right), b.push(a));
a = b;
console.log("Literal result", a);
return a;
Expand All @@ -13642,8 +13648,9 @@ Entry.PyToBlockParser = function(b) {
f.push(e);
b.type = c.type;
b.params = f;
console.log("ParamBlock result", b);
return b;
a = b;
console.log("ParamBlock result", a);
return a;
};
b.ParamAngle = function(a, b, c) {
console.log("ParamAngle value, paramMeta, paramDefMeta", a, b, c);
Expand Down Expand Up @@ -13947,8 +13954,9 @@ Entry.PyToBlockParser = function(b) {
};
b.ForInStatement = function(a) {
console.log("ForInStatement component", a);
console.log("ForInStatement result", null);
return null;
a = null;
console.log("ForInStatement result", a);
return a;
};
b.BreakStatement = function(a) {
console.log("BreakStatement component", a);
Expand Down Expand Up @@ -14282,7 +14290,8 @@ Entry.PyToBlockParser = function(b) {
if (f == blockFuncName) {
if (console.log("textFuncName", f), console.log("blockFuncName", blockFuncName), console.log("textFuncParams.length", c.length), console.log("Object.keys(paramMap).length", Object.keys(h).length), c.length == Object.keys(h).length ? (k = !0, console.log("textFuncParams.length", c.length), console.log("Object.keys(paramMap).length", Object.keys(h).length), l = q.content._data[0]._data, g = l.slice(), g.shift(), console.log("blockFuncContents", l), l = Entry.TextCodingUtil.prototype.isFuncContentsMatch(g,
a, h)) : l = k = !1, k && l) {
m = "func".concat("_").concat(n);
m = "func";
m = m.concat("_").concat(n);
break;
} else {
if (k && !l) {
Expand All @@ -14296,8 +14305,8 @@ Entry.PyToBlockParser = function(b) {
console.log("FunctionDeclaration matchFlag", l);
if (k && l) {
console.log("targetFuncId", m);
var u = c.length;
this._funcMap.put(f + u, m);
var u = c.length, u = f + u;
this._funcMap.put(u, m);
console.log("FunctionDeclaration this._funcMap", this._funcMap);
b = m;
} else {
Expand Down Expand Up @@ -21172,7 +21181,7 @@ Entry.BlockView.pngMap = {};
b._updateBG = function() {
if (this._board.dragBlock && this._board.dragBlock.dragInstance) {
var a = this.svgGroup;
if (this.magnet.next) {
if (this.magnet.next || this.magnet.previous) {
if (a = this.magneting) {
var b = this._board.dragBlock.getShadow(), c = this.getAbsoluteCoordinate(), e;
if ("previous" === a) {
Expand Down Expand Up @@ -21244,15 +21253,17 @@ Entry.BlockView.pngMap = {};
c._moveBy(a, a, !1);
}, b) : c._moveBy(a, a, !1);
};
b.bindPrev = function(a) {
b.bindPrev = function(a, b) {
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));
this._toLocalCoordinate(a.view._nextGroup);
var c = a.getNextBlock();
if (c && c && c !== this.block) {
var e = this.block.getLastBlock();
b ? c.view._toLocalCoordinate(a.view._nextGroup) : e.view.magnet.next ? c.view._toLocalCoordinate(e.view._nextGroup) : (c.view._toGlobalCoordinate(), c.separate(), c.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);
this._toLocalCoordinate(a.view._nextGroup), (c = this.block.getNextBlock()) && c.view && c.view._toLocalCoordinate(this._nextGroup);
}
}
};
Expand Down Expand Up @@ -21407,12 +21418,14 @@ Entry.BlockView.pngMap = {};
}
return f.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();
b.downloadAsImage = function(a) {
this.getDataUrl().then(function(b) {
var c = document.createElement("a");
c.href = b.src;
b = "\uc5d4\ud2b8\ub9ac \ube14\ub85d";
a && (b += a);
c.download = b + ".png";
c.click();
});
};
b._rightClick = function(a) {
Expand Down Expand Up @@ -23520,25 +23533,28 @@ Entry.Board.DRAG_RADIUS = 5;
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 c = this._getCodeBlocks(a, b);
c.sort(function(a, b) {
return a.point - b.point;
});
c.unshift({point:-Number.MAX_VALUE, blocks:[]});
for (var e = 1;e < c.length;e++) {
var f = c[e], g = f, h = f.startBlock;
if (h) {
for (var k = f.endPoint, l = e;k > g.point && (g.blocks.push(h), l++, g = c[l], g);) {
var a = this.code, b = this.dragBlock;
if (a && b) {
this._magnetMap = {};
for (var c in b.magnet) {
if ("next" !== c || void 0 !== b.block.getLastBlock().view.magnet.next) {
var e = this._getCodeBlocks(a, c);
e.sort(function(a, b) {
return a.point - b.point;
});
e.unshift({point:-Number.MAX_VALUE, blocks:[]});
for (var f = 1;f < e.length;f++) {
var g = e[f], h = g, k = g.startBlock;
if (k) {
for (var l = g.endPoint, m = f;l > h.point && (h.blocks.push(k), m++, h = e[m], h);) {
}
delete g.startBlock;
}
delete f.startBlock;
g.endPoint = Number.MAX_VALUE;
e[f - 1].endPoint = g.point;
}
f.endPoint = Number.MAX_VALUE;
c[e - 1].endPoint = f.point;
this._magnetMap[c] = e;
}
this._magnetMap[b] = c;
}
}
};
Expand All @@ -23552,8 +23568,7 @@ Entry.Board.DRAG_RADIUS = 5;
f = this._getPreviousMagnets;
break;
case "string":
f = this._getFieldMagnets;
break;
;
case "boolean":
f = this._getFieldMagnets;
break;
Expand Down Expand Up @@ -23762,8 +23777,13 @@ Entry.Board.DRAG_RADIUS = 5;
}}}, {activated:!0, option:{text:Lang.Blocks.Clear_all_blocks, callback:function() {
a.code.clear(!0);
}}}, {activated:"workspace" === Entry.type && Entry.Utils.isChrome() && !Entry.isMobile(), option:{text:Lang.Menus.save_as_image_all, enable:!0, callback:function() {
a.code.getThreads().forEach(function(a) {
(a = a.getFirstBlock()) && a.view.downloadAsImage();
var b = a.code.getThreads(), c = [];
b.forEach(function(a, f) {
var g = a.getFirstBlock();
g && (console.log("threads.length=", b.length), 1 < b.length && Entry.isOffline ? g.view.getDataUrl().then(function(a) {
c.push(a);
c.length == b.length && Entry.dispatchEvent("saveBlockImages", {images:c});
}) : g.view.downloadAsImage(++f));
});
}}}];
};
Expand Down Expand Up @@ -24341,7 +24361,7 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3;
this.getCode().unregisterBlock(this);
f = this.getThread();
this._schema && this._schema.event && f.unregisterEvent(this, this._schema.event);
c && (b ? c.destroy(a, b) : g ? c.view && c.view.bindPrev(g) : (b = this.getThread().view.getParent(), b.constructor === Entry.FieldStatement ? (c.view && c.view.bindPrev(b), b.insertTopBlock(c)) : b.constructor === Entry.FieldStatement ? c.replace(b._valueBlock) : c.view._toGlobalCoordinate()));
c && (b ? c.destroy(a, b) : g ? c.view && c.view.bindPrev(g, !0) : (b = this.getThread().view.getParent(), b.constructor === Entry.FieldStatement ? (c.view && c.view.bindPrev(b), b.insertTopBlock(c)) : b.constructor === Entry.FieldStatement ? c.replace(b._valueBlock) : c.view._toGlobalCoordinate()));
!this.doNotSplice && f.spliceBlock ? f.spliceBlock(this) : delete this.doNotSplice;
this.view && this.view.destroy(a);
this._schemaChangeEvent && this._schemaChangeEvent.destroy();
Expand Down
Loading

0 comments on commit 11d6b17

Please sign in to comment.