zimjs 18.1.4 → 18.1.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "18.1.4",
3
+ "version": "18.1.6",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
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,16 @@ 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() {target.write = true});
74622
+ }
74616
74623
  }
74617
74624
  });
74618
74625
  mouseEvent3 = stage.on("stagemouseup", function(){
74619
74626
  if (target.type == "Pen") {
74620
- if (target.zpenX==Math.round(target.x) && target.zpenY==Math.round(target.y)) target.x+=2
74627
+ 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
74628
  target.write = false;
74622
74629
  target.paper.mouse();
74623
74630
  target.zimDragCheck = false;
@@ -89817,6 +89824,11 @@ play(volume, loop, loopCount, pan, offset, delay, interrupt) - play the sound
89817
89824
  "early" - interrupt only the previously playing sound that has progressed the least
89818
89825
  "late" - interrupt only the previously playing sound that has progressed the most
89819
89826
  ** thank you CreateJS and SoundJS for providing these options
89827
+ destroy() - remove sound references and dispose
89828
+ normal dispose() on an Aud() will just dispose the specific sound
89829
+ leaving the original audio reference so that more Aud objects can be made from the loaded audio
89830
+ destroy() will remove references to the original HTML audio so HTML will garbage collect it
89831
+ 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
89832
 
89821
89833
  ABSTRACT SOUND INSTANCE
89822
89834
  The return result of the play() makes a CreateJS AbstractSoundInstance
@@ -89974,6 +89986,26 @@ loop - dispatched when the sound loops (but not at end of last loop - that is co
89974
89986
  }
89975
89987
  return that.soundInstance;
89976
89988
  }
89989
+
89990
+ this.destroy = function() {
89991
+ if (this.file) {
89992
+ this.src = this.item = null;
89993
+ var frame;
89994
+ if (this.stage && this.stage.frame) frame = this.stage.frame;
89995
+ else frame = WW.zdf;
89996
+ if (frame && frame.assets) {
89997
+ if (frame.assets[this.file]) {
89998
+ if (frame.assets[this.file].dispose) frame.assets[this.file].dispose();
89999
+ delete frame.assets[this.file];
90000
+ }
90001
+ }
90002
+ if (zim.assets[this.file]) {
90003
+ if (zim.assets[this.file].dispose) zim.assets[this.file].dispose();
90004
+ delete zim.assets[this.file];
90005
+ }
90006
+ }
90007
+ this.dispose();
90008
+ }
89977
90009
 
89978
90010
  that.dispose = function() {
89979
90011
  if (that.sound) {
@@ -92619,9 +92651,9 @@ function zimify(obj, a, b, c, d, list) {
92619
92651
  sca:function(scale, scaleY) {
92620
92652
  return zim.sca(this, scale, scaleY);
92621
92653
  },
92622
- scaleTo:function(boundObj, percentX, percentY, type, boundsOnly) {
92654
+ scaleTo:function(boundObj, percentX, percentY, type, boundsOnly, simple) {
92623
92655
  if (isDUO(arguments)) {arguments[0].obj = this; return zim.scaleTo(arguments[0]);}
92624
- else {return zim.scaleTo(this, boundObj, percentX, percentY, type, boundsOnly);}
92656
+ else {return zim.scaleTo(this, boundObj, percentX, percentY, type, boundsOnly, simple);}
92625
92657
  },
92626
92658
  fit:function(left, top, width, height, type) {
92627
92659
  if (isDUO(arguments)) {arguments[0].obj = this; return zim.fit(arguments[0]);}
@@ -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
- readonly file: string
3934
+ destroy() : void
3935
+ readonly file: string
3935
3936
  readonly src: string
3936
3937
  readonly item: {}
3937
3938
  }