diff options
author | John Mayhew | 2012-04-02 16:28:39 -0700 |
---|---|---|
committer | John Mayhew | 2012-04-02 16:28:39 -0700 |
commit | b4155fb4c33675a8a7cd37473513718043fdf0ba (patch) | |
tree | 3d8c802473f2395d53d599ec9d8b70b60a4db50c /js/tools/PenTool.js | |
parent | 5ba9aeac94c86049423fd5d4b37b277263939c13 (diff) | |
parent | c6de22bf42be90b403491b5f87b1818d9020310c (diff) | |
download | ninja-b4155fb4c33675a8a7cd37473513718043fdf0ba.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into WorkingBranch
Conflicts:
js/helper-classes/RDGE/rdge-compiled.js
js/helper-classes/RDGE/runtime/GLRuntime.js
js/helper-classes/RDGE/src/core/script/MeshManager.js
js/helper-classes/RDGE/src/core/script/engine.js
js/helper-classes/RDGE/src/core/script/fx/ssao.js
js/helper-classes/RDGE/src/core/script/init_state.js
js/helper-classes/RDGE/src/core/script/run_state.js
js/helper-classes/RDGE/src/core/script/scenegraphNodes.js
js/helper-classes/RDGE/src/core/script/utilities.js
js/helper-classes/RDGE/src/tools/compile-rdge-core.bat
js/helper-classes/RDGE/src/tools/compile-rdge-core.sh
js/helper-classes/RDGE/src/tools/rdge-compiled.js
js/lib/drawing/world.js
js/lib/rdge/materials/bump-metal-material.js
js/lib/rdge/materials/deform-material.js
js/lib/rdge/materials/flat-material.js
js/lib/rdge/materials/fly-material.js
js/lib/rdge/materials/julia-material.js
js/lib/rdge/materials/keleidoscope-material.js
js/lib/rdge/materials/linear-gradient-material.js
js/lib/rdge/materials/mandel-material.js
js/lib/rdge/materials/plasma-material.js
js/lib/rdge/materials/pulse-material.js
js/lib/rdge/materials/radial-blur-material.js
js/lib/rdge/materials/radial-gradient-material.js
js/lib/rdge/materials/relief-tunnel-material.js
js/lib/rdge/materials/square-tunnel-material.js
js/lib/rdge/materials/star-material.js
js/lib/rdge/materials/taper-material.js
js/lib/rdge/materials/tunnel-material.js
js/lib/rdge/materials/twist-material.js
js/lib/rdge/materials/twist-vert-material.js
js/lib/rdge/materials/uber-material.js
js/lib/rdge/materials/water-material.js
js/lib/rdge/materials/z-invert-material.js
js/preloader/Preloader.js
Diffstat (limited to 'js/tools/PenTool.js')
-rwxr-xr-x | js/tools/PenTool.js | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js index 71a91870..779b7f16 100755 --- a/js/tools/PenTool.js +++ b/js/tools/PenTool.js | |||
@@ -278,6 +278,9 @@ exports.PenTool = Montage.create(ShapeTool, { | |||
278 | this.application.ninja.stage.clearDrawingCanvas(); | 278 | this.application.ninja.stage.clearDrawingCanvas(); |
279 | this._hoveredAnchorIndex = -1; | 279 | this._hoveredAnchorIndex = -1; |
280 | 280 | ||
281 | //set the cursor to be the default cursor | ||
282 | this.application.ninja.stage.drawingCanvas.style.cursor = "auto"; | ||
283 | |||
281 | if (this._isDrawing) { | 284 | if (this._isDrawing) { |
282 | var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(event.pageX, event.pageY)); | 285 | var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(event.pageX, event.pageY)); |
283 | //go through the drawing toolbase to get the position of the mouse | 286 | //go through the drawing toolbase to get the position of the mouse |
@@ -348,6 +351,14 @@ exports.PenTool = Montage.create(ShapeTool, { | |||
348 | var selAnchor = this._selectedSubpath.pickAnchor(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS); | 351 | var selAnchor = this._selectedSubpath.pickAnchor(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS); |
349 | if (selAnchor >=0) { | 352 | if (selAnchor >=0) { |
350 | this._hoveredAnchorIndex = selAnchor; | 353 | this._hoveredAnchorIndex = selAnchor; |
354 | } else { | ||
355 | //detect if the current mouse position will hit the path | ||
356 | var pathHitTestData = this._selectedSubpath.pathHitTest(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS); | ||
357 | if (pathHitTestData[0]!==-1){ | ||
358 | //change the cursor | ||
359 | var cursor = "url('images/cursors/penAdd.png') 10 10,default"; | ||
360 | this.application.ninja.stage.drawingCanvas.style.cursor = cursor; | ||
361 | } | ||
351 | } | 362 | } |
352 | } | 363 | } |
353 | } //else of if (this._isDrawing) { | 364 | } //else of if (this._isDrawing) { |
@@ -356,7 +367,6 @@ exports.PenTool = Montage.create(ShapeTool, { | |||
356 | if (this._selectedSubpath){ | 367 | if (this._selectedSubpath){ |
357 | this.DrawSubpathAnchors(this._selectedSubpath); | 368 | this.DrawSubpathAnchors(this._selectedSubpath); |
358 | } | 369 | } |
359 | |||
360 | }//value: function(event) | 370 | }//value: function(event) |
361 | },//HandleMouseMove | 371 | },//HandleMouseMove |
362 | 372 | ||
@@ -584,6 +594,7 @@ exports.PenTool = Montage.create(ShapeTool, { | |||
584 | 594 | ||
585 | var subpath = this._selectedSubpath; //new GLSubpath(); | 595 | var subpath = this._selectedSubpath; //new GLSubpath(); |
586 | subpath.setWorld(world); | 596 | subpath.setWorld(world); |
597 | subpath.setCanvas(newCanvas); | ||
587 | subpath.setPlaneMatrix(planeMat); | 598 | subpath.setPlaneMatrix(planeMat); |
588 | var planeMatInv = glmat4.inverse( planeMat, [] ); | 599 | var planeMatInv = glmat4.inverse( planeMat, [] ); |
589 | subpath.setPlaneMatrixInverse(planeMatInv); | 600 | subpath.setPlaneMatrixInverse(planeMatInv); |
@@ -591,7 +602,33 @@ exports.PenTool = Montage.create(ShapeTool, { | |||
591 | 602 | ||
592 | world.addObject(subpath); | 603 | world.addObject(subpath); |
593 | world.render(); | 604 | world.render(); |
605 | //TODO this will not work if there are multiple shapes in the same canvas | ||
594 | newCanvas.elementModel.shapeModel.GLGeomObj = subpath; | 606 | newCanvas.elementModel.shapeModel.GLGeomObj = subpath; |
607 | newCanvas.elementModel.shapeModel.shapeCount++; | ||
608 | if(newCanvas.elementModel.shapeModel.shapeCount === 1) | ||
609 | { | ||
610 | newCanvas.elementModel.selection = "Subpath"; | ||
611 | newCanvas.elementModel.pi = "SubpathPi"; | ||
612 | newCanvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; | ||
613 | var strokeColor = subpath.getStrokeColor(); | ||
614 | newCanvas.elementModel.shapeModel.stroke = strokeColor; | ||
615 | if(strokeColor) { | ||
616 | newCanvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke; | ||
617 | } | ||
618 | newCanvas.elementModel.shapeModel.strokeMaterial = subpath.getStrokeMaterial(); | ||
619 | |||
620 | newCanvas.elementModel.shapeModel.GLGeomObj = subpath; | ||
621 | newCanvas.elementModel.shapeModel.useWebGl = this.options.use3D; | ||
622 | } | ||
623 | else | ||
624 | { | ||
625 | // TODO - update the shape's info only. shapeModel will likely need an array of shapes. | ||
626 | } | ||
627 | |||
628 | if(newCanvas.elementModel.isShape) | ||
629 | { | ||
630 | this.application.ninja.selectionController.selectElement(newCanvas); | ||
631 | } | ||
595 | } //if (!canvas) { | 632 | } //if (!canvas) { |
596 | else { | 633 | else { |
597 | 634 | ||