jenkins-bot has submitted this change and it was merged.
Change subject: Remove half-baked touch event handling
......................................................................
Remove half-baked touch event handling
Appears to be doing more harm than good. Added in c2ee74f2.
Verified that the toolbars still work on a Windows 8.1 tablet and
an Android 4.4 smartphone.
Bug: T87818
Bug: T91757
Change-Id: I05895e8a348259cc0c2dec06461e33f2f6a1700d
---
M src/ToolGroup.js
M src/Toolbar.js
M src/toolgroups/PopupToolGroup.js
3 files changed, 9 insertions(+), 14 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/ToolGroup.js b/src/ToolGroup.js
index a2fe30d..9046dae 100644
--- a/src/ToolGroup.js
+++ b/src/ToolGroup.js
@@ -49,8 +49,8 @@
// Events
this.$element.on( {
- 'mousedown touchstart': this.onPointerDown.bind( this ),
- 'mouseup touchend': this.onPointerUp.bind( this ),
+ mousedown: this.onPointerDown.bind( this ),
+ mouseup: this.onPointerUp.bind( this ),
mouseover: this.onMouseOver.bind( this ),
mouseout: this.onMouseOut.bind( this )
} );
@@ -140,8 +140,7 @@
* @param {jQuery.Event} e Mouse down event
*/
OO.ui.ToolGroup.prototype.onPointerDown = function ( e ) {
- // e.which is 0 for touch events, 1 for left mouse button
- if ( !this.isDisabled() && e.which <= 1 ) {
+ if ( !this.isDisabled() && e.which === 1 ) {
this.pressed = this.getTargetTool( e );
if ( this.pressed ) {
this.pressed.setActive( true );
@@ -173,8 +172,7 @@
OO.ui.ToolGroup.prototype.onPointerUp = function ( e ) {
var tool = this.getTargetTool( e );
- // e.which is 0 for touch events, 1 for left mouse button
- if ( !this.isDisabled() && e.which <= 1 && this.pressed && this.pressed
=== tool ) {
+ if ( !this.isDisabled() && e.which === 1 && this.pressed &&
this.pressed === tool ) {
this.pressed.onSelect();
}
diff --git a/src/Toolbar.js b/src/Toolbar.js
index ea274bd..598b4d2 100644
--- a/src/Toolbar.js
+++ b/src/Toolbar.js
@@ -43,7 +43,7 @@
// Events
this.$element
.add( this.$bar ).add( this.$group ).add( this.$actions )
- .on( 'mousedown touchstart', this.onPointerDown.bind( this ) );
+ .on( 'mousedown', this.onPointerDown.bind( this ) );
// Initialization
this.$group.addClass( 'oo-ui-toolbar-tools' );
diff --git a/src/toolgroups/PopupToolGroup.js b/src/toolgroups/PopupToolGroup.js
index 278a1fc..437c3d0 100644
--- a/src/toolgroups/PopupToolGroup.js
+++ b/src/toolgroups/PopupToolGroup.js
@@ -43,8 +43,8 @@
// Events
this.$handle.on( {
- 'mousedown touchstart': this.onHandlePointerDown.bind( this ),
- 'mouseup touchend': this.onHandlePointerUp.bind( this )
+ mousedown: this.onHandlePointerDown.bind( this ),
+ mouseup: this.onHandlePointerUp.bind( this )
} );
// Initialization
@@ -109,10 +109,8 @@
* @inheritdoc
*/
OO.ui.PopupToolGroup.prototype.onPointerUp = function ( e ) {
- // e.which is 0 for touch events, 1 for left mouse button
// Only close toolgroup when a tool was actually selected
- // FIXME: this duplicates logic from the parent class
- if ( !this.isDisabled() && e.which <= 1 && this.pressed && this.pressed
=== this.getTargetTool( e ) ) {
+ if ( !this.isDisabled() && e.which === 1 && this.pressed &&
this.pressed === this.getTargetTool( e ) ) {
this.setActive( false );
}
return OO.ui.PopupToolGroup.super.prototype.onPointerUp.call( this, e );
@@ -133,8 +131,7 @@
* @param {jQuery.Event} e Mouse down event
*/
OO.ui.PopupToolGroup.prototype.onHandlePointerDown = function ( e ) {
- // e.which is 0 for touch events, 1 for left mouse button
- if ( !this.isDisabled() && e.which <= 1 ) {
+ if ( !this.isDisabled() && e.which === 1 ) {
this.setActive( !this.active );
}
return false;
--
To view, visit https://gerrit.wikimedia.org/r/195067
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I05895e8a348259cc0c2dec06461e33f2f6a1700d
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoĆski <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits