aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorPushkar Joshi2012-02-28 10:24:06 -0800
committerPushkar Joshi2012-02-28 10:24:06 -0800
commit7cbd26d475eaad817042692f9116f9a24ae60997 (patch)
tree1500eb0562e634f8b6f8e1e1446b31a983d00d56 /js/tools
parent053fc63a2950c7a5ee4ebf98033b64d474a3c46e (diff)
downloadninja-7cbd26d475eaad817042692f9116f9a24ae60997.tar.gz
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
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/PenTool.js77
1 files changed, 54 insertions, 23 deletions
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js
index 7749d525..bb9c71e7 100755
--- a/js/tools/PenTool.js
+++ b/js/tools/PenTool.js
@@ -955,33 +955,64 @@ exports.PenTool = Montage.create(ShapeTool, {
955 955
956 handleDelete:{ 956 handleDelete:{
957 value: function(event){ 957 value: function(event){
958 //clear the selected subpath...the only new additions to this function w.r.t. ToolBase 958 var len = this.application.ninja.selectedElements.length;
959 if (this._selectedSubpath){ 959 if (len===0) {
960 if (this._selectedSubpath.getSelectedAnchorIndex()>=0){ 960 //clear the selected subpath...the only new additions to this function w.r.t. ToolBase
961 this._hoveredAnchorIndex=-1; 961 if (this._selectedSubpath){
962 this._selectedSubpath.removeAnchor(this._selectedSubpath.getSelectedAnchorIndex()); 962 if (this._selectedSubpath.getSelectedAnchorIndex()>=0){
963 this._selectedSubpath.createSamples(); 963 this._hoveredAnchorIndex=-1;
964 //clear the canvas 964 this._selectedSubpath.removeAnchor(this._selectedSubpath.getSelectedAnchorIndex());
965 this.application.ninja.stage.clearDrawingCanvas();//stageManagerModule.stageManager.clearDrawingCanvas(); 965 this._selectedSubpath.createSamples();
966 this.DrawSubpathAnchors(this._selectedSubpath); 966 //clear the canvas
967 this.ShowSelectedSubpath(); 967 this.application.ninja.stage.clearDrawingCanvas();//stageManagerModule.stageManager.clearDrawingCanvas();
968 this.DrawSubpathAnchors(this._selectedSubpath);
969 this.ShowSelectedSubpath();
970 }
971 else {
972 this._selectedSubpath.clearAllAnchors(); //perhaps unnecessary
973 this._selectedSubpath = null;
974 //clear the canvas
975 this.application.ninja.stage.clearDrawingCanvas();//stageManagerModule.stageManager.clearDrawingCanvas();
976
977 //undo/redo...go through ElementController and NJEvent
978 var els = [];
979 ElementController.removeElement(this._penCanvas);
980 els.push(this._penCanvas);
981 NJevent( "deleteSelection", els );
982 this._penCanvas = null;
983 }
984 }
985 //do nothing if there was no selected subpath and if there was no selection
986 }
987 else {
988
989 //undo/redo...go through ElementMediator (see ElementMediator.handleDeleting() from where the much of this function is copied)
990 //clear the canvas
991 this.application.ninja.stage.clearDrawingCanvas();//stageManagerModule.stageManager.clearDrawingCanvas();
992 var els = [];
993 for(var i = 0; i<len; i++) {
994 els.push(this.application.ninja.selectedElements[i]);
968 } 995 }
969 else { 996 for(i=0; i<len; i++) {
970 this._selectedSubpath.clearAllAnchors(); //perhaps unnecessary 997 ElementController.removeElement(els[i]._element);
971 this._selectedSubpath = null;
972 //clear the canvas
973 this.application.ninja.stage.clearDrawingCanvas();//stageManagerModule.stageManager.clearDrawingCanvas();
974
975 //undo/redo...go through ElementController and NJEvent
976 var els = [];
977 ElementController.removeElement(this._penCanvas);
978 els.push(this._penCanvas);
979 NJevent( "deleteSelection", els );
980 this._penCanvas = null;
981 } 998 }
982 } 999 NJevent( "deleteSelection", els );
1000
1001 //clear out the selected path if it exists
1002 if (this._selectedSubpath) {
1003 this._selectedSubpath.clearAllAnchors();
1004 this._selectedSubpath = null;
1005 if (this._entryEditMode === this.ENTRY_SELECT_PATH){
1006 this._entryEditMode = this.ENTRY_SELECT_NONE;
1007 }
1008 this._penCanvas = null;
1009 }
1010 }
1011 //redraw the stage to update it
1012 this.application.ninja.stage.draw();
983 } 1013 }
984 }, 1014 },
1015
985 handleResetPenTool: { 1016 handleResetPenTool: {
986 value: function (event) { 1017 value: function (event) {
987 this.Reset(); 1018 this.Reset();