zimjs 18.1.7 → 18.1.8

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.7",
3
+ "version": "18.1.8",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -31324,6 +31324,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
31324
31324
  group:this.group
31325
31325
  });
31326
31326
  if (!zot(percentage) && zot(label)) label = new zim.Label("");
31327
+ if (zot(percentage)) percentage=DS.percentage!=null?DS.percentage:false;
31327
31328
  this.label = label;
31328
31329
 
31329
31330
  var height = 30;
@@ -31388,7 +31389,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
31388
31389
  if (!zot(label)) {
31389
31390
  label.scaleX = label.scaleY = .8;
31390
31391
  label.startText = label.text;
31391
- if (!zot(percentage)) label.text = label.startText + " 0%";
31392
+ if (percentage) label.text = label.startText + " 0%";
31392
31393
  label.center(that);
31393
31394
  if (labelPosition == "above") {
31394
31395
  label.y -= 60;
@@ -31496,7 +31497,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
31496
31497
  mask.sca(amount/100, 1);
31497
31498
  bar.setMask(mask);
31498
31499
  }
31499
- if (!zot(percentage)) label.text = label.startText + " " + Math.min(Math.round(amount), 100) + "%";
31500
+ if (percentage) label.text = label.startText + " " + Math.min(Math.round(amount), 100) + "%";
31500
31501
  if (autoHide && fastClose && Math.round(amount) >= 100) that.timeOut = setTimeout(function(){that.hide();}, 200);
31501
31502
  if (!that.dispatched && Math.round(amount) >= 100) {
31502
31503
  that.dispatchEvent("complete");
@@ -74072,7 +74073,7 @@ dispatches a "swipestop" event when swipeup has happened and value has stopped c
74072
74073
  //-69.5
74073
74074
 
74074
74075
  /*--
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
+ 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, offTime)
74076
74077
 
74077
74078
  MotionController
74078
74079
  zim class - extends a createjs EventDispatcher
@@ -74153,6 +74154,9 @@ target (default null) - the object you want to control
74153
74154
  if you only want data from the MotionController you can leave the target parameter as null (don't include it)
74154
74155
  can be a Pen() - both pen and motionController have damp parameter so probably adjust one or the other to 1
74155
74156
  type - (default "mousedown") by default will move to where you press in the container
74157
+ see upTime parameter to stop moving when mouse is up
74158
+ set to "follow" to mousedown and hold to keep moving towards mouse or press position - can also use F.follow() to move stage as well
74159
+ see upTime parameter to stop moving when mouse is up
74156
74160
  set to "mousemove" to have the target follow the mouse movement
74157
74161
  set to "pressmove" to have target jump to mousedown position then follow while pressing - good for Pen
74158
74162
  set to "pressdrag" to have target follow mouse if pressed on and then dragged (dedicated to Shan Ruan)
@@ -74160,7 +74164,6 @@ type - (default "mousedown") by default will move to where you press in the cont
74160
74164
  set to "gamebutton" to use gamepad buttons to control the target (see map parameter)
74161
74165
  set to "gamestick" to use gamepad stick(s) to control the target (see map parameter)
74162
74166
  set to "swipe" to use swipe to control the target
74163
- set to "follow" to mousedown and hold and use F.follow() to keep moving towards mouse or press position
74164
74167
  set to "manual" to set your own with myController.convert() or myController.x and myController.y properties
74165
74168
  set to a ZIM DPad object to use the DPad to control the motion
74166
74169
  speed - (default 7 or 20 if type is pressmove) pixels it will move each tick, keypress buttonpress, swipe, etc.
@@ -74243,6 +74246,10 @@ tileObj - (default null) an object to direct the target to move on a theoretical
74243
74246
  note: this will override the cols and rows values
74244
74247
  penDown - (default null) set to true with Pen to make MotionControler draw the Pen on mousedown so a dot can be drawn
74245
74248
  otherwise the dot is drawn on mouseup if the pen has not moved more than 2 pixels
74249
+ offTime - (default null) set to a time (including 0) to slow movement when mouse or press is up
74250
+ normally a mousedown or mousemove, etc. will move the target to the last mouse position
74251
+ but sometimes it is desired to have the movement stop when the mouse or press is up
74252
+ set a time here to allow the movement to slow to a stop on mouse or press up
74246
74253
 
74247
74254
  METHODS
74248
74255
  pause(state, time) - state defaults to true and pauses the motionController (sets speed to 0)
@@ -74292,8 +74299,8 @@ dispatches a "mousedown" event if type is "mousedown" or "pressmove"
74292
74299
  dispatches a "pressing" event if type is "pressmove" - note, this dispatches even if not moving
74293
74300
  dispatches a "moving" event if target is moving and "startmoving" and "stopmoving" events
74294
74301
  --*///+69.7
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";
74302
+ 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, offTime) {
74303
+ 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, offTime";
74297
74304
  var duo; if (duo = zob(zim.MotionController, arguments, sig, this)) return duo;
74298
74305
  z_d("69.7");
74299
74306
 
@@ -74465,6 +74472,7 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
74465
74472
  var mouseEvent2;
74466
74473
  var mouseEvent3;
74467
74474
  var mouseEvent4;
74475
+ var offTimeEvent;
74468
74476
  var pressing = false;
74469
74477
  var moveCheck = false;
74470
74478
  var under, i, a, gamepad, first;
@@ -74523,7 +74531,13 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
74523
74531
  calculate();
74524
74532
  }, stage);
74525
74533
  } else if (type == "mousedown" || type == "mousemove") {
74526
- mouseEvent = stage.on("stage" + type, function(e){
74534
+ mouseEvent = stage.on("stage" + type, function(e){
74535
+ if (that.offSpeed) {
74536
+ that.stopAnimate("off");
74537
+ that.paused = false;
74538
+ that.speed = that.offSpeed;
74539
+ that.offSpeed = null;
74540
+ }
74527
74541
  stage = e.target.stage;
74528
74542
  var pp;
74529
74543
  var con;
@@ -74550,7 +74564,14 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
74550
74564
  that.x = p.x; that.y = p.y;
74551
74565
  calculate();
74552
74566
  });
74567
+ if (!zot(offTime)) offTimeEvent = stage.on("stagemouseup", doOffTime);
74553
74568
  } else if (type == "pressmove" || type == "pressdrag" || type == "follow") {
74569
+ if (that.offSpeed) {
74570
+ that.stopAnimate("off");
74571
+ that.paused = false;
74572
+ that.speed = that.offSpeed;
74573
+ that.offSpeed = null;
74574
+ }
74554
74575
  if (target.type == "Pen") target.write = false;
74555
74576
  mouseEvent = stage.on("stagemousedown", function(e) {
74556
74577
  var pp;
@@ -74637,6 +74658,7 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
74637
74658
  stage.off("stagemousemove", mouseEvent2);
74638
74659
  pressing = false;
74639
74660
  });
74661
+ if (!zot(offTime)) offTimeEvent = stage.on("stagemouseup", doOffTime)
74640
74662
 
74641
74663
  } else if (type == "gamestick") {
74642
74664
  gamepad = this.gamepad = new zim.GamePad();
@@ -74695,6 +74717,20 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
74695
74717
  });
74696
74718
  }
74697
74719
 
74720
+ var offCheck = false;
74721
+ function doOffTime() {
74722
+ if (offCheck) return;
74723
+ offCheck = true;
74724
+ if (that.paused || !that.enabled) return;
74725
+ that.offSpeed = that.speed;
74726
+ zim.animate({target:that, obj:{pausingSpeed:0}, ticker:false, id:"off", time:offTime, call:function() {
74727
+ that.immediate(that.target.x, that.target.y);
74728
+ that.speed = that.offSpeed;
74729
+ that.offSpeed = null;
74730
+ that.paused = false;
74731
+ offCheck = false;
74732
+ }});
74733
+ }
74698
74734
 
74699
74735
  function doDown(e) {
74700
74736
  wasDown = true;
@@ -75131,11 +75167,11 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
75131
75167
  that.enabled = true;
75132
75168
  if (time > 0) {
75133
75169
  zim.animate({target:that, obj:{pausingSpeed:lastSpeed}, ticker:false, time:time, call:function() {
75134
- that.speed = lastSpeed;
75170
+ if (lastSpeed) that.speed = lastSpeed;
75135
75171
  that.paused = false;
75136
75172
  }});
75137
- } else {
75138
- that.speed = lastSpeed;
75173
+ } else {
75174
+ if (lastSpeed) that.speed = lastSpeed;
75139
75175
  that.paused = false;
75140
75176
  }
75141
75177
  }
@@ -75177,10 +75213,12 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
75177
75213
  if (swiperEvent) swiperEvent = swiperX.on("swipemove", swiperEvent);
75178
75214
  } else if (type == "mousedown" || type == "mousemove") {
75179
75215
  mouseEvent = stage.on("stage" + type, mouseEvent);
75216
+ if (offTimeEvent) offTimeEvent = stage.on("stagemouseup", offTimeEvent);
75180
75217
  } else if (type == "pressmove") {
75181
75218
  mouseEvent = stage.on("stagemousedown", mouseEvent);
75182
75219
  if (mouseEvent2) mouseEvent2 = stage.on("stagemousemove", mouseEvent2);
75183
75220
  if (mouseEvent3) mouseEvent3 = stage.on("stagemouseup", mouseEvent3);
75221
+ if (offTimeEvent) offTimeEvent = stage.on("stagemouseup", offTimeEvent);
75184
75222
  }
75185
75223
  mainTicker = zim.Ticker.add(mainTicker, stage);
75186
75224
  }
@@ -75201,10 +75239,12 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
75201
75239
  swiperX.off("swipemove", swiperEvent);
75202
75240
  } else if (type == "mousedown" || type == "mousemove") {
75203
75241
  stage.off("stage" + type, mouseEvent);
75242
+ stage.off("stagemouseup", offTimeEvent);
75204
75243
  } else if (type == "pressmove") {
75205
75244
  stage.off("stagemousedown", mouseEvent);
75206
75245
  stage.off("stagemousemove", mouseEvent2);
75207
75246
  stage.off("stagemouseup", mouseEvent3);
75247
+ stage.off("stagemouseup", offTimeEvent);
75208
75248
  }
75209
75249
  zim.Ticker.remove(mainTicker);
75210
75250
  }
@@ -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, 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 })
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, upTime?: number)
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, upTime?: number })
3566
3566
  immediate(x: number, y: number): void
3567
3567
  convert(x: number, y: number): void
3568
3568
  pause(state?: boolean, time?: number): this