mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Review cleanup
This commit is contained in:
parent
10c6d998c3
commit
7d435bdb99
3 changed files with 9 additions and 11 deletions
|
@ -533,7 +533,11 @@ Blockly.BlockSvg.prototype.onMouseDown_ = function(e) {
|
|||
}
|
||||
if (this.isInFlyout) {
|
||||
// longStart's simulation of right-clicks for longpresses on touch devices
|
||||
// calls the object's onMouseDown, instead of the flyout's onMouseDown.
|
||||
// calls the onMouseDown_ function defined on the prototype of the object
|
||||
// the was longpressed (in this case, a Blockly.BlockSvg). In this case
|
||||
// that behaviour is wrong, because Blockly.Flyout.prototype.blockMouseDown
|
||||
// should be called for a mousedown on a block in the flyout, which blocks
|
||||
// execution of the block's onMouseDown_ function.
|
||||
if (e.type == 'touchstart' && Blockly.isRightButton(e)) {
|
||||
Blockly.Flyout.blockRightClick_(e, this);
|
||||
e.stopPropagation();
|
||||
|
|
|
@ -187,19 +187,10 @@ Blockly.Touch.shouldHandleEvent = function(e) {
|
|||
* saved identifier.
|
||||
*/
|
||||
Blockly.Touch.checkTouchIdentifier = function(e) {
|
||||
var identifier;
|
||||
// TODO (fenichel): Improve splitEventByTouches to get rid of this try/catch.
|
||||
try {
|
||||
identifier = (e.changedTouches && e.changedTouches.item(0) &&
|
||||
e.changedTouches.item(0).identifier != undefined &&
|
||||
e.changedTouches.item(0).identifier != null) ?
|
||||
e.changedTouches.item(0).identifier : 'mouse';
|
||||
} catch (ex) {
|
||||
identifier = (e.changedTouches && e.changedTouches[0] &&
|
||||
var identifier = (e.changedTouches && e.changedTouches[0] &&
|
||||
e.changedTouches[0].identifier != undefined &&
|
||||
e.changedTouches[0].identifier != null) ?
|
||||
e.changedTouches[0].identifier : 'mouse';
|
||||
}
|
||||
|
||||
// if (Blockly.touchIdentifier_ )is insufficient because android touch
|
||||
// identifiers may be zero.
|
||||
|
|
|
@ -96,6 +96,9 @@ Blockly.hasClass_ = function(element, className) {
|
|||
* @param {string} name Event name to listen to (e.g. 'mousedown').
|
||||
* @param {Object} thisObject The value of 'this' in the function.
|
||||
* @param {!Function} func Function to call when event is triggered.
|
||||
* @param {boolean} opt_noCaptureIdentifier True if triggering on this event
|
||||
* should not block execution of other event handlers on this touch or other
|
||||
* simultaneous touches.
|
||||
* @return {!Array.<!Array>} Opaque data that can be passed to unbindEvent_.
|
||||
* @private
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue