jenkins-bot has submitted this change and it was merged.
Change subject: (bug 43461) Hide Phantoms
......................................................................
(bug 43461) Hide Phantoms
This fixes a problem that phantoms would remain visible if moving the mouse
quickly. Now binding to mousemove and also mouseout.
Change-Id: I4f5e3319038828f83b108e9f5a45f54ebfeb7027
---
M modules/ve/ce/nodes/ve.ce.AlienNode.js
1 file changed, 29 insertions(+), 5 deletions(-)
Approvals:
Trevor Parscal: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve/ce/nodes/ve.ce.AlienNode.js
b/modules/ve/ce/nodes/ve.ce.AlienNode.js
index 363a6a0..cb4399c 100644
--- a/modules/ve/ce/nodes/ve.ce.AlienNode.js
+++ b/modules/ve/ce/nodes/ve.ce.AlienNode.js
@@ -61,7 +61,10 @@
);
} );
surface.replacePhantoms( $phantoms );
- surface.$.on( 'mousemove.phantoms', ve.bind( this.onSurfaceMouseMove,
this ) );
+ surface.$.on({
+ 'mousemove.phantoms': ve.bind( this.onSurfaceMouseMove, this ),
+ 'mouseout.phantoms': ve.bind( this.onSurfaceMouseOut, this )
+ });
};
/**
@@ -103,17 +106,38 @@
* @param {jQuery.Event} e
*/
ve.ce.AlienNode.prototype.onSurfaceMouseMove = function ( e ) {
- var surface, $target = $( e.target );
+ var $target = $( e.target );
if (
!$target.hasClass( 've-ce-surface-phantom' ) &&
$target.closest( '.ve-ce-alienNode' ).length === 0
) {
- surface = this.root.getSurface();
- surface.replacePhantoms( null );
- surface.$.unbind( 'mousemove.phantoms' );
+ this.clearPhantoms();
}
};
+/**
+ * Handle surface mouse out events.
+ *
+ * @method
+ * @param {jQuery.Event} e
+ */
+ve.ce.AlienNode.prototype.onSurfaceMouseOut = function ( e ) {
+ if ( e.toElement === null) {
+ this.clearPhantoms();
+ }
+};
+
+/**
+ * Clears all phantoms and unbinds .phantoms namespace event handlers
+ *
+ * @method
+ */
+ve.ce.AlienNode.prototype.clearPhantoms = function() {
+ var surface = this.root.getSurface();
+ surface.replacePhantoms( null );
+ surface.$.unbind( '.phantoms' );
+};
+
/* Registration */
ve.ce.nodeFactory.register( 'alien', ve.ce.AlienNode );
--
To view, visit https://gerrit.wikimedia.org/r/50309
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4f5e3319038828f83b108e9f5a45f54ebfeb7027
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Christian <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits