melonjs 9.1.0 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{LICENSE → LICENSE.md} +0 -0
- package/README.md +93 -57
- package/dist/melonjs.js +10334 -11179
- package/dist/melonjs.min.js +4 -10
- package/dist/melonjs.module.d.ts +13206 -0
- package/dist/melonjs.module.js +9913 -10872
- package/package.json +19 -14
- package/src/audio/audio.js +477 -553
- package/src/camera/camera2d.js +67 -65
- package/src/entity/draggable.js +26 -35
- package/src/entity/droptarget.js +17 -14
- package/src/entity/entity.js +59 -79
- package/src/game.js +194 -204
- package/src/index.js +12 -30
- package/src/input/gamepad.js +8 -19
- package/src/input/keyboard.js +4 -4
- package/src/input/pointer.js +14 -12
- package/src/input/pointerevent.js +15 -13
- package/src/lang/deprecated.js +2 -887
- package/src/level/level.js +3 -3
- package/src/level/tiled/TMXGroup.js +7 -11
- package/src/level/tiled/TMXLayer.js +33 -32
- package/src/level/tiled/TMXTileMap.js +15 -19
- package/src/level/tiled/TMXTileset.js +5 -5
- package/src/level/tiled/TMXUtils.js +3 -3
- package/src/level/tiled/renderer/TMXRenderer.js +4 -0
- package/src/loader/loader.js +8 -23
- package/src/loader/loadingscreen.js +51 -60
- package/src/math/matrix3.js +1 -1
- package/src/particles/emitter.js +36 -39
- package/src/particles/particle.js +27 -12
- package/src/particles/particlecontainer.js +17 -16
- package/src/physics/body.js +80 -118
- package/src/physics/collision.js +5 -235
- package/src/physics/detector.js +235 -0
- package/src/physics/quadtree.js +14 -14
- package/src/physics/world.js +84 -18
- package/src/plugin/plugin.js +26 -24
- package/src/polyfill/console.js +9 -14
- package/src/renderable/GUI.js +48 -62
- package/src/renderable/collectable.js +11 -4
- package/src/renderable/colorlayer.js +28 -26
- package/src/renderable/container.js +120 -96
- package/src/renderable/imagelayer.js +94 -93
- package/src/renderable/renderable.js +164 -138
- package/src/renderable/sprite.js +42 -44
- package/src/renderable/trigger.js +24 -17
- package/src/shapes/ellipse.js +27 -27
- package/src/shapes/line.js +12 -8
- package/src/shapes/poly.js +77 -49
- package/src/shapes/rectangle.js +193 -268
- package/src/state/stage.js +23 -25
- package/src/state/state.js +35 -86
- package/src/system/device.js +233 -285
- package/src/system/event.js +485 -432
- package/src/system/pooling.js +61 -54
- package/src/system/save.js +17 -16
- package/src/system/timer.js +34 -38
- package/src/text/bitmaptext.js +44 -46
- package/src/text/text.js +39 -34
- package/src/tweens/easing.js +0 -2
- package/src/tweens/interpolation.js +3 -8
- package/src/tweens/tween.js +332 -351
- package/src/utils/function.js +6 -8
- package/src/utils/utils.js +34 -30
- package/src/video/canvas/canvas_renderer.js +13 -8
- package/src/video/renderer.js +8 -7
- package/src/video/texture.js +8 -8
- package/src/video/texture_cache.js +5 -5
- package/src/video/video.js +373 -403
- package/src/video/webgl/glshader.js +2 -2
- package/src/video/webgl/webgl_compositor.js +14 -8
- package/src/video/webgl/webgl_renderer.js +21 -19
- package/plugins/debug/debugPanel.js +0 -770
- package/plugins/debug/font/PressStart2P.fnt +0 -100
- package/plugins/debug/font/PressStart2P.ltr +0 -1
- package/plugins/debug/font/PressStart2P.png +0 -0
- package/plugins/debug/particleDebugPanel.js +0 -303
package/src/index.js
CHANGED
|
@@ -2,23 +2,18 @@
|
|
|
2
2
|
import "./polyfill/console.js";
|
|
3
3
|
import "./polyfill/requestAnimationFrame.js";
|
|
4
4
|
|
|
5
|
-
// external dependencies
|
|
6
|
-
import "jay-extend";
|
|
7
|
-
// jay-extend does not properly export Jay
|
|
8
|
-
var Jay = window.Jay;
|
|
9
|
-
|
|
10
5
|
// utility classes
|
|
11
|
-
import audio from "./audio/audio.js";
|
|
6
|
+
import * as audio from "./audio/audio.js";
|
|
12
7
|
import collision from "./physics/collision.js";
|
|
13
8
|
import device from "./system/device.js";
|
|
14
|
-
import event from "./system/event.js";
|
|
15
|
-
import game from "./game.js";
|
|
9
|
+
import * as event from "./system/event.js";
|
|
10
|
+
import * as game from "./game.js";
|
|
16
11
|
import loader from "./loader/loader.js";
|
|
17
12
|
import * as Math from "./math/math.js";
|
|
18
13
|
import utils from "./utils/utils.js";
|
|
19
14
|
import * as input from "./input/input.js";
|
|
20
15
|
import { plugin, plugins } from "./plugin/plugin.js";
|
|
21
|
-
import video from "./video/video.js";
|
|
16
|
+
import * as video from "./video/video.js";
|
|
22
17
|
import save from "./system/save.js";
|
|
23
18
|
import timer from "./system/timer.js";
|
|
24
19
|
import pool from "./system/pooling.js";
|
|
@@ -71,7 +66,7 @@ import Stage from "./state/stage.js";
|
|
|
71
66
|
import Camera2d from "./camera/camera2d.js";
|
|
72
67
|
import Container from "./renderable/container.js";
|
|
73
68
|
import World from "./physics/world.js";
|
|
74
|
-
import ParticleEmitter from "./particles/emitter.js";
|
|
69
|
+
import { ParticleEmitterSettings, ParticleEmitter } from "./particles/emitter.js";
|
|
75
70
|
import Particle from "./particles/particle.js";
|
|
76
71
|
import Entity from "./entity/entity.js";
|
|
77
72
|
import DraggableEntity from "./entity/draggable.js";
|
|
@@ -123,8 +118,6 @@ export {
|
|
|
123
118
|
|
|
124
119
|
// export all class definition
|
|
125
120
|
export {
|
|
126
|
-
// export as me.Object for backward compatibility
|
|
127
|
-
Jay as Object,
|
|
128
121
|
Color,
|
|
129
122
|
Vector2d,
|
|
130
123
|
Vector3d,
|
|
@@ -171,6 +164,7 @@ export {
|
|
|
171
164
|
Container,
|
|
172
165
|
World,
|
|
173
166
|
ParticleEmitter,
|
|
167
|
+
ParticleEmitterSettings,
|
|
174
168
|
Particle,
|
|
175
169
|
Entity,
|
|
176
170
|
DraggableEntity,
|
|
@@ -218,9 +212,6 @@ export function boot() {
|
|
|
218
212
|
return;
|
|
219
213
|
}
|
|
220
214
|
|
|
221
|
-
// check the device capabilites
|
|
222
|
-
device._check();
|
|
223
|
-
|
|
224
215
|
// register all built-ins objects into the object pool
|
|
225
216
|
pool.register("me.Entity", Entity);
|
|
226
217
|
pool.register("me.Collectable", Collectable);
|
|
@@ -231,9 +222,9 @@ export function boot() {
|
|
|
231
222
|
pool.register("me.Sprite", Sprite);
|
|
232
223
|
pool.register("me.Renderable", Renderable);
|
|
233
224
|
pool.register("me.Text", Text, true);
|
|
234
|
-
pool.register("me.BitmapText", BitmapText
|
|
225
|
+
pool.register("me.BitmapText", BitmapText);
|
|
235
226
|
pool.register("me.BitmapTextData", BitmapTextData, true);
|
|
236
|
-
pool.register("me.ImageLayer", ImageLayer
|
|
227
|
+
pool.register("me.ImageLayer", ImageLayer);
|
|
237
228
|
pool.register("me.ColorLayer", ColorLayer, true);
|
|
238
229
|
pool.register("me.Vector2d", Vector2d, true);
|
|
239
230
|
pool.register("me.Vector3d", Vector3d, true);
|
|
@@ -257,9 +248,9 @@ export function boot() {
|
|
|
257
248
|
pool.register("Sprite", Sprite);
|
|
258
249
|
pool.register("Renderable", Renderable);
|
|
259
250
|
pool.register("Text", Text, true);
|
|
260
|
-
pool.register("BitmapText", BitmapText
|
|
251
|
+
pool.register("BitmapText", BitmapText);
|
|
261
252
|
pool.register("BitmapTextData", BitmapTextData, true);
|
|
262
|
-
pool.register("ImageLayer", ImageLayer
|
|
253
|
+
pool.register("ImageLayer", ImageLayer);
|
|
263
254
|
pool.register("ColorLayer", ColorLayer, true);
|
|
264
255
|
pool.register("Vector2d", Vector2d, true);
|
|
265
256
|
pool.register("Vector3d", Vector3d, true);
|
|
@@ -273,24 +264,15 @@ export function boot() {
|
|
|
273
264
|
pool.register("Ellipse", Ellipse, true);
|
|
274
265
|
pool.register("Bounds", Bounds, true);
|
|
275
266
|
|
|
276
|
-
//
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
// init the FPS counter if needed
|
|
280
|
-
timer.init();
|
|
267
|
+
// publish Boot notification
|
|
268
|
+
event.emit(event.BOOT);
|
|
281
269
|
|
|
282
270
|
// enable/disable the cache
|
|
283
271
|
loader.setNocache( utils.getUriFragment().nocache || false );
|
|
284
272
|
|
|
285
|
-
// init the stage Manager
|
|
286
|
-
state.init();
|
|
287
|
-
|
|
288
273
|
// automatically enable keyboard events
|
|
289
274
|
input.initKeyboardEvent();
|
|
290
275
|
|
|
291
|
-
// game instance init
|
|
292
|
-
game.init();
|
|
293
|
-
|
|
294
276
|
// mark melonJS as initialized
|
|
295
277
|
initialized = true;
|
|
296
278
|
|
package/src/input/gamepad.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
import {getBindingKey, triggerKeyEvent} from "./keyboard.js";
|
|
2
|
-
import event from "./../system/event.js";
|
|
2
|
+
import * as event from "./../system/event.js";
|
|
3
3
|
|
|
4
4
|
// Analog deadzone
|
|
5
5
|
var deadzone = 0.1;
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* A function that returns a normalized value in range [-1.0..1.0], or 0.0 if the axis is unknown.
|
|
9
|
-
* @callback me.input~normalize_fn
|
|
10
|
-
* @param {Number} value The raw value read from the gamepad driver
|
|
11
|
-
* @param {Number} axis The axis index from the standard mapping, or -1 if not an axis
|
|
12
|
-
* @param {Number} button The button index from the standard mapping, or -1 if not a button
|
|
13
|
-
*/
|
|
14
|
-
function defaultNormalizeFn(value) {
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
7
|
/**
|
|
19
8
|
* Normalize axis values for wired Xbox 360
|
|
20
9
|
* @ignore
|
|
@@ -82,7 +71,7 @@ function addMapping(id, mapping) {
|
|
|
82
71
|
mapping.analog = mapping.analog || mapping.buttons.map(function () {
|
|
83
72
|
return -1;
|
|
84
73
|
});
|
|
85
|
-
mapping.normalize_fn = mapping.normalize_fn ||
|
|
74
|
+
mapping.normalize_fn = mapping.normalize_fn || function (value) { return value; };
|
|
86
75
|
|
|
87
76
|
remap.set(expanded_id, mapping);
|
|
88
77
|
remap.set(sparse_id, mapping);
|
|
@@ -202,7 +191,7 @@ var updateGamepads = function () {
|
|
|
202
191
|
}
|
|
203
192
|
}
|
|
204
193
|
|
|
205
|
-
event.
|
|
194
|
+
event.emit(event.GAMEPAD_UPDATE, index, "buttons", +button, current);
|
|
206
195
|
|
|
207
196
|
// Edge detection
|
|
208
197
|
if (!last.pressed && current.pressed) {
|
|
@@ -246,7 +235,7 @@ var updateGamepads = function () {
|
|
|
246
235
|
}
|
|
247
236
|
var pressed = (Math.abs(value) >= (deadzone + Math.abs(last[range].threshold)));
|
|
248
237
|
|
|
249
|
-
event.
|
|
238
|
+
event.emit(event.GAMEPAD_UPDATE, index, "axes", +axis, value);
|
|
250
239
|
|
|
251
240
|
// Edge detection
|
|
252
241
|
if (!last[range].pressed && pressed) {
|
|
@@ -276,7 +265,7 @@ var updateGamepads = function () {
|
|
|
276
265
|
* @ignore
|
|
277
266
|
*/
|
|
278
267
|
window.addEventListener("gamepadconnected", function (e) {
|
|
279
|
-
event.
|
|
268
|
+
event.emit(event.GAMEPAD_CONNECTED, e.gamepad);
|
|
280
269
|
}, false);
|
|
281
270
|
|
|
282
271
|
/**
|
|
@@ -284,7 +273,7 @@ window.addEventListener("gamepadconnected", function (e) {
|
|
|
284
273
|
* @ignore
|
|
285
274
|
*/
|
|
286
275
|
window.addEventListener("gamepaddisconnected", function (e) {
|
|
287
|
-
event.
|
|
276
|
+
event.emit(event.GAMEPAD_DISCONNECTED, e.gamepad);
|
|
288
277
|
}, false);
|
|
289
278
|
|
|
290
279
|
/*
|
|
@@ -395,7 +384,7 @@ export function bindGamepad(index, button, keyCode) {
|
|
|
395
384
|
// register to the the update event if not yet done and supported by the browser
|
|
396
385
|
// if not supported, the function will fail silently (-> update loop won't be called)
|
|
397
386
|
if (typeof updateEventHandler === "undefined" && typeof navigator.getGamepads === "function") {
|
|
398
|
-
updateEventHandler = event.
|
|
387
|
+
updateEventHandler = event.on(event.GAME_BEFORE_UPDATE, updateGamepads);
|
|
399
388
|
}
|
|
400
389
|
|
|
401
390
|
// Allocate bindings if not defined
|
|
@@ -484,7 +473,7 @@ export function setGamepadDeadzone(value) {
|
|
|
484
473
|
* @param {Number[]} mapping.axes Standard analog control stick axis locations
|
|
485
474
|
* @param {Number[]} mapping.buttons Standard digital button locations
|
|
486
475
|
* @param {Number[]} [mapping.analog] Analog axis locations for buttons
|
|
487
|
-
* @param {
|
|
476
|
+
* @param {Function} [mapping.normalize_fn] a function that returns a normalized value in range [-1.0..1.0] for the given value, axis and button
|
|
488
477
|
* @example
|
|
489
478
|
* // A weird controller that has its axis mappings reversed
|
|
490
479
|
* me.input.setGamepadMapping("Generic USB Controller", {
|
package/src/input/keyboard.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {preventDefault as preventDefaultAction} from "./input.js";
|
|
2
|
-
import event from "./../system/event.js";
|
|
2
|
+
import * as event from "./../system/event.js";
|
|
3
3
|
import device from "./../system/device.js";
|
|
4
4
|
|
|
5
5
|
// corresponding actions
|
|
@@ -29,11 +29,11 @@ var keyDownEvent = function (e, keyCode, mouseButton) {
|
|
|
29
29
|
var action = _keyBindings[keyCode];
|
|
30
30
|
|
|
31
31
|
// publish a message for keydown event
|
|
32
|
-
event.
|
|
32
|
+
event.emit(event.KEYDOWN,
|
|
33
33
|
action,
|
|
34
34
|
keyCode,
|
|
35
35
|
action ? !_keyLocked[action] : true
|
|
36
|
-
|
|
36
|
+
);
|
|
37
37
|
|
|
38
38
|
if (action) {
|
|
39
39
|
if (!_keyLocked[action]) {
|
|
@@ -66,7 +66,7 @@ var keyUpEvent = function (e, keyCode, mouseButton) {
|
|
|
66
66
|
var action = _keyBindings[keyCode];
|
|
67
67
|
|
|
68
68
|
// publish a message for keydown event
|
|
69
|
-
event.
|
|
69
|
+
event.emit(event.KEYUP, action, keyCode);
|
|
70
70
|
|
|
71
71
|
if (action) {
|
|
72
72
|
var trigger = (typeof mouseButton !== "undefined") ? mouseButton : keyCode;
|
package/src/input/pointer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Vector2d from "./../math/vector2.js";
|
|
2
2
|
import device from "./../system/device.js";
|
|
3
3
|
import Rect from "./../shapes/rectangle.js";
|
|
4
|
-
import
|
|
4
|
+
import { viewport } from "./../game.js";
|
|
5
5
|
import { globalToLocal } from "./input.js";
|
|
6
6
|
|
|
7
7
|
|
|
@@ -12,18 +12,22 @@ import { globalToLocal } from "./input.js";
|
|
|
12
12
|
var viewportOffset = new Vector2d();
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
+
* @classdesc
|
|
15
16
|
* a pointer object, representing a single finger on a touch enabled device.
|
|
16
17
|
* @class
|
|
17
18
|
* @extends me.Rect
|
|
18
19
|
* @memberOf me
|
|
19
20
|
* @constructor
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
+
class Pointer extends Rect {
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* @ignore
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
+
constructor(x = 0, y = 0, w = 1, h = 1) {
|
|
28
|
+
|
|
29
|
+
// parent constructor
|
|
30
|
+
super(x, y, w, h);
|
|
27
31
|
|
|
28
32
|
/**
|
|
29
33
|
* constant for left button
|
|
@@ -261,10 +265,7 @@ var Pointer = Rect.extend({
|
|
|
261
265
|
|
|
262
266
|
// bind list for mouse buttons
|
|
263
267
|
this.bind = [ 0, 0, 0 ];
|
|
264
|
-
|
|
265
|
-
// parent constructor
|
|
266
|
-
this._super(Rect, "init", [x, y, w, h]);
|
|
267
|
-
},
|
|
268
|
+
}
|
|
268
269
|
|
|
269
270
|
/**
|
|
270
271
|
* initialize the Pointer object using the given Event Object
|
|
@@ -278,7 +279,7 @@ var Pointer = Rect.extend({
|
|
|
278
279
|
* @param {Number} [clientX=0] the vertical coordinate within the application's client area at which the event occurred
|
|
279
280
|
* @param {Number} [pointedId=1] the Pointer, Touch or Mouse event Id (1)
|
|
280
281
|
*/
|
|
281
|
-
setEvent
|
|
282
|
+
setEvent(event, pageX = 0, pageY = 0, clientX = 0, clientY = 0, pointerId = 1) {
|
|
282
283
|
var width = 1;
|
|
283
284
|
var height = 1;
|
|
284
285
|
|
|
@@ -320,9 +321,9 @@ var Pointer = Rect.extend({
|
|
|
320
321
|
this.gameScreenX = this.pos.x;
|
|
321
322
|
this.gameScreenY = this.pos.y;
|
|
322
323
|
|
|
323
|
-
// get the current screen to world offset
|
|
324
|
-
if (typeof
|
|
325
|
-
|
|
324
|
+
// get the current screen to game world offset
|
|
325
|
+
if (typeof viewport !== "undefined") {
|
|
326
|
+
viewport.localToWorld(this.gameScreenX, this.gameScreenY, viewportOffset);
|
|
326
327
|
}
|
|
327
328
|
|
|
328
329
|
/* Initialize the two coordinate space properties. */
|
|
@@ -342,5 +343,6 @@ var Pointer = Rect.extend({
|
|
|
342
343
|
// resize the pointer object accordingly
|
|
343
344
|
this.resize(width, height);
|
|
344
345
|
}
|
|
345
|
-
}
|
|
346
|
+
};
|
|
347
|
+
|
|
346
348
|
export default Pointer;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {preventDefault} from "./input.js";
|
|
2
2
|
import {getBindingKey, triggerKeyEvent} from "./keyboard.js";
|
|
3
3
|
import Vector2d from "./../math/vector2.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import { renderer, scaleRatio } from "./../video/video.js";
|
|
5
|
+
import * as fctUtil from "./../utils/function.js";
|
|
6
|
+
import * as arrayUtil from "./../utils/array.js";
|
|
7
|
+
import * as event from "./../system/event.js";
|
|
7
8
|
import timer from "./../system/timer.js";
|
|
8
9
|
import pool from "./../system/pooling.js";
|
|
9
10
|
import device from "./../system/device.js";
|
|
@@ -11,7 +12,7 @@ import Pointer from "./pointer.js";
|
|
|
11
12
|
import Rect from "./../shapes/rectangle.js";
|
|
12
13
|
import Container from "./../renderable/container.js";
|
|
13
14
|
import Renderable from "./../renderable/renderable.js";
|
|
14
|
-
import
|
|
15
|
+
import { world, viewport } from "./../game.js";
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -129,7 +130,7 @@ function enablePointerEvent() {
|
|
|
129
130
|
|
|
130
131
|
if (pointerEventTarget === null) {
|
|
131
132
|
// default pointer event target
|
|
132
|
-
pointerEventTarget =
|
|
133
|
+
pointerEventTarget = renderer.getScreenCanvas();
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
if (device.PointerEvent) {
|
|
@@ -182,7 +183,7 @@ function enablePointerEvent() {
|
|
|
182
183
|
if (activeEventList.indexOf(events[i]) !== -1) {
|
|
183
184
|
pointerEventTarget.addEventListener(
|
|
184
185
|
events[i],
|
|
185
|
-
|
|
186
|
+
fctUtil.throttle(
|
|
186
187
|
onMoveEvent,
|
|
187
188
|
throttlingInterval,
|
|
188
189
|
false
|
|
@@ -276,13 +277,14 @@ function dispatchEvent(normalizedEvents) {
|
|
|
276
277
|
if (POINTER_MOVE.includes(pointer.type)) {
|
|
277
278
|
pointer.gameX = pointer.gameLocalX = pointer.gameScreenX;
|
|
278
279
|
pointer.gameY = pointer.gameLocalY = pointer.gameScreenY;
|
|
279
|
-
event.
|
|
280
|
+
event.emit(event.POINTERMOVE, pointer);
|
|
280
281
|
}
|
|
281
282
|
|
|
282
|
-
|
|
283
|
+
// fetch valid candiates from the game world container
|
|
284
|
+
var candidates = world.broadphase.retrieve(currentPointer, Container.prototype._sortReverseZ);
|
|
283
285
|
|
|
284
|
-
// add the main viewport to the list of candidates
|
|
285
|
-
candidates = candidates.concat([
|
|
286
|
+
// add the main game viewport to the list of candidates
|
|
287
|
+
candidates = candidates.concat([ viewport ]);
|
|
286
288
|
|
|
287
289
|
for (var c = candidates.length, candidate; c--, (candidate = candidates[c]);) {
|
|
288
290
|
if (eventHandlers.has(candidate) && (candidate.isKinematic !== true)) {
|
|
@@ -544,11 +546,11 @@ export var throttlingInterval;
|
|
|
544
546
|
*/
|
|
545
547
|
export function globalToLocal(x, y, v) {
|
|
546
548
|
v = v || new Vector2d();
|
|
547
|
-
var rect = device.getElementBounds(
|
|
549
|
+
var rect = device.getElementBounds(renderer.getScreenCanvas());
|
|
548
550
|
var pixelRatio = device.devicePixelRatio;
|
|
549
551
|
x -= rect.left + (window.pageXOffset || 0);
|
|
550
552
|
y -= rect.top + (window.pageYOffset || 0);
|
|
551
|
-
var scale =
|
|
553
|
+
var scale = scaleRatio;
|
|
552
554
|
if (scale.x !== 1.0 || scale.y !== 1.0) {
|
|
553
555
|
x /= scale.x;
|
|
554
556
|
y /= scale.y;
|
|
@@ -726,7 +728,7 @@ export function releasePointerEvent(eventType, region, callback) {
|
|
|
726
728
|
eventType = eventTypes[i];
|
|
727
729
|
if (handlers.callbacks[eventType]) {
|
|
728
730
|
if (typeof (callback) !== "undefined") {
|
|
729
|
-
|
|
731
|
+
arrayUtil.remove(handlers.callbacks[eventType], callback);
|
|
730
732
|
} else {
|
|
731
733
|
while (handlers.callbacks[eventType].length > 0) {
|
|
732
734
|
handlers.callbacks[eventType].pop();
|