Skip to content

Commit

Permalink
merge develop 0819
Browse files Browse the repository at this point in the history
  • Loading branch information
chanlee committed Aug 19, 2016
2 parents a47f619 + 76c217c commit 4a7733a
Show file tree
Hide file tree
Showing 11 changed files with 323 additions and 349 deletions.
140 changes: 74 additions & 66 deletions dist/entry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:2, TEXT_ALIGNS:["center", "left", "right"], clipboard:null, loadProject:function(b) {
b || (b = Entry.getStartProject(Entry.mediaFilePath));
this.setFuncRefs(b.functions);
"workspace" == this.type && Entry.stateManager.startIgnore();
Entry.projectId = b._id;
Entry.variableContainer.setVariables(b.variables);
Expand All @@ -17,7 +16,6 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:
Entry.engine.projectTimer || Entry.variableContainer.generateTimer();
0 === Object.keys(Entry.container.inputValue).length && Entry.variableContainer.generateAnswer();
Entry.start();
this.removeFuncRefs();
return b;
}, exportProject:function(b) {
b || (b = {});
Expand Down Expand Up @@ -125,12 +123,6 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:
a.template = Lang.template.function_general;
Entry.block[b] = a;
}
}, setFuncRefs:function(b) {
this.functions = b ? b.map(function(a) {
return a.id;
}) : [];
}, removeFuncRefs:function() {
delete this.functions;
}};
window.Entry = Entry;
Entry.Albert = {PORT_MAP:{leftWheel:0, rightWheel:0, buzzer:0, leftEye:0, rightEye:0, note:0, bodyLed:0, frontLed:0, padWidth:0, padHeight:0}, setZero:function() {
Expand Down Expand Up @@ -8095,17 +8087,30 @@ Entry.EntryObject = function(b) {
this.clonedEntities = [];
Entry.stage.loadObject(this);
for (c in this.pictures) {
var d = this.pictures[c];
d.objectId = this.id;
d.id || (d.id = Entry.generateHash());
var e = new Image;
d.fileurl ? e.src = d.fileurl : d.fileurl ? e.src = d.fileurl : (b = d.filename, e.src = Entry.defaultPath + "/uploads/" + b.substring(0, 2) + "/" + b.substring(2, 4) + "/image/" + b + ".png");
Entry.Loader.addQueue();
e.onload = function(b) {
Entry.container.cachePicture(d.id + a.entity.id, e);
Entry.Loader.removeQueue();
Entry.requestUpdate = !0;
};
(function(b) {
b.objectId = this.id;
b.id || (b.id = Entry.generateHash());
var c = new Image;
if (b.fileurl) {
c.src = b.fileurl;
} else {
if (b.fileurl) {
c.src = b.fileurl;
} else {
var f = b.filename;
c.src = Entry.defaultPath + "/uploads/" + f.substring(0, 2) + "/" + f.substring(2, 4) + "/image/" + f + ".png";
}
}
Entry.Loader.addQueue();
c.onload = function(c) {
Entry.container.cachePicture(b.id + a.entity.id, this);
Entry.requestUpdate = !0;
Entry.Loader.removeQueue();
};
c.onerror = function(a) {
Entry.Loader.removeQueue();
};
})(this.pictures[c]);
}
}
};
Expand Down Expand Up @@ -11969,7 +11974,7 @@ Entry.setCloneBrush = function(b, a) {
b.shape = d;
};
Entry.isFloat = function(b) {
return /\d+\.{1}\d+/.test(b);
return /\d+\.{1}\d+$/.test(b);
};
Entry.getStringIndex = function(b) {
if (!b) {
Expand Down Expand Up @@ -12941,6 +12946,9 @@ Entry.Stage.prototype.initStage = function(b) {
Entry.windowResized.attach(this, function() {
Entry.stage.updateBoundRect();
});
$(window).scroll(function() {
Entry.stage.updateBoundRect();
});
a = function(a) {
a.preventDefault();
var b = Entry.stage.getBoundRect(), e;
Expand Down Expand Up @@ -15868,6 +15876,7 @@ Entry.BlockMenuScroller.RADIUS = 7;
};
})(Entry.BlockMenuScroller.prototype);
Entry.BlockView = function(b, a, c) {
var d = this;
Entry.Model(this, !1);
this.block = b;
this._lazyUpdatePos = _.debounce(b._updatePos.bind(b), 200);
Expand All @@ -15876,39 +15885,42 @@ Entry.BlockView = function(b, a, c) {
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);
if (void 0 === this._schema) {
this.block.destroy(!1, !1);
} else {
this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema));
var e = this._skeleton = Entry.skeleton[this._schema.skeleton];
this._contents = [];
this._statements = [];
this.magnet = {};
this._paramMap = {};
e.magnets && e.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;
this.mouseHandler = function() {
var a = d.block.events;
a && a.mousedown && a.mousedown.forEach(function(a) {
a(d);
});
d.onMouseDown.apply(d, 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);
});
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;
Expand Down Expand Up @@ -16737,14 +16749,15 @@ Entry.Executor = function(b, a) {
for (;;) {
var a = null;
try {
a = this.scope.block.getSchema().func.call(this.scope, this.entity, this.scope);
} catch (b) {
if ("AsyncError" === b.name) {
var b = this.scope.block.getSchema();
b && (a = b.func.call(this.scope, this.entity, this.scope));
} catch (e) {
if ("AsyncError" === e.name) {
a = Entry.STATIC.BREAK;
} else {
var c = !1;
"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec" != b.message && (c = !0);
Entry.Utils.stopProjectWithToast(this.scope, "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec", c);
var d = !1;
"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec" != e.message && (d = !0);
Entry.Utils.stopProjectWithToast(this.scope, "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec", d);
}
}
if (this.isEnd()) {
Expand Down Expand Up @@ -18886,12 +18899,7 @@ Entry.Thread = function(b, a, c) {
}
for (var d = 0;d < a.length;d++) {
var e = a[d];
if (e instanceof Entry.Block || e.isDummy) {
e.setThread(this), this._data.push(e);
} else {
var f = Entry.functions, g = e.type;
(Entry.block[g] || f && -1 < f.indexOf(g.split("_")[1])) && this._data.push(new Entry.Block(e, this));
}
e instanceof Entry.Block || e.isDummy ? (e.setThread(this), this._data.push(e)) : this._data.push(new Entry.Block(e, this));
}
(d = this._code.view) && this.createView(d.board, b);
};
Expand All @@ -18904,7 +18912,7 @@ Entry.Thread = function(b, a, c) {
};
b.createView = function(a, b) {
this.view || (this.view = new Entry.ThreadView(this, a));
this._data.map(function(d) {
this._data.getAll().forEach(function(d) {
d.createView(a, b);
});
};
Expand Down Expand Up @@ -19179,7 +19187,7 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3;
f = this.getNextBlock();
this.getCode().unregisterBlock(this);
e = this.getThread();
this._schema.event && e.unregisterEvent(this, this._schema.event);
this._schema && this._schema.event && e.unregisterEvent(this, this._schema.event);
f && (b ? f.destroy(a, b) : g ? f.view && f.view.bindPrev(g) : (g = this.getThread().view.getParent(), g.constructor === Entry.FieldStatement ? (f.view && f.view.bindPrev(g), g.insertTopBlock(f)) : g.constructor === Entry.FieldStatement ? f.replace(g._valueBlock) : f.view._toGlobalCoordinate()));
!this.doNotSplice && e.spliceBlock ? e.spliceBlock(this) : delete this.doNotSplice;
this.view && this.view.destroy(a);
Expand Down
Loading

0 comments on commit 4a7733a

Please sign in to comment.