diff options
author | Nivesh Rajbhandari | 2012-02-14 14:37:42 -0800 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-02-14 14:37:42 -0800 |
commit | e80a79bff57fecf3aa9b869d8ed2de5fd815287c (patch) | |
tree | 708257a733fdd8e8f0aa4c7c507b02bef2457783 /js | |
parent | 43ca408a498a7895c26bacf7135e65e6b5b3602a (diff) | |
download | ninja-e80a79bff57fecf3aa9b869d8ed2de5fd815287c.tar.gz |
Fix for not being able to select an element in Top/Side view.
Fall back to use SnapManager code if elementFromPoint returns the viewport.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js')
-rw-r--r-- | js/stage/stage.reel/stage.js | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 6d9a7355..9cf97e09 100644 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -510,12 +510,37 @@ exports.Stage = Montage.create(Component, { | |||
510 | */ | 510 | */ |
511 | GetElement: { | 511 | GetElement: { |
512 | value: function(pos) { | 512 | value: function(pos) { |
513 | var point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(pos.pageX, pos.pageY)); | 513 | var point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(pos.pageX, pos.pageY)), |
514 | return this.application.ninja.currentDocument.GetElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop); | 514 | elt = this.application.ninja.currentDocument.GetElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop); |
515 | |||
516 | // workaround Chrome 3d bug | ||
517 | if(elt === this._viewport) | ||
518 | { | ||
519 | return this._getElementUsingSnapping(point); | ||
520 | } else { | ||
521 | return elt; | ||
522 | } | ||
515 | } | 523 | } |
516 | }, | 524 | }, |
517 | 525 | ||
518 | 526 | /** | |
527 | * _getElementUsingSnapping: Returns the object at point using snap manager | ||
528 | * | ||
529 | * @param: point | ||
530 | * @return: Returns the Object in the user document under the point | ||
531 | */ | ||
532 | _getElementUsingSnapping: { | ||
533 | value: function(point) { | ||
534 | this.stageDeps.snapManager.enableElementSnap( true ); | ||
535 | var hitRec = this.stageDeps.snapManager.snap(point.x, point.y, true); | ||
536 | this.stageDeps.snapManager.enableElementSnap( this.stageDeps.snapManager.elementSnapEnabledAppLevel() ); | ||
537 | if (hitRec) { | ||
538 | return hitRec.getElement(); | ||
539 | } else { | ||
540 | return null; | ||
541 | } | ||
542 | } | ||
543 | }, | ||
519 | 544 | ||
520 | 545 | ||
521 | draw: { | 546 | draw: { |