Skip to content

Commit

Permalink
merged
Browse files Browse the repository at this point in the history
  • Loading branch information
chanlee committed Oct 19, 2016
2 parents b2bf4ff + 1b7c230 commit 5d17eac
Show file tree
Hide file tree
Showing 32 changed files with 3,237 additions and 1,301 deletions.
3 changes: 3 additions & 0 deletions dist/entry.css
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,9 @@ svg .svgBlockGroup text {
.entry-field-dropdown {
cursor: default;
}
.guideGroup {
opacity: 0.3;
}
.entryWorkspaceBlockMenu {
background-color: #e5e5e5;
position: absolute;
Expand Down
644 changes: 424 additions & 220 deletions dist/entry.js

Large diffs are not rendered by default.

1,382 changes: 719 additions & 663 deletions dist/entry.min.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions src/core/svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ goog.provide('Entry.SVG');
* @param {string} tag or html to construct dom element.
* @param {?object} options include id, classes, parent etc.
*/
Entry.SVG = function (id) {
var element = document.getElementById(id);
Entry.SVG = function (id , svgDom) {
var element = svgDom ? svgDom : document.getElementById(id);
return Entry.SVG.createElement(element);
};

Expand Down Expand Up @@ -51,6 +51,9 @@ Entry.SVG.createElement = function (tag, options) {
el.remove = Entry.SVG.remove;
el.removeAttr = Entry.SVG.removeAttr;

if (tag === "text")
el.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space","preserve");

return el;
};

Expand Down
3 changes: 3 additions & 0 deletions src/css/components/block.less
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,6 @@ svg .svgBlockGroup text {
cursor: default;
}

.guideGroup {
opacity: 0.3;
}
74 changes: 45 additions & 29 deletions src/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ Entry.Engine = function() {
this._mouseMoved = false;
}
}.bind(this), 100)

Entry.message = new Entry.Event(window);
};

/**
Expand Down Expand Up @@ -509,17 +511,19 @@ Entry.Engine.prototype.toggleRun = function() {
if (Entry.type == 'mobile')
this.view_.addClass('entryEngineBlueWorkspace');

this.pauseButton.innerHTML = Lang.Workspace.pause;
this.runButton.addClass('run');
this.runButton.addClass('entryRemove');
this.stopButton.removeClass('entryRemove');
if (this.pauseButton)
this.pauseButton.removeClass('entryRemove');
if (this.runButton) {
this.pauseButton.innerHTML = Lang.Workspace.pause;
this.runButton.addClass('run');
this.runButton.addClass('entryRemove');
this.stopButton.removeClass('entryRemove');
if (this.pauseButton)
this.pauseButton.removeClass('entryRemove');

if (this.runButton2)
this.runButton2.addClass('entryRemove');
if (this.stopButton2)
this.stopButton2.removeClass('entryRemove');
if (this.runButton2)
this.runButton2.addClass('entryRemove');
if (this.stopButton2)
this.stopButton2.removeClass('entryRemove');
}

if (!this.isUpdating) {
Entry.engine.update();
Expand Down Expand Up @@ -564,15 +568,17 @@ Entry.Engine.prototype.toggleStop = function() {
createjs.Sound.setVolume(1);
createjs.Sound.stop();
this.view_.removeClass('entryEngineBlueWorkspace');
this.runButton.removeClass('entryRemove');
this.stopButton.addClass('entryRemove');
if (this.pauseButton)
this.pauseButton.addClass('entryRemove');
if (this.runButton) {
this.runButton.removeClass('entryRemove');
this.stopButton.addClass('entryRemove');
if (this.pauseButton)
this.pauseButton.addClass('entryRemove');

if (this.runButton2)
this.runButton2.removeClass('entryRemove');
if (this.stopButton2)
this.stopButton2.addClass('entryRemove');
if (this.runButton2)
this.runButton2.removeClass('entryRemove');
if (this.stopButton2)
this.stopButton2.addClass('entryRemove');
}

this.state = 'stop';
Entry.dispatchEvent('stop');
Expand All @@ -590,10 +596,12 @@ Entry.Engine.prototype.togglePause = function() {
timer.pauseStart = (new Date()).getTime()
else delete timer.pauseStart;
this.state = 'run';
this.pauseButton.innerHTML = Lang.Workspace.pause;
this.runButton.addClass('entryRemove');
if (this.runButton2)
this.runButton2.addClass('entryRemove');
if (this.runButton) {
this.pauseButton.innerHTML = Lang.Workspace.pause;
this.runButton.addClass('entryRemove');
if (this.runButton2)
this.runButton2.addClass('entryRemove');
}
} else {
this.state = 'pause';
if (!timer.isPaused)
Expand All @@ -602,20 +610,22 @@ Entry.Engine.prototype.togglePause = function() {
timer.pausedTime += (new Date()).getTime() - timer.pauseStart;
timer.pauseStart = (new Date()).getTime();
}
this.pauseButton.innerHTML = Lang.Workspace.restart;
this.runButton.removeClass('entryRemove');
this.stopButton.removeClass('entryRemove');
if (this.runButton2)
this.runButton2.removeClass('entryRemove');
if (this.runButton) {
this.pauseButton.innerHTML = Lang.Workspace.restart;
this.runButton.removeClass('entryRemove');
this.stopButton.removeClass('entryRemove');
if (this.runButton2)
this.runButton2.removeClass('entryRemove');
}
}
};

/**
* @param {string} eventName
*/
Entry.Engine.prototype.fireEvent = function(eventName) {
if (this.state == 'run')
Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent, eventName);
if (this.state !== 'run') return;
Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent, eventName);
};

/**
Expand Down Expand Up @@ -817,3 +827,9 @@ Entry.Engine.prototype.updateProjectTimer = function(value) {
}
};


Entry.Engine.prototype.raiseMessage = function(value) {
Entry.message.notify(Entry.variableContainer.getMessage(value));
return Entry.container.mapEntityIncludeCloneOnScene(
this.raiseKeyEvent, ["when_message_cast", value]);
};
3 changes: 2 additions & 1 deletion src/painter2.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Entry.Painter2 = function(view) {
this.view = view;
this.baseUrl = Entry.painterBaseUrl || '/lib/literallycanvas/lib/img';

this.file = {
id: Entry.generateHash(),
Expand All @@ -22,7 +23,7 @@ Entry.Painter2 = function(view) {
p.initialize = function() {
if (this.lc)
return;
var imgURL = '/lib/literallycanvas/lib/img';
var imgURL = this.baseUrl;
var bgImage = new Image();
bgImage.src = imgURL + '/transparent-pattern.png';
this.lc = LC.init(this.view, {
Expand Down
28 changes: 4 additions & 24 deletions src/popup_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,6 @@ Entry.popupHelper = function(reset) {
}
});

this.body_.bind('touchstart', function(e) {
if(that.nowContent && ignoreCloseType.indexOf(that.nowContent.prop('type')) > -1) {
return;
}
var $target = $(e.target);
spanArea.forEach((function (className) {
if($target.hasClass(className)) {
this.popup.hide();
}
}).bind(this));
if (e.target==this) {
this.popup.hide();
}
});

window.popupHelper = this;
this.body_.prop('popup', this);

Expand Down Expand Up @@ -105,14 +90,6 @@ Entry.popupHelper.prototype.addPopup = function(key, popupObject) {
}).bind(this));

var self = this;

titleButton_.bind('touchstart', function() {
if(popupObject.closeEvent) {
popupObject.closeEvent(self);
} else {
self.hide();
}
});

var popupWrapper_ = Entry.Dom('div', {
class: 'entryPopupHelperWrapper'
Expand All @@ -135,6 +112,7 @@ Entry.popupHelper.prototype.addPopup = function(key, popupObject) {
if(typeof popupObject.setPopupLayout === 'function') {
popupObject.setPopupLayout(content_);
}
content_._obj = popupObject;

this.popupList[key] = content_;
};
Expand Down Expand Up @@ -175,8 +153,10 @@ Entry.popupHelper.prototype.show = function(key) {
this.window_.append(this.popupList[key]);
this.nowContent = this.popupList[key];
this.body_.removeClass('hiddenPopup');
};

if (this.nowContent && this.nowContent._obj && this.nowContent._obj.onShow)
this.nowContent._obj.onShow();
};

Entry.popupHelper.prototype.hide = function() {
this.nowContent = undefined;
Expand Down
6 changes: 5 additions & 1 deletion src/property_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Entry.PropertyPanel = function() {
var that = this;
splitter.bind('mousedown touchstart', function(e) {
that._cover.removeClass('entryRemove');
that._cover._isVisible = true;
Entry.container.disableSort();
Entry.container.splitterEnable = true;
if (Entry.documentMousemove) {
Expand All @@ -145,9 +146,12 @@ Entry.PropertyPanel = function() {
if (listener) {
Entry.container.splitterEnable = false;
Entry.documentMousemove.detach(listener);
that._cover.addClass('entryRemove');
delete Entry.container.resizeEvent;
}
if (that._cover._isVisible) {
that._cover._isVisible = false;
that._cover.addClass('entryRemove');
}
Entry.container.enableSort();
});
};
Expand Down
6 changes: 3 additions & 3 deletions src/util/contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ goog.provide('Entry.ContextMenu');
span.text(text);

if (enable && option.callback) {
(function(span, cb) {
span.mousedown(function(e){
(function(elem, cb) {
elem.mousedown(function(e){
e.preventDefault();
that.hide();
cb(e);
});
})(span, option.callback);
})(elem, option.callback);
}
}
elem.addClass(className);
Expand Down
20 changes: 4 additions & 16 deletions src/util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1072,31 +1072,19 @@ Entry.Utils.addBlockPattern = function (boardSvgDom, suffix) {
style: "display: none"
});

var group = pattern.elem('g');

//this rect should be controlled by the board
//according to the target block
var elem = group.elem("rect", {
x: 0, y: 0,
width: 125,
height: 33
});

var imagePath = Entry.mediaFilePath + 'block_pattern_(order).png';
var order = '(order)';
for (var i=1; i<5; i++) {
group.elem("image", {
pattern.elem("image", {
class: 'pattern' + i,
href: imagePath.replace('(order)', i),
href: imagePath.replace(order, i),
x: 0, y: 0,
width: 125,
height: 33
});
}

return {
pattern: pattern,
rect: elem
}
return { pattern: pattern };
};

Entry.Utils.COLLISION = {
Expand Down
4 changes: 4 additions & 0 deletions src/variable_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ Entry.VariableContainer.prototype.select = function(object) {
}
};

Entry.VariableContainer.prototype.getMessage = function(messageId) {
return this.messages_.filter(function(m) {return m.id === messageId})[0]
}

/**
* @param {object} message
*/
Expand Down
Loading

0 comments on commit 5d17eac

Please sign in to comment.