Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
장면 전환시 picture가 아닌 글상자 일경우 id를 찾지 못하여 발생하는 오류 수정
  • Loading branch information
kimorkim committed Feb 5, 2016
1 parent 6907f93 commit ee77e1c
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 91 deletions.
94 changes: 48 additions & 46 deletions dist/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ Blockly.Blocks.albert_set_eye_to = {init:function() {
this.setNextStatement(!0);
}};
Entry.block.albert_set_eye_to = function(a, b) {
var c = Entry.hw.sendQueue, d = b.getField("DIRECTION", b), e = Number(b.getField("COLOR", b));
var c = Entry.hw.sendQueue, d = b.getField("DIRECTION", b), e = +b.getField("COLOR", b);
"LEFT" == d ? c.leftEye = e : ("RIGHT" != d && (c.leftEye = e), c.rightEye = e);
return b.callReturn();
};
Expand Down Expand Up @@ -606,7 +606,7 @@ Entry.block.arduino_get_number = function(a, b) {
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);
return +d.responseText;
};
Blockly.Blocks.arduino_get_number = {init:function() {
this.setColour("#00979D");
Expand Down Expand Up @@ -1293,7 +1293,7 @@ Blockly.Blocks.coordinate_mouse = {init:function() {
this.setInputsInline(!0);
}};
Entry.block.coordinate_mouse = function(a, b) {
return "x" === b.getField("VALUE", b) ? Number(Entry.stage.mouseCoordinate.x) : Number(Entry.stage.mouseCoordinate.y);
return "x" === b.getField("VALUE", b) ? +Entry.stage.mouseCoordinate.x : +Entry.stage.mouseCoordinate.y;
};
Blockly.Blocks.coordinate_object = {init:function() {
this.setColour(calcBlockColor);
Expand All @@ -1317,7 +1317,7 @@ Entry.block.coordinate_object = function(a, b) {
var d = c.parent, d = d.pictures;
return d.indexOf(c.picture) + 1;
case "size":
return Number(c.getSize().toFixed(1));
return +c.getSize().toFixed(1);
case "picture_name":
return d = c.parent, d = d.pictures, d[d.indexOf(c.picture)].name;
}
Expand Down Expand Up @@ -2448,7 +2448,7 @@ Blockly.Blocks.hamster_set_following_speed_to = {init:function() {
this.setNextStatement(!0);
}};
Entry.block.hamster_set_following_speed_to = function(a, b) {
Entry.hw.sendQueue.lineTracerSpeed = Number(b.getField("SPEED", b));
Entry.hw.sendQueue.lineTracerSpeed = +b.getField("SPEED", b);
return b.callReturn();
};
Blockly.Blocks.hamster_stop = {init:function() {
Expand All @@ -2474,7 +2474,7 @@ Blockly.Blocks.hamster_set_led_to = {init:function() {
this.setNextStatement(!0);
}};
Entry.block.hamster_set_led_to = function(a, b) {
var c = Entry.hw.sendQueue, d = b.getField("DIRECTION", b), e = Number(b.getField("COLOR", b));
var c = Entry.hw.sendQueue, d = b.getField("DIRECTION", b), e = +b.getField("COLOR", b);
"LEFT" == d ? c.leftLed = e : ("RIGHT" != d && (c.leftLed = e), c.rightLed = e);
return b.callReturn();
};
Expand Down Expand Up @@ -2673,7 +2673,7 @@ Blockly.Blocks.hamster_set_port_to = {init:function() {
this.setNextStatement(!0);
}};
Entry.block.hamster_set_port_to = function(a, b) {
var c = Entry.hw.sendQueue, d = b.getField("PORT", b), e = Number(b.getField("MODE", b));
var c = Entry.hw.sendQueue, d = b.getField("PORT", b), e = +b.getField("MODE", b);
"A" == d ? c.ioModeA = e : ("B" != d && (c.ioModeA = e), c.ioModeB = e);
return b.callReturn();
};
Expand Down Expand Up @@ -2722,7 +2722,7 @@ Blockly.Blocks.is_press_some_key = {init:function() {
this.setInputsInline(!0);
}};
Entry.block.is_press_some_key = function(a, b) {
var c = Number(b.getField("VALUE", b));
var c = +b.getField("VALUE", b);
return 0 <= Entry.engine.pressedKeys.indexOf(c);
};
Blockly.Blocks.reach_something = {init:function() {
Expand Down Expand Up @@ -2936,13 +2936,13 @@ Entry.block.boolean_basic_operator = function(a, b) {
case "EQUAL":
return d == e;
case "GREATER":
return Number(d) > Number(e);
return +d > +e;
case "LESS":
return Number(d) < Number(e);
return +d < +e;
case "GREATER_OR_EQUAL":
return Number(d) >= Number(e);
return +d >= +e;
case "LESS_OR_EQUAL":
return Number(d) <= Number(e);
return +d <= +e;
}
};
Blockly.Blocks.show = {init:function() {
Expand Down Expand Up @@ -3417,7 +3417,7 @@ Blockly.Blocks.rotate_by_angle_dropdown = {init:function() {
}};
Entry.block.rotate_by_angle_dropdown = function(a, b) {
var c = b.getField("VALUE", b);
a.setRotation(a.getRotation() + Number(c));
a.setRotation(a.getRotation() + +c);
return b.callReturn();
};
Blockly.Blocks.see_angle = {init:function() {
Expand Down Expand Up @@ -3509,8 +3509,8 @@ Blockly.Blocks.locate = {init:function() {
Entry.block.locate = function(a, b) {
var c = b.getField("VALUE", b), d;
"mouse" == c ? (c = Entry.stage.mouseCoordinate.x, d = Entry.stage.mouseCoordinate.y) : (d = Entry.container.getEntity(c), c = d.getX(), d = d.getY());
a.setX(Number(c));
a.setY(Number(d));
a.setX(+c);
a.setY(+d);
a.brush && !a.brush.stop && a.brush.lineTo(c, -1 * d);
return b.callReturn();
};
Expand Down Expand Up @@ -3706,7 +3706,7 @@ Entry.block.locate_object_time = function(a, b) {
if (0 != c) {
"mouse" == d ? (d = e.x - a.getX(), e = e.y - a.getY()) : (e = Entry.container.getEntity(d), d = e.getX() - a.getX(), e = e.getY() - a.getY()), b.isStart = !0, b.frameCount = c, b.dX = d / b.frameCount, b.dY = e / b.frameCount;
} else {
return "mouse" == d ? (d = Number(e.x), e = Number(e.y)) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), a.setX(d), a.setY(e), a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()), b.callReturn();
return "mouse" == d ? (d = +e.x, e = +e.y) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), a.setX(d), a.setY(e), a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()), b.callReturn();
}
}
if (0 != b.frameCount) {
Expand Down Expand Up @@ -7030,23 +7030,23 @@ Entry.EntryObject.prototype.generateView = function() {
13 == a.keyCode && c.editObjectValues(tog);
};
f.onblur = function(a) {
isNaN(f.value) || c.entity.setX(Number(f.value));
isNaN(f.value) || c.entity.setX(+f.value);
c.updateCoordinateView();
Entry.stage.updateObject();
};
h.onkeypress = function(a) {
13 == a.keyCode && c.editObjectValues(tog);
};
h.onblur = function(a) {
isNaN(h.value) || c.entity.setY(Number(h.value));
isNaN(h.value) || c.entity.setY(+h.value);
c.updateCoordinateView();
Entry.stage.updateObject();
};
l.onkeypress = function(a) {
13 == a.keyCode && c.editObjectValues(tog);
};
l.onblur = function(a) {
isNaN(l.value) || c.entity.setSize(Number(l.value));
isNaN(l.value) || c.entity.setSize(+l.value);
c.updateCoordinateView();
Entry.stage.updateObject();
};
Expand Down Expand Up @@ -7090,7 +7090,7 @@ Entry.EntryObject.prototype.generateView = function() {
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));
isNaN(a) || c.entity.setRotation(+a);
c.updateRotationView();
Entry.stage.updateObject();
};
Expand All @@ -7100,7 +7100,7 @@ Entry.EntryObject.prototype.generateView = function() {
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));
isNaN(a) || c.entity.setDirection(+a);
c.updateRotationView();
Entry.stage.updateObject();
};
Expand Down Expand Up @@ -7172,24 +7172,24 @@ Entry.EntryObject.prototype.generateView = function() {
}
}), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, a.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, g = Entry.createElement("span"), g.addClass("entryObjectDirectionSpanWorkspace"), g.innerHTML = Lang.Workspace.direction + " : ", m = Entry.createElement("input"), m.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = m, d.appendChild(e), d.appendChild(n), d.appendChild(g), 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());
13 == a.keyCode && (a = n.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(+a), c.updateRotationView(), n.blur());
}, n.onblur = function(a) {
c.entity.setRotation(c.entity.getRotation());
Entry.stage.updateObject();
}, 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());
13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(+a), c.updateRotationView(), m.blur());
}, m.onblur = function(a) {
c.entity.setDirection(c.entity.getDirection());
Entry.stage.updateObject();
}, a = Entry.createElement("div"), a.addClass("entryObjectRotationWrapperWorkspace"), a.object = this, this.view_.appendChild(a), d = Entry.createElement("span"), d.addClass("entryObjectCoordinateWorkspace"), a.appendChild(d), e = Entry.createElement("span"), e.addClass("entryObjectCoordinateSpanWorkspace"), e.innerHTML = "X:", f = Entry.createElement("input"), f.addClass("entryObjectCoordinateInputWorkspace"), g = Entry.createElement("span"), g.addClass("entryObjectCoordinateSpanWorkspace"),
g.innerHTML = "Y:", h = Entry.createElement("input"), h.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"), k = Entry.createElement("span"), k.addClass("entryObjectCoordinateSpanWorkspace"), k.innerHTML = Lang.Workspace.Size, l = Entry.createElement("input"), l.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(f), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l),
d.xInput_ = f, d.yInput_ = h, d.sizeInput_ = l, this.coordinateView_ = d, c = this, f.onkeypress = function(a) {
13 == a.keyCode && (isNaN(f.value) || c.entity.setX(Number(f.value)), c.updateCoordinateView(), f.blur());
13 == a.keyCode && (isNaN(f.value) || c.entity.setX(+f.value), c.updateCoordinateView(), f.blur());
}, f.onblur = function(a) {
c.entity.setX(c.entity.getX());
Entry.stage.updateObject();
}, h.onkeypress = function(a) {
13 == a.keyCode && (isNaN(h.value) || c.entity.setY(Number(h.value)), c.updateCoordinateView(), h.blur());
13 == a.keyCode && (isNaN(h.value) || c.entity.setY(+h.value), c.updateCoordinateView(), h.blur());
}, h.onblur = function(a) {
c.entity.setY(c.entity.getY());
Entry.stage.updateObject();
Expand Down Expand Up @@ -9313,12 +9313,14 @@ Entry.Playground.prototype.clonePicture = function(a) {
this.addPicture(a, !0);
};
Entry.Playground.prototype.selectPicture = function(a) {
for (var b = this.object.pictures, c = 0, d = b.length;c < d;c++) {
var e = b[c];
e.id === a.id ? e.view.addClass("entryPictureSelected") : e.view.removeClass("entryPictureSelected");
if (a) {
for (var b = this.object.pictures, c = 0, d = b.length;c < d;c++) {
var e = b[c];
e.id === a.id ? e.view.addClass("entryPictureSelected") : e.view.removeClass("entryPictureSelected");
}
b = Entry.container.selectPicture(a.id);
this.object.id === b && Entry.dispatchEvent("pictureSelected", a);
}
b = Entry.container.selectPicture(a.id);
this.object.id === b && Entry.dispatchEvent("pictureSelected", a);
};
Entry.Playground.prototype.movePicture = function(a, b) {
this.object.pictures.splice(b, 0, this.object.pictures.splice(a, 1)[0]);
Expand Down Expand Up @@ -10010,7 +10012,7 @@ p = Entry.Script.prototype;
p.init = function(a, b, c) {
Entry.assert("BLOCK" == a.tagName.toUpperCase(), a.tagName);
this.type = a.getAttribute("type");
this.id = Number(a.getAttribute("id"));
this.id = +a.getAttribute("id");
a.getElementsByTagName("mutation").length && a.getElementsByTagName("mutation")[0].hasAttribute("hashid") && (this.hashId = a.childNodes[0].getAttribute("hashid"));
"REPEAT" == this.type.substr(0, 6).toUpperCase() && (this.isRepeat = !0);
b instanceof Entry.Script && (this.previousScript = b, b.parentScript && (this.parentScript = b.parentScript));
Expand Down Expand Up @@ -10074,7 +10076,7 @@ p.getValue = function(a) {
return this.values[a].run();
};
p.getNumberValue = function(a) {
return Number(this.values[a].run());
return +this.values[a].run();
};
p.getStringValue = function(a) {
return String(this.values[a].run());
Expand All @@ -10089,7 +10091,7 @@ p.getStringField = function(a) {
return String(this.fields[a]);
};
p.getNumberField = function(a) {
return Number(this.fields[a]);
return +this.fields[a];
};
p.callReturn = function() {
return this.nextScript ? this.nextScript : this.parentScript ? this.parentScript : null;
Expand Down Expand Up @@ -10891,7 +10893,7 @@ Entry.getElementsByClassName = function(a) {
return b;
};
Entry.parseNumber = function(a) {
return "string" != typeof a || isNaN(Number(a)) ? "number" != typeof a || isNaN(Number(a)) ? !1 : a : Number(a);
return "string" != typeof a || isNaN(+a) ? "number" != typeof a || isNaN(+a) ? !1 : a : +a;
};
Entry.countStringLength = function(a) {
var b, c = 0;
Expand Down Expand Up @@ -10957,7 +10959,7 @@ Entry.computeInputWidth = function(a) {
document.body.appendChild(b);
a = b.offsetWidth;
document.body.removeChild(b);
return Number(a + 10) + "px";
return +(a + 10) + "px";
};
Entry.isArrowOrBackspace = function(a) {
return -1 < [37, 38, 39, 40, 8].indexOf(a);
Expand Down Expand Up @@ -11122,7 +11124,7 @@ Entry.getMaxFloatPoint = function(a) {
return Math.min(b, 20);
};
Entry.convertToRoundedDecimals = function(a, b) {
return isNaN(a) || !this.isFloat(a) ? a : Number(Math.round(a + "e" + b) + "e-" + b);
return isNaN(a) || !this.isFloat(a) ? a : +(Math.round(a + "e" + b) + "e-" + b);
};
Entry.attachEventListener = function(a, b, c) {
setTimeout(function() {
Expand Down Expand Up @@ -11749,7 +11751,7 @@ Entry.Variable.prototype.getId = function() {
return this.id_;
};
Entry.Variable.prototype.getValue = function() {
return this.isNumber() ? Number(this.value_) : this.value_;
return this.isNumber() ? +this.value_ : this.value_;
};
Entry.Variable.prototype.isNumber = function() {
return isNaN(this.value_) ? !1 : !0;
Expand Down Expand Up @@ -11856,7 +11858,7 @@ Entry.Variable.prototype.updateSlideValueByView = function() {
var a = Math.max(this.valueSetter_.graphics.command.x - 10, 0) / this.maxWidth;
0 > a && (a = 0);
1 < a && (a = 1);
a = (this.minValue_ + Number(Math.abs(this.maxValue_ - this.minValue_) * a)).toFixed(2);
a = (this.minValue_ + Math.abs(this.maxValue_ - this.minValue_) * a).toFixed(2);
a < this.minValue_ ? this.setValue(this.minValue_) : a > this.maxValue_ ? this.setValue(this.maxValue_) : this.setValue(a);
};
Entry.Variable.prototype.getMinValue = function() {
Expand Down Expand Up @@ -12017,7 +12019,7 @@ Entry.VariableContainer.prototype.renderMessageReference = function(a) {
Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null), b.select(this.message));
a = this.caller;
a = a.funcBlock ? a.funcBlock.getAttribute("id") : a.block.getAttribute("id");
Blockly.mainWorkspace.activatePreviousBlock(Number(a));
Blockly.mainWorkspace.activatePreviousBlock(+a);
Entry.playground.toggleOnVariableView();
Entry.playground.changeViewMode("variable");
}), f.appendChild(d);
Expand Down Expand Up @@ -12056,7 +12058,7 @@ Entry.VariableContainer.prototype.renderVariableReference = function(a) {
Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null));
a = this.caller;
a = a.funcBlock ? a.funcBlock.getAttribute("id") : a.block.getAttribute("id");
Blockly.mainWorkspace.activatePreviousBlock(Number(a));
Blockly.mainWorkspace.activatePreviousBlock(+a);
Entry.playground.toggleOnVariableView();
Entry.playground.changeViewMode("variable");
}), f.appendChild(d);
Expand All @@ -12079,7 +12081,7 @@ Entry.VariableContainer.prototype.renderFunctionReference = function(a) {
c = d[f], g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.appendChild(c.object.thumbnailView_.cloneNode()), h = Entry.createElement("div"), h.addClass("entryVariableListCallerNameWorkspace"), h.innerHTML = c.object.name, g.appendChild(h), g.caller = c, g.bindOnClick(function(c) {
Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null), b.select(a));
c = this.caller.block.getAttribute("id");
Blockly.mainWorkspace.activatePreviousBlock(Number(c));
Blockly.mainWorkspace.activatePreviousBlock(+c);
Entry.playground.toggleOnVariableView();
Entry.playground.changeViewMode("variable");
}), e.appendChild(g);
Expand Down Expand Up @@ -12906,7 +12908,7 @@ Entry.VariableContainer.prototype.generateVariableSettingView = function() {
d = a.selectedVariable;
e.value = d && "slide" == d.type ? d.minValue_ : 0;
e.onblur = function(b) {
isNaN(this.value) || (b = a.selectedVariable, b.setMinValue(Number(this.value)), a.updateVariableSettingView(b));
isNaN(this.value) || (b = a.selectedVariable, b.setMinValue(+this.value), a.updateVariableSettingView(b));
};
b.minValueInput = e;
c.appendChild(e);
Expand All @@ -12918,7 +12920,7 @@ Entry.VariableContainer.prototype.generateVariableSettingView = function() {
g.addClass("entryVariableSettingMaxValueInputWorkspace");
g.value = d && "slide" == d.type ? d.maxValue_ : 100;
g.onblur = function(b) {
isNaN(this.value) || (b = a.selectedVariable, b.setMaxValue(Number(this.value)), a.updateVariableSettingView(b));
isNaN(this.value) || (b = a.selectedVariable, b.setMaxValue(+this.value), a.updateVariableSettingView(b));
};
b.maxValueInput = g;
c.appendChild(g);
Expand Down Expand Up @@ -13046,7 +13048,7 @@ Entry.VariableContainer.prototype.updateListSettingView = function(a) {
c.removeClass("entryRemove");
};
Entry.VariableContainer.prototype.setListLength = function(a) {
a = Number(a);
a = +a;
var b = this.selectedList.array_;
if (!isNaN(a)) {
var c = b.length;
Expand Down Expand Up @@ -15020,7 +15022,7 @@ Entry.Xml.getNumberValue = function(a, b, c) {
}
for (var d in c) {
if (c[d].tagName && "VALUE" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) {
return Number(Entry.Xml.operate(a, c[d].children[0]));
return +Entry.Xml.operate(a, c[d].children[0]);
}
}
return null;
Expand All @@ -15043,7 +15045,7 @@ Entry.Xml.getNumberField = function(a, b) {
}
for (var d in c) {
if ("FIELD" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == a) {
return Number(c[d].textContent);
return +c[d].textContent;
}
}
};
Expand Down
Loading

0 comments on commit ee77e1c

Please sign in to comment.