From 42c2a480a3883389e47d4ec291dfb55d99cf4b7f Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 29 May 2012 10:26:19 -0700 Subject: Cache perspective distance lookup to speed up user interaction. Signed-off-by: Nivesh Rajbhandari --- js/controllers/styles-controller.js | 5 +++-- js/helper-classes/3D/view-utils.js | 15 ++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'js') diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 534f77c7..e76e5a1b 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -1229,9 +1229,10 @@ var stylesController = exports.StylesController = Montage.create(Component, { } } if(isNaN(dist)) { - dist = null; + return "none"; + } else { + return dist; } - return dist; } }, diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index a3d09404..3c7ae6ff 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -195,7 +195,12 @@ exports.ViewUtils = Montage.create(Component, { getPerspectiveDistFromElement: { value: function( elt ) { - return ElementsMediator.getPerspectiveDist(elt); + var pDist = ElementsMediator.getPerspectiveDist(elt); + if(pDist === "none") { + return null; + } else { + return pDist; + } } }, @@ -1320,14 +1325,6 @@ exports.ViewUtils = Montage.create(Component, { } }, - getCurrentDocument: - { - value: function() - { - return snapManagerModule.SnapManager.application.ninja.currentDocument; - } - }, - setStageZoom: { value:function( globalPt, zoomFactor ) { var localPt; -- cgit v1.2.3