Trevor Parscal has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/59174


Change subject: Keep track of mouse down for select widgets
......................................................................

Keep track of mouse down for select widgets

This helps with some differences between browsers, specifically Firefox, where 
e.which would be 1 even if the mouse button was not pressed.

Change-Id: Ia88449c2bc84073d903dc702bb586127618d86f2
---
M modules/ve/ui/widgets/ve.ui.SelectWidget.js
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/74/59174/1

diff --git a/modules/ve/ui/widgets/ve.ui.SelectWidget.js 
b/modules/ve/ui/widgets/ve.ui.SelectWidget.js
index c75cb8c..218cbf1 100644
--- a/modules/ve/ui/widgets/ve.ui.SelectWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.SelectWidget.js
@@ -27,7 +27,7 @@
        ve.ui.GroupElement.call( this, this.$, config );
 
        // Properties
-       this.dragging = false;
+       this.pressed = false;
        this.selecting = null;
        this.hashes = {};
 
@@ -73,6 +73,7 @@
        var item;
 
        if ( !this.disabled && e.which === 1 ) {
+               this.pressed = true;
                item = this.getTargetItem( e );
                if ( item && item.isSelectable() ) {
                        this.selectItem( item, true );
@@ -91,6 +92,7 @@
  * @param {jQuery.Event} e Mouse down event
  */
 ve.ui.SelectWidget.prototype.onMouseUp = function ( e ) {
+       this.pressed = false;
        if ( !this.disabled && e.which === 1 && this.selecting ) {
                this.selectItem( this.selecting );
                this.selecting = null;
@@ -108,7 +110,7 @@
 ve.ui.SelectWidget.prototype.onMouseMove = function ( e ) {
        var item;
 
-       if ( !this.disabled && e.which === 1 ) {
+       if ( !this.disabled && this.pressed ) {
                item = this.getTargetItem( e );
                if ( item && item !== this.selecting && item.isSelectable() ) {
                        this.selectItem( item, true );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia88449c2bc84073d903dc702bb586127618d86f2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Trevor Parscal <[email protected]>

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

Reply via email to