jenkins-bot has submitted this change and it was merged.

Change subject: mw.ViewPageTarget: Emit position event after toolbar is animated
......................................................................


mw.ViewPageTarget: Emit position event after toolbar is animated

In target#setUpSurface, both target#setUpToolbar and
target.surface#initialize are called. #setUpToolbar does an
asynchronous animation.

After that animation is completed we call target.toolbar.initialize
and target.surface.context.update.

Right now ce.ProtectedNode needs to update the position of its
shields when the CE Surface changes position (which it does when
the UI Surface changes position because of the UI Toolbar changing
position), and does so by listening to toolbarPosition.

Adding this event to allow it to listen to that instead.

Change-Id: I826986794630c04c34cef6da36ccb15ff7dde49a
---
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
M modules/ve/ui/ve.ui.Surface.js
2 files changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
index e109d13..8692895 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -1895,6 +1895,7 @@
                // Check the surface wasn't torn down while the toolbar was 
animating
                if ( this.surface ) {
                        this.toolbar.initialize();
+                       this.surface.emit( 'position' );
                        this.surface.getContext().update();
                }
        }, this ) );
diff --git a/modules/ve/ui/ve.ui.Surface.js b/modules/ve/ui/ve.ui.Surface.js
index 7112472..b811b92 100644
--- a/modules/ve/ui/ve.ui.Surface.js
+++ b/modules/ve/ui/ve.ui.Surface.js
@@ -65,6 +65,13 @@
 /* Events */
 
 /**
+ * When the surface changes its position (only if it happens
+ * after initialize has already been called).
+ *
+ * @event position
+ */
+
+/**
  * Whenever the toolbar $bar position is updated, the changes that took place.
  *
  * @event toolbarPosition

-- 
To view, visit https://gerrit.wikimedia.org/r/77039
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I826986794630c04c34cef6da36ccb15ff7dde49a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to