Reposition phantoms on init

When the toolbar animates, the position of the surface changes.
ProtectedNode now listens for the toolbarPosition event and
repositions the phantoms.

I also tried moving the localOverlay to be a sibling of the surface
(instead of child of body), but the same problems persisted.

Bug: 49853

Change-Id: I8ae1c8f66c6083b4ffee7107a78a298126e1064c
This commit is contained in:
Christian Williams 2013-06-25 17:58:59 -07:00 committed by Catrope
parent d31918d145
commit 867ec44a9f

View file

@ -65,7 +65,7 @@ ve.ce.ProtectedNode.static.$phantomTemplate = $( '<div>' )
* @method
*/
ve.ce.ProtectedNode.prototype.onProtectedSetup = function () {
var $shield, surfaceModel,
var $shield, surfaceModel, surface,
node = this,
$shieldTemplate = this.constructor.static.$shieldTemplate;
@ -75,10 +75,12 @@ ve.ce.ProtectedNode.prototype.onProtectedSetup = function () {
this.isSetup = true;
surfaceModel = this.getRoot().getSurface().getModel();
surface = this.getRoot().getSurface().getSurface();
// Events
this.$.on( 'mouseenter.ve-ce-protectedNode', ve.bind( this.onProtectedMouseEnter, this ) );
surfaceModel.connect( this, { 'change': 'onSurfaceModelChange' } );
surface.connect( this, { 'toolbarPosition': 'positionPhantoms' } );
// Shields
this.$.add( this.$.find( '*' ) ).each( function () {