From 648ee61ae84216d0236e0dbc211addc13b2cfa3a Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Fri, 6 Jul 2012 11:52:06 -0700 Subject: Expand tabs --- js/tools/ShapeTool.js | 178 +++++++++++++++++++++++++------------------------- 1 file changed, 89 insertions(+), 89 deletions(-) (limited to 'js/tools/ShapeTool.js') diff --git a/js/tools/ShapeTool.js b/js/tools/ShapeTool.js index dc082303..623cbb97 100755 --- a/js/tools/ShapeTool.js +++ b/js/tools/ShapeTool.js @@ -40,29 +40,29 @@ var World = require("js/lib/drawing/world").World; exports.ShapeTool = Montage.create(DrawingTool, { drawingFeedback: { value: { mode: "Draw3D", type: "rectangle" } }, - _targetedElement: { value: null, writable: true }, + _targetedElement: { value: null, writable: true }, - _mouseDownHitRec: { value: null, writable: true, enumerable: true, configurable: true }, - _mouseUpHitRec: { value: null, writable: true, enumerable: true, configurable: true }, + _mouseDownHitRec: { value: null, writable: true, enumerable: true, configurable: true }, + _mouseUpHitRec: { value: null, writable: true, enumerable: true, configurable: true }, - _canvasCounter: {value: 0, writable: true, enumerable: true, configurable: true }, + _canvasCounter: {value: 0, writable: true, enumerable: true, configurable: true }, - HandleLeftButtonDown: - { - value: function (event) - { - if(this._canDraw) { - this._isDrawing = true; - } + HandleLeftButtonDown: + { + value: function (event) + { + if(this._canDraw) { + this._isDrawing = true; + } this.startDraw(event); - } - }, + } + }, HandleMouseMove: - { - value: function (event) - { + { + value: function (event) + { /* TAG */ if(this.isDrawing) { @@ -77,7 +77,7 @@ exports.ShapeTool = Montage.create(DrawingTool, { } }, - HandleLeftButtonUp: { + HandleLeftButtonUp: { value: function (event) { var canvas, w, h; this.drawData = this.getDrawingData(); @@ -137,67 +137,67 @@ exports.ShapeTool = Montage.create(DrawingTool, { } }, - AddCustomFeedback: { - value: function (event) { - NJevent("enableStageMove"); + AddCustomFeedback: { + value: function (event) { + NJevent("enableStageMove"); this.application.ninja.stage.stageDeps.snapManager.setupDragPlaneFromPlane( workingPlane ); - } - }, + } + }, - RemoveCustomFeedback: { - value: function (event) { - if (this._targetedElement) { + RemoveCustomFeedback: { + value: function (event) { + if (this._targetedElement) { this._targetedElement.classList.remove("active-element-outline"); - this._targetedElement = null; - } + this._targetedElement = null; + } - NJevent("disableStageMove"); + NJevent("disableStageMove"); this.application.ninja.stage.stageDeps.snapManager.clearDragPlane(); - } - }, - - /** Show a border when mousing - * over existing canvas elements to signal to the user that - * the drawing operation will act on the targeted canvas. - **/ - _showFeedbackOnMouseMove: { - value: function (event) { - // TODO - This call is causing the canvas to redraw 3 times per mouse move - var targetedObject = this.application.ninja.stage.getElement(event, true); - - if (targetedObject) { - if((targetedObject.nodeName === "CANVAS") && !ShapesController.isElementAShape(targetedObject)) - { - if (targetedObject !== this._targetedElement) { - if(this._targetedElement) - { + } + }, + + /** Show a border when mousing + * over existing canvas elements to signal to the user that + * the drawing operation will act on the targeted canvas. + **/ + _showFeedbackOnMouseMove: { + value: function (event) { + // TODO - This call is causing the canvas to redraw 3 times per mouse move + var targetedObject = this.application.ninja.stage.getElement(event, true); + + if (targetedObject) { + if((targetedObject.nodeName === "CANVAS") && !ShapesController.isElementAShape(targetedObject)) + { + if (targetedObject !== this._targetedElement) { + if(this._targetedElement) + { this._targetedElement.classList.remove("active-element-outline"); - } - this._targetedElement = targetedObject; + } + this._targetedElement = targetedObject; this._targetedElement.classList.add("active-element-outline"); - } - } - else if (this._targetedElement) { - this._targetedElement.classList.remove("active-element-outline"); - this._targetedElement = null; - } - } - else if (this._targetedElement) { - this._targetedElement.classList.remove("elem-red-outline"); - this._targetedElement = null; - } - } - }, - - RenderShape: - { - value: function (w, h, planeMat, midPt) - { - // Override in subclasses - } - }, + } + } + else if (this._targetedElement) { + this._targetedElement.classList.remove("active-element-outline"); + this._targetedElement = null; + } + } + else if (this._targetedElement) { + this._targetedElement.classList.remove("elem-red-outline"); + this._targetedElement = null; + } + } + }, + + RenderShape: + { + value: function (w, h, planeMat, midPt) + { + // Override in subclasses + } + }, getGLWorld: { value: function (canvas, use3D) @@ -214,26 +214,26 @@ exports.ShapeTool = Montage.create(DrawingTool, { } }, - // We can draw on an existing canvas unless it has only a single shape object - _useExistingCanvas: { - value: function() - { - var target; - if (this._targetedElement && (this._targetedElement.nodeName === "CANVAS") && !ShapesController.isElementAShape(this._targetedElement)) - target = this._targetedElement; - else - { - var container = this.application.ninja.currentDocument.model.domContainer; - if (container && (container.nodeName === "CANVAS")) - { - target = container; - this._targetedElement = target; - } - } - - return target; - } - }, + // We can draw on an existing canvas unless it has only a single shape object + _useExistingCanvas: { + value: function() + { + var target; + if (this._targetedElement && (this._targetedElement.nodeName === "CANVAS") && !ShapesController.isElementAShape(this._targetedElement)) + target = this._targetedElement; + else + { + var container = this.application.ninja.currentDocument.model.domContainer; + if (container && (container.nodeName === "CANVAS")) + { + target = container; + this._targetedElement = target; + } + } + + return target; + } + }, setColor: { value: function(canvas, color, isFill, toolId) -- cgit v1.2.3 From fdbec324dad4ab33d97282ab021d2c1661bc097c Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Mon, 9 Jul 2012 16:27:52 -0700 Subject: BSD License --- js/tools/ShapeTool.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'js/tools/ShapeTool.js') diff --git a/js/tools/ShapeTool.js b/js/tools/ShapeTool.js index 623cbb97..26ed9c6f 100755 --- a/js/tools/ShapeTool.js +++ b/js/tools/ShapeTool.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- cgit v1.2.3