Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
chanlee committed Jul 13, 2016
2 parents a103ef4 + 2fcf61b commit 9e8ccb9
Show file tree
Hide file tree
Showing 24 changed files with 1,226 additions and 991 deletions.
15 changes: 6 additions & 9 deletions dist/entry.css
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,7 @@ svg .svgBlockGroup text {
}
.entryPopupWindow > .entryEngineWorkspace_w > .entryEngineButtonWorkspace_w {
position: absolute;
bottom: 1px;
bottom: 3px;
}
.entryPopupWindow > .entryEngineWorkspace_w > .entryAddButtonWorkspace_w {
display: none;
Expand Down Expand Up @@ -2069,7 +2069,9 @@ svg .svgBlockGroup text {
.entryPopupWindow .entryMouseViewWorkspace_w {
font-size: 9pt;
margin: 0 auto;
width: 100%;
width: 40%;
margin-left: -20%;
left: 50%;
color: #4b37a0;
line-height: 24px;
bottom: 1px;
Expand Down Expand Up @@ -5109,6 +5111,7 @@ input.entryObjectNameWorkspace:-moz-read-only {
flex: 1;
}
.propertyPanel {
z-index: 10;
position: absolute;
top: 326px;
bottom: 0px;
Expand Down Expand Up @@ -5344,23 +5347,18 @@ input.entryObjectNameWorkspace:-moz-read-only {
}
.entryCanvasWorkspace {
width: 480px;
height: 270px;
background-color: white;
display: block;
position: absolute;
top: 24px;
}
.entryPopupWindow .entryCanvasWorkspace {
top: -11px !important;
}
.entryCanvasPhone {
width: 100%;
background-color: white;
display: block;
}
.entryPopupWindow > .entryCanvasWorkspace {
width: 100% !important;
height: 100% !important;
position: relative;
border-bottom: 1px solid #ccc;
border-top: 0px;
Expand All @@ -5376,8 +5374,7 @@ input.entryObjectNameWorkspace:-moz-read-only {
bottom: 24px;
border-bottom: 1px solid #ccc;
width: 100% !important;
height: 100% !important;
top: -25px !important;
top: 0;
}
.entryStateManagerWorkspace {
float: right;
Expand Down
1,579 changes: 823 additions & 756 deletions dist/entry.js

Large diffs are not rendered by default.

281 changes: 143 additions & 138 deletions dist/entry.min.js

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions extern/util/ndgmr.Collision.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
this.ndgmr = this.ndgmr || {};

(function() {
var threshold = 2;

var collisionCanvas = document.createElement('canvas');
var collisionCtx = collisionCanvas.getContext('2d');
Expand Down Expand Up @@ -86,21 +87,24 @@ this.ndgmr = this.ndgmr || {};
return intersection;
}

if (intersection.width === 0 || intersection.height == 0)
return false;

alphaThreshold = alphaThreshold || 0;
alphaThreshold = Math.min(0.99999,alphaThreshold);

//setting the canvas size
collisionCanvas.width = intersection.width;
collisionCanvas.height = intersection.height;
collisionCanvas2.width = intersection.width;
collisionCanvas2.height = intersection.height;
collisionCanvas.width = intersection.width / threshold;
collisionCanvas.height = intersection.height / threshold;
collisionCanvas2.width = intersection.width / threshold;
collisionCanvas2.height = intersection.height / threshold;

imageData1 = _intersectingImagePart(intersection,bitmap1,collisionCtx,1);
imageData2 = _intersectingImagePart(intersection,bitmap2,collisionCtx2,2);

//compare the alpha values to the threshold and return the result
// = true if pixels are both > alphaThreshold at one coordinate
pixelIntersection = _compareAlphaValues(imageData1,imageData2,intersection.width,intersection.height,alphaThreshold, getRect);
pixelIntersection = _compareAlphaValues(imageData1,imageData2,intersection.width / threshold,intersection.height,alphaThreshold / threshold, getRect);

if ( pixelIntersection ) {
pixelIntersection.x += intersection.x;
Expand Down Expand Up @@ -147,18 +151,15 @@ this.ndgmr = this.ndgmr || {};
ctx.restore();
ctx.save();
//ctx.clearRect(0,0,intersetion.width,intersetion.height);
ctx.rotate(_getParentalCumulatedProperty(bitmap,'rotation')*(Math.PI/180));
ctx.scale(_getParentalCumulatedProperty(bitmap,'scaleX','*'),_getParentalCumulatedProperty(bitmap,'scaleY','*'));
ctx.translate(-bl.x-intersetion['rect'+i].regX,-bl.y-intersetion['rect'+i].regY);
ctx.rotate(_getParentalCumulatedProperty(bitmap,'rotation')*(Math.PI/181));
ctx.scale(_getParentalCumulatedProperty(bitmap,'scaleX','*') / threshold,_getParentalCumulatedProperty(bitmap,'scaleY','*') / threshold);
ctx.translate((-bl.x-intersetion['rect'+i].regX) / threshold,( -bl.y-intersetion['rect'+i].regY) / threshold);
if ( (sr = bitmap.sourceRect) != undefined ) {
ctx.drawImage(image,sr.x,sr.y,sr.width,sr.height,0,0,sr.width,sr.height);
} else {
ctx.drawImage(image,0,0,image.width,image.height);
ctx.drawImage(image,0,0,image.width / threshold,image.height / threshold);
}
if (intersection.width === 0 || intersection.height == 0)
return false;
else
return ctx.getImageData(0, 0, intersetion.width, intersetion.height).data;
return ctx.getImageData(0, 0, intersetion.width / threshold, intersetion.height / threshold).data;
}

var _compareAlphaValues = function(imageData1,imageData2,width,height,alphaThreshold,getRect) {
Expand Down
1 change: 1 addition & 0 deletions src/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ Entry.Container.prototype.moveElement = function(start, end, isCallFromState) {
this.objects_.splice(endIndex, 0, this.objects_.splice(startIndex, 1)[0]);
this.setCurrentObjects();
Entry.container.updateListView();
Entry.requestUpdate = true;
return new Entry.State(Entry.container,
Entry.container.moveElement,
endIndex, startIndex, true);
Expand Down
6 changes: 4 additions & 2 deletions src/css/components/engine.less
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

.entryPopupWindow > .entryEngineWorkspace_w > .entryEngineButtonWorkspace_w {
position: absolute;
bottom: 1px;
bottom: 3px;
}

.entryPopupWindow > .entryEngineWorkspace_w > .entryAddButtonWorkspace_w {
Expand Down Expand Up @@ -298,7 +298,9 @@
.entryPopupWindow .entryMouseViewWorkspace_w {
font-size: 9pt;
margin: 0 auto;
width: 100%;
width: 40%;
margin-left: -20%;
left: 50%;
color: @bora;
line-height: 24px;
text-align: center;
Expand Down
1 change: 1 addition & 0 deletions src/css/components/property_panel.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.propertyPanel {
z-index: 10;
position: absolute;
top: 326px;
bottom: 0px;
Expand Down
10 changes: 1 addition & 9 deletions src/css/components/stage.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@

.entryCanvasWorkspace {
width: 480px;
height: 270px;
background-color: white;
display: block;
position: absolute;
top: 24px;
}

.entryPopupWindow .entryCanvasWorkspace {
top: -11px !important;
}


.entryCanvasPhone {
width: 100%;
background-color: white;
Expand All @@ -24,7 +18,6 @@

.entryPopupWindow > .entryCanvasWorkspace {
width: 100% !important;
height: 100% !important;
position: relative;
border-bottom: 1px solid #ccc;
border-top: 0px;
Expand All @@ -43,6 +36,5 @@
bottom: 24px;
border-bottom: 1px solid #ccc;
width: 100% !important;
height: 100% !important;
top: -25px !important;
top: 0;
}
2 changes: 2 additions & 0 deletions src/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Entry.Dialog.prototype.generateSpeak = function() {
this.update();
this.object.addChild(this.notch);
this.object.addChild(text);
Entry.requestUpdate = true;
};

/**
Expand Down Expand Up @@ -85,6 +86,7 @@ Entry.Dialog.prototype.update = function() {
this.notch = this.createSpeakNotch(notchType);
this.object.addChild(this.notch);
}
Entry.requestUpdate = true;
};

/**
Expand Down
59 changes: 45 additions & 14 deletions src/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,28 @@ Entry.Engine = function() {
this.isUpdating = true;
this.speeds = [1, 15, 30, 45, 60];

this._mouseMoved = false;;

if (Entry.keyPressed)
Entry.keyPressed.attach(this, this.captureKeyEvent);

Entry.addEventListener('canvasClick', function(e){
Entry.addEventListener('canvasClick', function(e) {
Entry.engine.fireEvent('mouse_clicked');
});
Entry.addEventListener('canvasClickCanceled', function(e){
Entry.addEventListener('canvasClickCanceled', function(e) {
Entry.engine.fireEvent('mouse_click_cancled');
});
Entry.addEventListener('entityClick', function(entity){
Entry.addEventListener('entityClick', function(entity) {
Entry.engine.fireEventOnEntity('when_object_click', entity);
});
Entry.addEventListener('entityClickCanceled', function(entity){
Entry.addEventListener('entityClickCanceled', function(entity) {
Entry.engine.fireEventOnEntity('when_object_click_canceled', entity);
});

if (Entry.type != 'phone') {
Entry.addEventListener('stageMouseMove', function(e){
Entry.engine.updateMouseView();
});
this._mouseMoved = true;
}.bind(this));
Entry.addEventListener('stageMouseOut', function(e){
Entry.engine.hideMouseView();
});
Expand All @@ -51,12 +53,18 @@ Entry.Engine = function() {
var arrows = [37,38,39,40,32];
var code = (e.keyCode || e.which);
var input = Entry.stage.inputField;
if (code == 32 && input &&
input.hasFocus())
if (code == 32 && input && input.hasFocus())
return;
if(arrows.indexOf(code) > -1)
e.preventDefault();
}

setInterval(function() {
if (this._mouseMoved) {
this.updateMouseView();
this._mouseMoved = false;
}
}.bind(this), 100)
};

/**
Expand Down Expand Up @@ -446,6 +454,11 @@ Entry.Engine.prototype.run = function() {
* toggle this engine state run
*/
Entry.Engine.prototype.toggleRun = function() {
if (this.state === 'pause') {
this.togglePause();
return;
}

Entry.addActivity("run");
if (this.state == 'stop') {
Entry.container.mapEntity(function(entity){
Expand Down Expand Up @@ -543,15 +556,30 @@ Entry.Engine.prototype.toggleStop = function() {
* toggle this engine state pause
*/
Entry.Engine.prototype.togglePause = function() {
var timer = Entry.engine.projectTimer;
if (this.state == 'pause') {
timer.pausedTime += (new Date()).getTime() - timer.pauseStart;
if (timer.isPaused)
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');
} else {
this.state = 'pause';
if (!timer.isPaused)
timer.pauseStart = (new Date()).getTime();
else {
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');
//this.pauseButton.addClass('entryRemove');
if (this.runButton2)
this.runButton2.removeClass('entryRemove');
}
};

Expand Down Expand Up @@ -645,7 +673,7 @@ Entry.Engine.prototype.raiseKeyEvent = function(entity, param) {
*/
Entry.Engine.prototype.updateMouseView = function() {
var coordinate = Entry.stage.mouseCoordinate;
this.mouseView.innerHTML = 'X : ' + coordinate.x + ', Y : ' + coordinate.y;
this.mouseView.textContent = 'X : ' + coordinate.x + ', Y : ' + coordinate.y;
this.mouseView.removeClass('entryRemove');
};

Expand All @@ -669,12 +697,14 @@ Entry.Engine.prototype.toggleFullscreen = function() {
$('body').css('overflow', 'hidden');

popup.window_.appendChild(Entry.stage.canvas.canvas);
popup.window_.appendChild(Entry.engine.runButton[0]);
}
popup.window_.appendChild(Entry.engine.view_);
} else {
this.popup.remove();
this.popup = null;
}
Entry.windowResized.notify();
};

Entry.Engine.prototype.exitFullScreen = function() {
Expand All @@ -685,6 +715,7 @@ Entry.Engine.prototype.exitFullScreen = function() {
Entry.engine.footerView_.removeClass('entryRemove');
Entry.engine.headerView_.removeClass('entryRemove');
}
Entry.windowResized.notify();
};


Expand Down Expand Up @@ -746,12 +777,12 @@ Entry.Engine.prototype.stopProjectTimer = function() {
};

Entry.Engine.prototype.updateProjectTimer = function(value) {
var timer = Entry.engine.projectTimer;
var engine = Entry.engine;
var timer = engine.projectTimer;
if (!timer) return;
var current = (new Date()).getTime();
if (!timer)
return;
if (typeof value == 'undefined') {
if (!timer.isPaused)
if (!timer.isPaused && !engine.isState('pause'))
timer.setValue(((current - timer.start - timer.pausedTime)/1000));
} else {
timer.setValue(value);
Expand Down
Loading

0 comments on commit 9e8ccb9

Please sign in to comment.