Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 5, 2018. It is now read-only.

Commit5e54188

Browse files
committed
rebuild
1 parent92680ca commit5e54188

File tree

2 files changed

+471
-472
lines changed

2 files changed

+471
-472
lines changed

‎processing.js‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ window.Processing = require('./src/')(Browser);
2525
},{"./src/":28}],2:[function(require,module,exports){
2626
module.exports={
2727
"name": "processing-js",
28-
"version": "1.6.4",
28+
"version": "1.6.5",
2929
"author": "Processing.js",
3030
"repository": {
3131
"type": "git",
@@ -7510,7 +7510,10 @@ module.exports = (function commonFunctions(undef) {
75107510
/**
75117511
* Touch and Mouse event handling
75127512
*/
7513-
module.exports = function withTouch(p, curElement, attachEventHandler, document, PConstants, undef) {
7513+
module.exports = function withTouch(p, curElement, attachEventHandler, detachEventHandlersByType, document, PConstants, undef) {
7514+
7515+
// List of mouse event types
7516+
var mouseTypes = ['mouseout','mousemove','mousedown','mouseup','DOMMouseScroll','mousewheel','touchstart'];
75147517

75157518
/**
75167519
* Determine the location of the (mouse) pointer.
@@ -7605,16 +7608,9 @@ module.exports = function withTouch(p, curElement, attachEventHandler, document,
76057608
curElement.setAttribute("style","-webkit-user-select: none");
76067609
curElement.setAttribute("onclick","void(0)");
76077610
curElement.setAttribute("style","-webkit-tap-highlight-color:rgba(0,0,0,0)");
7608-
// Loop though eventHandlers and remove mouse listeners
7609-
for (var i=0, ehl=eventHandlers.length; i<ehl; i++) {
7610-
var type = eventHandlers[i].type;
7611-
// Have this function remove itself from the eventHandlers list too
7612-
if (type === "mouseout" || type === "mousemove" ||
7613-
type === "mousedown" || type === "mouseup" ||
7614-
type === "DOMMouseScroll" || type === "mousewheel" || type === "touchstart") {
7615-
detachEventHandler(eventHandlers[i]);
7616-
}
7617-
}
7611+
7612+
// Remove mouse-type event listeners
7613+
detachEventHandlersByType(curElement, mouseTypes);
76187614

76197615
// If there are any native touch events defined in the sketch, connect all of them
76207616
// Otherwise, connect all of the emulated mouse events
@@ -7690,9 +7686,6 @@ module.exports = function withTouch(p, curElement, attachEventHandler, document,
76907686
}
76917687
});
76927688
}
7693-
7694-
// Refire the touch start event we consumed in this function
7695-
curElement.dispatchEvent(t);
76967689
});
76977690

76987691
/**
@@ -9717,9 +9710,7 @@ module.exports = function setupParser(Processing, options) {
97179710
////////////////////////////////////////////////////////////////////////////
97189711
// JavaScript event binding and releasing
97199712
////////////////////////////////////////////////////////////////////////////
9720-
9721-
var eventHandlers = [];
9722-
9713+
var eventHandlers = [];
97239714
function attachEventHandler(elem, type, fn) {
97249715
if (elem.addEventListener) {
97259716
elem.addEventListener(type, fn, false);
@@ -9740,6 +9731,14 @@ module.exports = function setupParser(Processing, options) {
97409731
}
97419732
}
97429733

9734+
function detachEventHandlersByType(element, types) {
9735+
Object.keys(eventHandlers).forEach(function(eventHandler) {
9736+
if (types.indexOf(eventHandler.type) > -1 && (eventHandler.elem == element)) {
9737+
detachEventHandler(eventHandler.type);
9738+
}
9739+
});
9740+
}
9741+
97439742
function removeFirstArgument(args) {
97449743
return Array.prototype.slice.call(args, 1);
97459744
}
@@ -9751,10 +9750,11 @@ module.exports = function setupParser(Processing, options) {
97519750
p.Char = p.Character = Char;
97529751

97539752
// add in the Processing API functions
9753+
eventHandlers = [];
97549754
extend.withCommonFunctions(p);
97559755
extend.withMath(p);
97569756
extend.withProxyFunctions(p, removeFirstArgument);
9757-
extend.withTouch(p, curElement, attachEventHandler, document, PConstants);
9757+
extend.withTouch(p, curElement, attachEventHandler,detachEventHandlersByType,document, PConstants);
97589758

97599759
// custom functions and properties are added here
97609760
if(aFunctions) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp