From a5ba66ecefa9c9c17e0f5e1725e2141f7a3540a2 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Fri, 24 Feb 2012 12:01:03 -0800 Subject: adding unpacked to the manifest file (to differentiate from the ninjateam (main) chrome app) --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 3d156d2b..e9abd76f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { - "name": "Motorola Ninja", + "name": "Motorola Ninja Unpacked", "description": "Motorola Ninja HTML5 Authoring Tool Pre-Alpha", "version": "0.5.0.1", "app": { -- cgit v1.2.3 From 7cbd26d475eaad817042692f9116f9a24ae60997 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Tue, 28 Feb 2012 10:24:06 -0800 Subject: Bug fixes: 1152: allow deleting of multiple paths from inside pen tool 1128: keyboard hotkey shortcut 'P' for pen tool 941: changing width or height of the path scales the path --- js/helper-classes/RDGE/GLAnchorPoint.js | 7 +++ js/helper-classes/RDGE/GLSubpath.js | 64 ++++++++++++++++++++++++--- js/mediators/keyboard-mediator.js | 7 +++ js/tools/PenTool.js | 77 +++++++++++++++++++++++---------- 4 files changed, 127 insertions(+), 28 deletions(-) diff --git a/js/helper-classes/RDGE/GLAnchorPoint.js b/js/helper-classes/RDGE/GLAnchorPoint.js index 716f59d4..c3e95b34 100755 --- a/js/helper-classes/RDGE/GLAnchorPoint.js +++ b/js/helper-classes/RDGE/GLAnchorPoint.js @@ -133,6 +133,13 @@ GLAnchorPoint.prototype.translateAll = function (x, y, z) { } +GLAnchorPoint.prototype.scaleAll = function(sx,sy,sz){ + this._x *= sx;this._prevX *= sx;this._nextX *= sx; + this._y *= sy;this._prevY *= sy;this._nextY *= sy; + this._z *= sz;this._prevZ *= sz;this._nextZ *= sz; +} + + // ********* getters ********** GLAnchorPoint.prototype.getPosX = function () { return this._x; } GLAnchorPoint.prototype.getPosY = function () { return this._y; } diff --git a/js/helper-classes/RDGE/GLSubpath.js b/js/helper-classes/RDGE/GLSubpath.js index 3200cf59..7beb11b9 100755 --- a/js/helper-classes/RDGE/GLSubpath.js +++ b/js/helper-classes/RDGE/GLSubpath.js @@ -178,6 +178,65 @@ function GLSubpath() { } //render() this.geomType = function () { return this.GEOM_TYPE_CUBIC_BEZIER; } + + + this.setWidth = function (newW) { + //todo this doesn't work in cases where the newW is zero or if the previous width was 0/1 (i.e. the path had become degenerate in width) + //todo same as above for the setHeight function below + //scale the contents of this subpath to lie within this width + //determine the scale factor by comparing with the old width + var oldWidth = this._BBoxMax[0]-this._BBoxMin[0]; + if (oldWidth<1){ + oldWidth=1; + } + var scaleX = newW/oldWidth; + if (scaleX===1){ + return; //no need to do anything + } + + //scale the anchor point positions such that the width of the bbox is the newW + var origX = this._BBoxMin[0]; + var numAnchors = this._Anchors.length; + for (var i=0;i=0){ - this._hoveredAnchorIndex=-1; - this._selectedSubpath.removeAnchor(this._selectedSubpath.getSelectedAnchorIndex()); - this._selectedSubpath.createSamples(); - //clear the canvas - this.application.ninja.stage.clearDrawingCanvas();//stageManagerModule.stageManager.clearDrawingCanvas(); - this.DrawSubpathAnchors(this._selectedSubpath); - this.ShowSelectedSubpath(); + var len = this.application.ninja.selectedElements.length; + if (len===0) { + //clear the selected subpath...the only new additions to this function w.r.t. ToolBase + if (this._selectedSubpath){ + if (this._selectedSubpath.getSelectedAnchorIndex()>=0){ + this._hoveredAnchorIndex=-1; + this._selectedSubpath.removeAnchor(this._selectedSubpath.getSelectedAnchorIndex()); + this._selectedSubpath.createSamples(); + //clear the canvas + this.application.ninja.stage.clearDrawingCanvas();//stageManagerModule.stageManager.clearDrawingCanvas(); + this.DrawSubpathAnchors(this._selectedSubpath); + this.ShowSelectedSubpath(); + } + else { + this._selectedSubpath.clearAllAnchors(); //perhaps unnecessary + this._selectedSubpath = null; + //clear the canvas + this.application.ninja.stage.clearDrawingCanvas();//stageManagerModule.stageManager.clearDrawingCanvas(); + + //undo/redo...go through ElementController and NJEvent + var els = []; + ElementController.removeElement(this._penCanvas); + els.push(this._penCanvas); + NJevent( "deleteSelection", els ); + this._penCanvas = null; + } + } + //do nothing if there was no selected subpath and if there was no selection + } + else { + + //undo/redo...go through ElementMediator (see ElementMediator.handleDeleting() from where the much of this function is copied) + //clear the canvas + this.application.ninja.stage.clearDrawingCanvas();//stageManagerModule.stageManager.clearDrawingCanvas(); + var els = []; + for(var i = 0; i=0 && this._hoveredAnchorIndex=0 && this._hoveredAnchorIndex