zimjs 18.1.5 → 18.1.7
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/package.json +1 -1
- package/src/zim.js +52 -7
- package/ts-src/typings/zim/index.d.ts +4 -3
package/package.json
CHANGED
package/src/zim.js
CHANGED
|
@@ -39458,7 +39458,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
39458
39458
|
that.dispatchEvent("change");
|
|
39459
39459
|
if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && that.stage) that.stage.update();
|
|
39460
39460
|
});
|
|
39461
|
-
} else {
|
|
39461
|
+
} else {
|
|
39462
39462
|
button.zimTabEvent = button.on((!zns?WW.ACTIONEVENT=="mousedown":zim.ACTIONEVENT=="mousedown")?"mousedown":"click", function(e) {
|
|
39463
39463
|
change(e.currentTarget.znum);
|
|
39464
39464
|
that.dispatchEvent("change");
|
|
@@ -74072,7 +74072,7 @@ dispatches a "swipestop" event when swipeup has happened and value has stopped c
|
|
|
74072
74072
|
//-69.5
|
|
74073
74073
|
|
|
74074
74074
|
/*--
|
|
74075
|
-
zim.MotionController = function(target, type, speed, axis, boundary, map, diagonal, damp, flip, orient, constant, firstPerson, turnSpeed, moveThreshold, stickThreshold, container, localBoundary, mouseMoveOutside, mousedownIncludes, minPercentSpeed, maxPercentSpeed, dampKeyup, rotate, mouseOutside, tileObj)
|
|
74075
|
+
zim.MotionController = function(target, type, speed, axis, boundary, map, diagonal, damp, flip, orient, constant, firstPerson, turnSpeed, moveThreshold, stickThreshold, container, localBoundary, mouseMoveOutside, mousedownIncludes, minPercentSpeed, maxPercentSpeed, dampKeyup, rotate, mouseOutside, tileObj, penDown)
|
|
74076
74076
|
|
|
74077
74077
|
MotionController
|
|
74078
74078
|
zim class - extends a createjs EventDispatcher
|
|
@@ -74240,7 +74240,9 @@ tileObj - (default null) an object to direct the target to move on a theoretical
|
|
|
74240
74240
|
[1,1,0,1,1],
|
|
74241
74241
|
[0,1,1,1,0]
|
|
74242
74242
|
]
|
|
74243
|
-
note: this will override the cols and rows values
|
|
74243
|
+
note: this will override the cols and rows values
|
|
74244
|
+
penDown - (default null) set to true with Pen to make MotionControler draw the Pen on mousedown so a dot can be drawn
|
|
74245
|
+
otherwise the dot is drawn on mouseup if the pen has not moved more than 2 pixels
|
|
74244
74246
|
|
|
74245
74247
|
METHODS
|
|
74246
74248
|
pause(state, time) - state defaults to true and pauses the motionController (sets speed to 0)
|
|
@@ -74290,8 +74292,8 @@ dispatches a "mousedown" event if type is "mousedown" or "pressmove"
|
|
|
74290
74292
|
dispatches a "pressing" event if type is "pressmove" - note, this dispatches even if not moving
|
|
74291
74293
|
dispatches a "moving" event if target is moving and "startmoving" and "stopmoving" events
|
|
74292
74294
|
--*///+69.7
|
|
74293
|
-
zim.MotionController = function(target, type, speed, axis, boundary, map, diagonal, damp, flip, orient, constant, firstPerson, turnSpeed, moveThreshold, stickThreshold, container, localBoundary, mouseMoveOutside, mousedownIncludes, minPercentSpeed, maxPercentSpeed, dampKeyup, rotate, mouseOutside, tileObj) {
|
|
74294
|
-
var sig = "target, type, speed, axis, boundary, map, diagonal, damp, flip, orient, constant, firstPerson, turnSpeed, moveThreshold, stickThreshold, container, localBoundary, mouseMoveOutside, mousedownIncludes, minPercentSpeed, maxPercentSpeed, dampKeyup, rotate, mouseOutside, tileObj";
|
|
74295
|
+
zim.MotionController = function(target, type, speed, axis, boundary, map, diagonal, damp, flip, orient, constant, firstPerson, turnSpeed, moveThreshold, stickThreshold, container, localBoundary, mouseMoveOutside, mousedownIncludes, minPercentSpeed, maxPercentSpeed, dampKeyup, rotate, mouseOutside, tileObj, penDown) {
|
|
74296
|
+
var sig = "target, type, speed, axis, boundary, map, diagonal, damp, flip, orient, constant, firstPerson, turnSpeed, moveThreshold, stickThreshold, container, localBoundary, mouseMoveOutside, mousedownIncludes, minPercentSpeed, maxPercentSpeed, dampKeyup, rotate, mouseOutside, tileObj, penDown";
|
|
74295
74297
|
var duo; if (duo = zob(zim.MotionController, arguments, sig, this)) return duo;
|
|
74296
74298
|
z_d("69.7");
|
|
74297
74299
|
|
|
@@ -74613,11 +74615,19 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
|
|
|
74613
74615
|
target.write = true;
|
|
74614
74616
|
target.paper.noMouse(); // no need to drag others while drawing
|
|
74615
74617
|
target.zimDragCheck = true;
|
|
74618
|
+
if (penDown) {
|
|
74619
|
+
target.x+=2
|
|
74620
|
+
target.write = false;
|
|
74621
|
+
timeout(0, function() {
|
|
74622
|
+
target.write = true;
|
|
74623
|
+
if (target.stage) target.stage.update();
|
|
74624
|
+
});
|
|
74625
|
+
}
|
|
74616
74626
|
}
|
|
74617
74627
|
});
|
|
74618
74628
|
mouseEvent3 = stage.on("stagemouseup", function(){
|
|
74619
74629
|
if (target.type == "Pen") {
|
|
74620
|
-
if (target.zpenX
|
|
74630
|
+
if (!penDown && target.zpenX <= target.x+2 && target.zpenX >= target.x-2 && target.zpenY <= target.y+2 && target.zpenY >= target.y-2) target.x+=2
|
|
74621
74631
|
target.write = false;
|
|
74622
74632
|
target.paper.mouse();
|
|
74623
74633
|
target.zimDragCheck = false;
|
|
@@ -80761,6 +80771,11 @@ If you have moved, scaled or rotated the Emitter or its container,
|
|
|
80761
80771
|
then you will want to use var point = myEmitter.localToGlobal(particle.x, particle.y)
|
|
80762
80772
|
and get point.x and point.y to find the location of the particle relative to the stage coordinates
|
|
80763
80773
|
|
|
80774
|
+
NOTE: the Emitter sets the stage snapToPixelEnabled to true if cache is true
|
|
80775
|
+
As of ZIM 018, when the emitter is done it sets it to false (default for ZIM Stage).
|
|
80776
|
+
We do not know when its value is set ss the property is a CreateJS property - unless we override
|
|
80777
|
+
but for now, if snapToPixelEnabled is desired to be true, set it to true after using the emitter.
|
|
80778
|
+
|
|
80764
80779
|
PARTICLES CONTAINER
|
|
80765
80780
|
By default, the Emitter will make a Container and place it beneath itself when added to the stage.
|
|
80766
80781
|
by separating the particles from the emitter, it allows the emitter to be moved without all the particles moving
|
|
@@ -81067,7 +81082,6 @@ zim.Emitter = function(obj, width, height, interval, num, life, fade, shrink, wa
|
|
|
81067
81082
|
var stage;
|
|
81068
81083
|
zim.added(that, addedToStage);
|
|
81069
81084
|
function addedToStage(s) {
|
|
81070
|
-
|
|
81071
81085
|
that.emitterPaused = null; // will set back using that.startEmitterPaused
|
|
81072
81086
|
|
|
81073
81087
|
that.on("added", function () {
|
|
@@ -81491,6 +81505,7 @@ zim.Emitter = function(obj, width, height, interval, num, life, fade, shrink, wa
|
|
|
81491
81505
|
if (p.trace?p.getChildAt(0).endSpurt:p.endSpurt) {
|
|
81492
81506
|
sendEvent("spurtfizzed", p);
|
|
81493
81507
|
that.spurting = false;
|
|
81508
|
+
if (cache) stage.snapToPixelEnabled = false;
|
|
81494
81509
|
}
|
|
81495
81510
|
if (that.pool) {
|
|
81496
81511
|
if (p.pooled == "end") {
|
|
@@ -81552,12 +81567,14 @@ zim.Emitter = function(obj, width, height, interval, num, life, fade, shrink, wa
|
|
|
81552
81567
|
// that.removeFrom();
|
|
81553
81568
|
if (that.parent) that.parent.removeChild(that);
|
|
81554
81569
|
that.particles.removeFrom();
|
|
81570
|
+
if (cache) stage.snapToPixelEnabled = false;
|
|
81555
81571
|
};
|
|
81556
81572
|
|
|
81557
81573
|
this.spurting = false;
|
|
81558
81574
|
this.spurt = function(num, time, restart) {
|
|
81559
81575
|
var sig = "num, time, restart";
|
|
81560
81576
|
var duo; if (duo = zob(that.spurt, arguments, sig)) return duo;
|
|
81577
|
+
if (cache) stage.snapToPixelEnabled = true;
|
|
81561
81578
|
if (!zot(time)) {
|
|
81562
81579
|
zim.timeout(zim.Pick.choose(time), function() {
|
|
81563
81580
|
lastSpurt(that.currentParticle);
|
|
@@ -81605,6 +81622,7 @@ zim.Emitter = function(obj, width, height, interval, num, life, fade, shrink, wa
|
|
|
81605
81622
|
}
|
|
81606
81623
|
that.zimInterval.pause();
|
|
81607
81624
|
that.emitterPaused = true;
|
|
81625
|
+
if (cache) stage.snapToPixelEnabled = false;
|
|
81608
81626
|
} else { // unpausing
|
|
81609
81627
|
if (!that.emitterPaused) return that;
|
|
81610
81628
|
if (restart) {
|
|
@@ -81625,6 +81643,7 @@ zim.Emitter = function(obj, width, height, interval, num, life, fade, shrink, wa
|
|
|
81625
81643
|
}
|
|
81626
81644
|
if (that.zimInterval) that.zimInterval.pause(false, immediate);
|
|
81627
81645
|
that.emitterPaused = false;
|
|
81646
|
+
if (cache) stage.snapToPixelEnabled = true;
|
|
81628
81647
|
}
|
|
81629
81648
|
return that;
|
|
81630
81649
|
};
|
|
@@ -81654,6 +81673,7 @@ zim.Emitter = function(obj, width, height, interval, num, life, fade, shrink, wa
|
|
|
81654
81673
|
|
|
81655
81674
|
|
|
81656
81675
|
this.dispose = function() {
|
|
81676
|
+
if (cache) stage.snapToPixelEnabled = true;
|
|
81657
81677
|
if (that.zimInterval) that.zimInterval.clear();
|
|
81658
81678
|
if (emitterTicker) {
|
|
81659
81679
|
zim.Ticker.remove(emitterTicker);
|
|
@@ -89817,6 +89837,11 @@ play(volume, loop, loopCount, pan, offset, delay, interrupt) - play the sound
|
|
|
89817
89837
|
"early" - interrupt only the previously playing sound that has progressed the least
|
|
89818
89838
|
"late" - interrupt only the previously playing sound that has progressed the most
|
|
89819
89839
|
** thank you CreateJS and SoundJS for providing these options
|
|
89840
|
+
destroy() - remove sound references and dispose
|
|
89841
|
+
normal dispose() on an Aud() will just dispose the specific sound
|
|
89842
|
+
leaving the original audio reference so that more Aud objects can be made from the loaded audio
|
|
89843
|
+
destroy() will remove references to the original HTML audio so HTML will garbage collect it
|
|
89844
|
+
Note: there is a single audio file made (for an app with sound) to help Apple play sounds that will be left in memory
|
|
89820
89845
|
|
|
89821
89846
|
ABSTRACT SOUND INSTANCE
|
|
89822
89847
|
The return result of the play() makes a CreateJS AbstractSoundInstance
|
|
@@ -89974,6 +89999,26 @@ loop - dispatched when the sound loops (but not at end of last loop - that is co
|
|
|
89974
89999
|
}
|
|
89975
90000
|
return that.soundInstance;
|
|
89976
90001
|
}
|
|
90002
|
+
|
|
90003
|
+
this.destroy = function() {
|
|
90004
|
+
if (this.file) {
|
|
90005
|
+
this.src = this.item = null;
|
|
90006
|
+
var frame;
|
|
90007
|
+
if (this.stage && this.stage.frame) frame = this.stage.frame;
|
|
90008
|
+
else frame = WW.zdf;
|
|
90009
|
+
if (frame && frame.assets) {
|
|
90010
|
+
if (frame.assets[this.file]) {
|
|
90011
|
+
if (frame.assets[this.file].dispose) frame.assets[this.file].dispose();
|
|
90012
|
+
delete frame.assets[this.file];
|
|
90013
|
+
}
|
|
90014
|
+
}
|
|
90015
|
+
if (zim.assets[this.file]) {
|
|
90016
|
+
if (zim.assets[this.file].dispose) zim.assets[this.file].dispose();
|
|
90017
|
+
delete zim.assets[this.file];
|
|
90018
|
+
}
|
|
90019
|
+
}
|
|
90020
|
+
this.dispose();
|
|
90021
|
+
}
|
|
89977
90022
|
|
|
89978
90023
|
that.dispose = function() {
|
|
89979
90024
|
if (that.sound) {
|
|
@@ -3561,8 +3561,8 @@ declare namespace zim {
|
|
|
3561
3561
|
enabled: boolean
|
|
3562
3562
|
}
|
|
3563
3563
|
export class MotionController extends createjs.EventDispatcher {
|
|
3564
|
-
constructor(config_or_target?: DisplayObject, type?: string, speed?: number, axis?: string, boundary?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }, map?: [number | number[]], diagonal?: boolean, damp?: number, flip?: string, orient?: boolean, constant?: boolean, firstPerson?: boolean, turnSpeed?: number, moveThreshold?: number, stickThreshold?: number, container?: Stage | StageGL | Container, localBounds?: boolean, mouseMoveOutside?: boolean, mousedownIncludes?: DisplayObject[], minPercentSpeed?: number, maxPercentSpeed?: number, dampKeyup?: number, rotate?: boolean, mouseOutside?: boolean)
|
|
3565
|
-
constructor(config: { target?: DisplayObject, type?: string, speed?: number, axis?: string, boundary?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }, map?: [number | number[]], diagonal?: boolean, damp?: number, flip?: string, orient?: boolean, constant?: boolean, firstPerson?: boolean, turnSpeed?: number, moveThreshold?: number, stickThreshold?: number, container?: Stage | StageGL | Container, localBounds?: boolean, mouseMoveOutside?: boolean, mousedownIncludes?: DisplayObject[], minPercentSpeed?: number, maxPercentSpeed?: number, dampKeyup?: number, rotate?: boolean, mouseOutside?: boolean })
|
|
3564
|
+
constructor(config_or_target?: DisplayObject, type?: string, speed?: number, axis?: string, boundary?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }, map?: [number | number[]], diagonal?: boolean, damp?: number, flip?: string, orient?: boolean, constant?: boolean, firstPerson?: boolean, turnSpeed?: number, moveThreshold?: number, stickThreshold?: number, container?: Stage | StageGL | Container, localBounds?: boolean, mouseMoveOutside?: boolean, mousedownIncludes?: DisplayObject[], minPercentSpeed?: number, maxPercentSpeed?: number, dampKeyup?: number, rotate?: boolean, mouseOutside?: boolean, penDown?: boolean)
|
|
3565
|
+
constructor(config: { target?: DisplayObject, type?: string, speed?: number, axis?: string, boundary?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }, map?: [number | number[]], diagonal?: boolean, damp?: number, flip?: string, orient?: boolean, constant?: boolean, firstPerson?: boolean, turnSpeed?: number, moveThreshold?: number, stickThreshold?: number, container?: Stage | StageGL | Container, localBounds?: boolean, mouseMoveOutside?: boolean, mousedownIncludes?: DisplayObject[], minPercentSpeed?: number, maxPercentSpeed?: number, dampKeyup?: number, rotate?: boolean, mouseOutside?: boolean, penDown?: boolean })
|
|
3566
3566
|
immediate(x: number, y: number): void
|
|
3567
3567
|
convert(x: number, y: number): void
|
|
3568
3568
|
pause(state?: boolean, time?: number): this
|
|
@@ -3931,7 +3931,8 @@ declare namespace zim {
|
|
|
3931
3931
|
constructor(config_or_file?: string, volume?: number, loop?: number, loopCount?: number, pan?: number, offset?: number, delay?: number, interrupt?: string, maxNum?: number, style?: boolean, group?: string, inherit?: {})
|
|
3932
3932
|
constructor(config: { file?: string, volume?: number, loop?: number, loopCount?: number, pan?: number, offset?: number, delay?: number, interrupt?: string, maxNum?: number, style?: boolean, group?: string, inherit?: {} })
|
|
3933
3933
|
play(volume?: number, loop?: number, loopCount?: number, pan?: number, offset?: number, delay?: number, interrupt?: string): createjs.AbstractSoundInstance
|
|
3934
|
-
|
|
3934
|
+
destroy() : void
|
|
3935
|
+
readonly file: string
|
|
3935
3936
|
readonly src: string
|
|
3936
3937
|
readonly item: {}
|
|
3937
3938
|
}
|