aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/PenTool.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js
index a811f997..7e97a8a1 100755
--- a/js/tools/PenTool.js
+++ b/js/tools/PenTool.js
@@ -94,7 +94,9 @@ exports.PenTool = Montage.create(ShapeTool, {
94 ENTRY_SELECT_CANVAS: { value: 1, writable: false}, 94 ENTRY_SELECT_CANVAS: { value: 1, writable: false},
95 ENTRY_SELECT_PATH: { value: 2, writable: false}, 95 ENTRY_SELECT_PATH: { value: 2, writable: false},
96 _entryEditMode: {value: this.ENTRY_SELECT_NONE, writable: true}, 96 _entryEditMode: {value: this.ENTRY_SELECT_NONE, writable: true},
97 97
98 //constants used for limiting size of the subpath canvas
99 _MAX_CANVAS_DIMENSION: {value: 3000, writable: false},
98 100
99 // get the stage world position corresponding to the (x,y) mouse event position by querying the snap manager 101 // get the stage world position corresponding to the (x,y) mouse event position by querying the snap manager
100 // but temporarily turning off all snapping 102 // but temporarily turning off all snapping
@@ -742,6 +744,24 @@ exports.PenTool = Montage.create(ShapeTool, {
742 this._selectedSubpath.createSamples(true); //we need to compute samples to get the bounding box center in stage world space 744 this._selectedSubpath.createSamples(true); //we need to compute samples to get the bounding box center in stage world space
743 var bboxMin = this._selectedSubpath.getBBoxMin(); 745 var bboxMin = this._selectedSubpath.getBBoxMin();
744 var bboxMax = this._selectedSubpath.getBBoxMax(); 746 var bboxMax = this._selectedSubpath.getBBoxMax();
747
748 //check if the last point added made this canvas is now bigger than the max canvas size
749 var needToRemoveLastPoint = false;
750 for (d=0;d<3;d++){
751 if (bboxMax[d]-bboxMin[d]>this._MAX_CANVAS_DIMENSION){
752 needToRemoveLastPoint = true;
753 }
754 }
755 if (needToRemoveLastPoint){
756 console.log("PEN: Warning! Ignoring last added point because canvas size too large")
757 this._selectedSubpath.removeAnchor(numAnchors-1);
758 numAnchors--;
759 //recompute the bbox of this subpath
760 this._selectedSubpath.createSamples(true);
761 bboxMin = this._selectedSubpath.getBBoxMin();
762 bboxMax = this._selectedSubpath.getBBoxMax();
763 }
764
745 this._selectedSubpathCanvasCenter = VecUtils.vecInterpolate(3, bboxMin, bboxMax, 0.5); 765 this._selectedSubpathCanvasCenter = VecUtils.vecInterpolate(3, bboxMin, bboxMax, 0.5);
746 if (this._selectedSubpathCanvas) { 766 if (this._selectedSubpathCanvas) {
747 //if the canvas does not yet exist, the stage world point already have this stage dimension offset below 767 //if the canvas does not yet exist, the stage world point already have this stage dimension offset below