From 9b7dac9215fbd7c0fe7a80d3e8f1ff378332fec3 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Fri, 23 Mar 2012 14:32:46 -0700 Subject: Almost working version of brush tool that uses only local coordinates to store the brush stroke points. Current version does not yet update the width and height of the brush stroke canvas upon changing the brush stroke through the PI. Also, current version does not obtain 3D position of points properly from the drawing tool base (see BrushTool _getUnsnappedPosition) --- js/helper-classes/3D/vec-utils.js | 2 +- js/helper-classes/3D/view-utils.js | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'js/helper-classes') diff --git a/js/helper-classes/3D/vec-utils.js b/js/helper-classes/3D/vec-utils.js index e6db4a8d..4eacd856 100755 --- a/js/helper-classes/3D/vec-utils.js +++ b/js/helper-classes/3D/vec-utils.js @@ -259,6 +259,6 @@ var VecUtils = exports.VecUtils = Object.create(Object.prototype, glmat4.rotate(mat, angle, axis); return mat; } - }, + } }); \ No newline at end of file diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 5a820fc2..a72b7906 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -1200,10 +1200,19 @@ exports.ViewUtils = Montage.create(Component, { // MISCELLANEOUS // event.layerX/Y: var pt = viewUtils.getMousePoint(event); + getStageDimension: { + value: function() + { + var width = parseInt(this.application.ninja.stage.documentRoot.elementModel.stageDimension.style.getProperty("width")); + var height= parseInt(this.application.ninja.stage.documentRoot.elementModel.stageDimension.style.getProperty("height")); + return[width,height]; + } + }, + getStage: { value: function() { - return snapManagerModule.SnapManager.getStage(); + return this.application.ninja.stage.snapManager.getStage(); } }, @@ -1303,7 +1312,7 @@ exports.ViewUtils = Montage.create(Component, { { value: function() { - return this.application.ninjs.stage.canvas; + return this.application.ninja.stage.canvas; } }, -- cgit v1.2.3 From 903b01b9d0501e6f974034273385a0517107b1e3 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Tue, 27 Mar 2012 12:42:42 -0700 Subject: File IO for the brush stroke AND changing the data type of brush stroke from GEOM_TYPE_CUBIC_BEZIER to GEOM_TYPE_BRUSH_STROKE --- js/helper-classes/3D/snap-manager.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/helper-classes') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index a755e9e2..5b467b41 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -1411,6 +1411,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { case glObj.GEOM_TYPE_PATH: // Snapping not implemented for these type, but don't throw an error... break; + case glObj.GEOM_TYPE_BRUSH_STROKE: + break; //don't throw error because snapping not yet implemented case glObj.GEOM_TYPE_CUBIC_BEZIER: { var nearVrt = glObj.getNearVertex( eyePt, dir ); -- cgit v1.2.3