From 7bee50379c1df86bb571e0e8d6c08e24d25231f5 Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Mon, 9 Jul 2012 16:38:08 -0700 Subject: BSD License --- js/helper-classes/3D/snap-manager.js | 63 ++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 31 deletions(-) (limited to 'js/helper-classes/3D/snap-manager.js') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index ab6d106d..5eb93b8c 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.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 @@ -210,7 +211,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { }, snap : { - value: function (xScreen, yScreen, snap3D, quadPt) + value: function (xScreen, yScreen, snap3D, quadPt) { // force a 3D snap if a 2D snap is requested but the 2D cache has not been initialized if (!snap3D && !this._elementCache) snap3D = true; @@ -282,7 +283,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { this.deactivateDragPlane(); this.setLastHit( rtnHit ); - + //rtnHit.test(); // DEBUG CODE. REMOVE THIS return rtnHit; } @@ -305,7 +306,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { var stageWorldPt0 = viewUtils.localToStageWorld( localPt0, stage ), stageWorldPt1 = viewUtils.localToStageWorld( localPt1, stage ); var vec = vecUtils.vecSubtract( 3, stageWorldPt1, stageWorldPt0 ); - + var ptOnWorkingPlane = MathUtils.vecIntersectPlane(stageWorldPt0, vec, workingPlane); var wpMat = drawUtils.getPlaneToWorldMatrix(workingPlane, MathUtils.getPointOnPlane(workingPlane)), @@ -1023,7 +1024,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { } }, - hSnapToElements : + hSnapToElements : { value: function( elt, hitRecs, depth, globalScrPt ) { @@ -1081,9 +1082,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { } }, - snapToElement : + snapToElement : { - value: function( elt, globalScrPt ) + value: function( elt, globalScrPt ) { if (this.isAvoidedElement(elt) ) return null; @@ -1096,7 +1097,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { var eltMat = viewUtils.getLocalToGlobalMatrix( elt ); for (var i=0; i<4; i++) bounds3D[i] = viewUtils.localToGlobal2(bounds[i], eltMat); - + var hitRec = this.snapToScreenBounds( elt, globalScrPt, bounds, bounds3D ); // see if we can snap to a contained geometry object @@ -1117,9 +1118,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { } }, - snapToScreenBounds : + snapToScreenBounds : { - value: function( elt, scrPt, bounds, bounds3D ) + value: function( elt, scrPt, bounds, bounds3D ) { // push the element as the current viewport element viewUtils.pushViewportObj( elt ); @@ -1328,9 +1329,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { } }, - hSnapToContainedElements : + hSnapToContainedElements : { - value: function( eyePt, dir, glObj, hitRec, targetScrPt ) + value: function( eyePt, dir, glObj, hitRec, targetScrPt ) { if (!glObj) return false; @@ -1345,7 +1346,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { doSnapToContainedElement: { - value: function( eyePt, dir, glObj, hitRec, targetScrPt ) + value: function( eyePt, dir, glObj, hitRec, targetScrPt ) { var rtnVal = false; @@ -1443,9 +1444,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { } }, - snapToContainedElement : + snapToContainedElement : { - value: function( eyePt, dir, glObj, hitRec, targetScrPt ) + value: function( eyePt, dir, glObj, hitRec, targetScrPt ) { var rtnVal = false; var elt = hitRec.getElement(); @@ -1466,10 +1467,10 @@ 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: rtnVal = this.doSnapToContainedElement( eyePt, dir, glObj, hitRec, targetScrPt ); break; @@ -1519,7 +1520,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { // add the projection matrix var projMat = world.makePerspectiveMatrix(); //var projInv = projMat.inverse(); - var projInv = glmat4.inverse(projMat, []); + var projInv = glmat4.inverse(projMat, []); var camInv = world.getCameraMatInverse(); //var glToNDC = projMat.multiply( camInv ); var glToNDC = glmat4.multiply( projMat, camInv, [] ); @@ -1569,9 +1570,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { } }, - GLToView : + GLToView : { - value: function( glPt, world ) + value: function( glPt, world ) { var projMat = world.makePerspectiveMatrix(); //var mat = projMat.multiply( world.getCameraMatInverse() ); @@ -2134,7 +2135,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { drawHit : { - value: function( hitRec ) + value: function( hitRec ) { if (hitRec) { -- cgit v1.2.3