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/TranslateObject3DTool.js | 80 +++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'js/tools/TranslateObject3DTool.js') diff --git a/js/tools/TranslateObject3DTool.js b/js/tools/TranslateObject3DTool.js index 421ace8f..08fc34f7 100755 --- a/js/tools/TranslateObject3DTool.js +++ b/js/tools/TranslateObject3DTool.js @@ -51,20 +51,20 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { { // console.log( "initializeSnapping" ); - this._mouseDownHitRec = null; - this._mouseUpHitRec = null; + this._mouseDownHitRec = null; + this._mouseUpHitRec = null; - snapManager.clearAvoidList(); - snapManager.clearDragPlane(); + snapManager.clearAvoidList(); + snapManager.clearDragPlane(); - // the translate tool does snap align to the bounds of the object only. - // turn off snap align to the cursor. This needs to be re-enabled in the mouse up method - snapManager.enableSnapAlign( false ); + // the translate tool does snap align to the bounds of the object only. + // turn off snap align to the cursor. This needs to be re-enabled in the mouse up method + snapManager.enableSnapAlign( false ); - // snap to element and snap to grid are conditionally enabled based - // on the snap results of the mouse down. enable everything for the first snap - this._snapToElements = snapManager.elementSnapEnabledAppLevel(); - this._snapToGrid = snapManager.gridSnapEnabledAppLevel(); + // snap to element and snap to grid are conditionally enabled based + // on the snap results of the mouse down. enable everything for the first snap + this._snapToElements = snapManager.elementSnapEnabledAppLevel(); + this._snapToGrid = snapManager.gridSnapEnabledAppLevel(); this._dragPlane = null; this._clickedOnStage = false; @@ -72,8 +72,8 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { if(this._handleMode === null) { - snapManager.enableElementSnap ( true ); - snapManager.enableGridSnap ( true ); + snapManager.enableElementSnap ( true ); + snapManager.enableGridSnap ( true ); } else { @@ -81,21 +81,21 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { //if(this._handleMode === 2) { this._dragPlane = viewUtils.getNormalToUnprojectedElementPlane(this._target, this._handleMode, this._inLocalMode); - //console.log( "dragPlane: " + this._dragPlane ); + //console.log( "dragPlane: " + this._dragPlane ); snapManager.setupDragPlaneFromPlane(this._dragPlane); do3DSnap = false; - snapManager.enableElementSnap ( false ); - snapManager.enableGridSnap ( false ); + snapManager.enableElementSnap ( false ); + snapManager.enableGridSnap ( false ); } } if(this.application.ninja.selectedElements.length) { var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(event.pageX, event.pageY)); - // do the snap before setting up the avoid list to allow - // a snap on the mouse down - var hitRec = snapManager.snap(point.x, point.y, do3DSnap); + // do the snap before setting up the avoid list to allow + // a snap on the mouse down + var hitRec = snapManager.snap(point.x, point.y, do3DSnap); if(this._handleMode === 2) { @@ -111,7 +111,7 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { if(elt && (elt !== hitRec.getElement())) { var otherSnap = snapManager.findHitRecordForElement(elt); - if (otherSnap) hitRec = otherSnap; + if (otherSnap) hitRec = otherSnap; } if(elt === this.application.ninja.currentDocument.model.domContainer) { @@ -124,18 +124,18 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { snapManager.addToAvoidList(element); }); - if (hitRec) - { - // disable snap attributes - if (hitRec.getType() == hitRec.SNAP_TYPE_ELEMENT) - { - this._snapToElements = false; - this._snapToGrid = false; - } - else if (hitRec.getType() == hitRec.SNAP_TYPE_ELEMENT_CENTER) - { - snapManager.enableSnapAlign( snapManager.snapAlignEnabledAppLevel() ); - } + if (hitRec) + { + // disable snap attributes + if (hitRec.getType() == hitRec.SNAP_TYPE_ELEMENT) + { + this._snapToElements = false; + this._snapToGrid = false; + } + else if (hitRec.getType() == hitRec.SNAP_TYPE_ELEMENT_CENTER) + { + snapManager.enableSnapAlign( snapManager.snapAlignEnabledAppLevel() ); + } if(this._handleMode === 2) this.clickedObject = this._target; @@ -162,19 +162,19 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { var sign = MathUtils.fpSign( vecUtils.vecDot(3,this._dragPlane,[0,0,1]) + this._dragPlane[3] - 1.0); this._shouldUseQuadPt = (sign == 0); - var wpHitRec = hitRec.convertToWorkingPlane( this._dragPlane ); - this._mouseDownHitRec = wpHitRec; - this._mouseUpHitRec = null; + var wpHitRec = hitRec.convertToWorkingPlane( this._dragPlane ); + this._mouseDownHitRec = wpHitRec; + this._mouseUpHitRec = null; - var pt = hitRec.getScreenPoint(); - this.downPoint.x = pt[0]; - this.downPoint.y = pt[1]; + var pt = hitRec.getScreenPoint(); + this.downPoint.x = pt[0]; + this.downPoint.y = pt[1]; // TODO - need to figure out snapManager dependency by drawUtils. // For now, bypassing by calling snapManager.drawLastHit(); -// drawUtils.refreshDisplay(); +// drawUtils.refreshDisplay(); snapManager.drawLastHit(); - } + } } else { -- cgit v1.2.3 From 04343eda8c2f870b0da55cfdc8003c99fe1cc4de Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Fri, 6 Jul 2012 11:53:10 -0700 Subject: Remove trailing spaces --- js/tools/TranslateObject3DTool.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/tools/TranslateObject3DTool.js') diff --git a/js/tools/TranslateObject3DTool.js b/js/tools/TranslateObject3DTool.js index 08fc34f7..dc3064f0 100755 --- a/js/tools/TranslateObject3DTool.js +++ b/js/tools/TranslateObject3DTool.js @@ -69,7 +69,7 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { this._dragPlane = null; this._clickedOnStage = false; var do3DSnap = true; - + if(this._handleMode === null) { snapManager.enableElementSnap ( true ); @@ -158,7 +158,7 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { } // only do quadrant snapping if the 4 corners of the element are in the drag plane - + var sign = MathUtils.fpSign( vecUtils.vecDot(3,this._dragPlane,[0,0,1]) + this._dragPlane[3] - 1.0); this._shouldUseQuadPt = (sign == 0); -- 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/TranslateObject3DTool.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'js/tools/TranslateObject3DTool.js') diff --git a/js/tools/TranslateObject3DTool.js b/js/tools/TranslateObject3DTool.js index dc3064f0..284ba417 100755 --- a/js/tools/TranslateObject3DTool.js +++ b/js/tools/TranslateObject3DTool.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