zimjs 17.0.2 → 17.0.4
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 +156 -77
package/package.json
CHANGED
package/src/zim.js
CHANGED
|
@@ -9457,7 +9457,7 @@ normalize(prop, from, from2, min, max, factor, clamp) - sets a ratio property (1
|
|
|
9457
9457
|
setting normalize("reg", CENTER) will do both horizontal and vertical to the container dimensions.
|
|
9458
9458
|
If this is not desired, use container.loop(item=>{item.reg(item._orX, item._orY, true)});
|
|
9459
9459
|
to set the registration point back but still keep the ratio property
|
|
9460
|
-
USAGE: the ratio property can be used by animate() with
|
|
9460
|
+
USAGE: the ratio property can be used by animate() with sequenceRatio to set the rate of an animation based on ratio
|
|
9461
9461
|
Or the ratio property can be used directly - for instance, to set a scale based on a distance from somewhere
|
|
9462
9462
|
Or as another example, set the alpha based on the rotation of a shape in the container
|
|
9463
9463
|
specialColor(colorCommand, colorObject) - used internally by ZIM Shapes
|
|
@@ -9487,8 +9487,8 @@ height - gets or sets the height. Setting the height will scale the width to kee
|
|
|
9487
9487
|
widthOnly - gets or sets the width. This sets only the width and may change the aspect ratio of the object
|
|
9488
9488
|
heightOnly - gets or sets the height. This sets only the height and may change the aspect ratio of the object
|
|
9489
9489
|
ratio - get a ratio set by the Container normalize method() - or Tile itemRegX, itemRegY parameters
|
|
9490
|
-
|
|
9491
|
-
|
|
9490
|
+
this will probably be a value from 1 to 0 as to how close the property is the end specified in the from parameter of normalize()
|
|
9491
|
+
a value of 1 is the closest and a value of 0 is the farthest - see the normalize() method for details
|
|
9492
9492
|
normalized - get if the container has been normalized - see normalized parameter
|
|
9493
9493
|
draggable - set to true for a default drag() and false for a noDrag()
|
|
9494
9494
|
level - gets or sets the level of the object in its parent container (or the stage) - a property for parent.getChildIndex() and parent.setChildIndex()
|
|
@@ -14317,15 +14317,15 @@ dashed - (default false) set to true for dashed border (if borderWidth or border
|
|
|
14317
14317
|
percent - (default 100) set to a percentage of a circle (arc) - registration stays at radius center, bounds shrink to arc
|
|
14318
14318
|
percentClose - (default true) set to false to not close the border of a circle with percent set
|
|
14319
14319
|
percentArc - (default false) set to a percent to make moon shapes - must have percent turned on
|
|
14320
|
-
|
|
14321
|
-
|
|
14322
|
-
|
|
14323
|
-
|
|
14324
|
-
|
|
14325
|
-
|
|
14326
|
-
|
|
14327
|
-
|
|
14328
|
-
|
|
14320
|
+
the value is the distance the arc-making circle is placed from the original circle's edge
|
|
14321
|
+
this distance is given as a percentage of the original circle's radius
|
|
14322
|
+
so if percentArc is set to 0 then the arc-making circle is at the radius (the edge) of the original circle
|
|
14323
|
+
if the percentArc is set to 50 then the arc-making circle is half the radius outside the original radius and the arc is less
|
|
14324
|
+
if the percentArc is set to -50 then the arc-making circle is half the radius inside the original radius and the arc is more
|
|
14325
|
+
Note, due to canvas winding, the arc will not do very thin cresents as expected
|
|
14326
|
+
instead once the inner arc is as wide as the outer arc, it makes a straight line
|
|
14327
|
+
for thin crecents, overlap the circle with a circle that matches the background color
|
|
14328
|
+
or if the background is an image, etc. then mask a clone of the background with the arc circle
|
|
14329
14329
|
strokeObj - (default {caps:"butt", joints:"miter", miterLimit:10, ignoreScale:false}) set to adjust stroke properties
|
|
14330
14330
|
// note, not all applicable to a Circle - perhaps just ignoreScale...
|
|
14331
14331
|
caps options: "butt", "round", "square" or 0,1,2
|
|
@@ -14474,8 +14474,18 @@ zim.Circle = function(radius, color, borderColor, borderWidth, dashed, percent,
|
|
|
14474
14474
|
var dY = Math.cos(p*Math.PI/180)*that._radius;
|
|
14475
14475
|
if (!zot(percentArc)) {
|
|
14476
14476
|
var r2 = Math.sqrt(Math.pow(dX,2) + Math.pow((that._radius+dY)+percentArc/100*that._radius,2));
|
|
14477
|
-
|
|
14478
|
-
|
|
14477
|
+
if (percentArc >= 0) {
|
|
14478
|
+
var a1 = Math.asin(dX/r2);
|
|
14479
|
+
var y2 = that._radius+percentArc/100*that._radius;
|
|
14480
|
+
var a2 = -90*zim.RAD+a1;
|
|
14481
|
+
var a3 = -90*zim.RAD-a1;
|
|
14482
|
+
g.arc(0, y2, r2, a2, a3, true);
|
|
14483
|
+
} else {
|
|
14484
|
+
// var y3 = dY - Math.sqrt(Math.pow(r2, 2) - Math.pow(dX, 2));
|
|
14485
|
+
// var a2 = Math.acos(dX/r2);
|
|
14486
|
+
// var a3 = 180*RAD - a2;
|
|
14487
|
+
// g.arc(0, y3, r2, a2, a3, false);
|
|
14488
|
+
}
|
|
14479
14489
|
}
|
|
14480
14490
|
if (percentClose) g.cp();
|
|
14481
14491
|
h = that._radius-dY;
|
|
@@ -20764,7 +20774,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
20764
20774
|
if (color.type) that.color = color;
|
|
20765
20775
|
function drawShape(lengths, angles, anglesA, anglesB, anglesEnd, cross, crossColors, close) {
|
|
20766
20776
|
that.removeAllChildren();
|
|
20767
|
-
|
|
20777
|
+
|
|
20768
20778
|
var s = that.shape = new zim.Shape().addTo(that);
|
|
20769
20779
|
that.colorCommand = s.c().f(color).command;
|
|
20770
20780
|
if (color && color.type) that.specialColor(that.colorCommand, color, that);
|
|
@@ -28376,6 +28386,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
28376
28386
|
setTimeout(function(){
|
|
28377
28387
|
if (content) {
|
|
28378
28388
|
zim.drag({
|
|
28389
|
+
singleTouch:true,
|
|
28379
28390
|
obj:content,
|
|
28380
28391
|
currentTarget:true,
|
|
28381
28392
|
axis:continuous,
|
|
@@ -30514,7 +30525,7 @@ text - |ZIM VEE| String for the the text of the label
|
|
|
30514
30525
|
size - (default 36) the size of the font in pixels
|
|
30515
30526
|
font - (default arial) the font or list of fonts for the text
|
|
30516
30527
|
color - |ZIM VEE| (default dark) color of font
|
|
30517
|
-
backgroundColor - |ZIM VEE| (default lighter) background color - set to
|
|
30528
|
+
backgroundColor - |ZIM VEE| (default lighter) background color - set to clear for no background
|
|
30518
30529
|
borderColor - |ZIM VEE| (default null) the background stroke color
|
|
30519
30530
|
borderWidth - (default null) thickness of the background border
|
|
30520
30531
|
maxLength - (default null) set to limit the number of characters in the field
|
|
@@ -32680,8 +32691,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32680
32691
|
});
|
|
32681
32692
|
|
|
32682
32693
|
that.dropDown = that.on("mousedown", function(e){
|
|
32694
|
+
// if (downItem) return;
|
|
32683
32695
|
// make sure is item in list
|
|
32684
|
-
downItem = checkItem = e.target;
|
|
32696
|
+
downItem = checkItem = e.target;
|
|
32685
32697
|
// e.target can be something in the item - or the item
|
|
32686
32698
|
// but custom List items are usually in a Container
|
|
32687
32699
|
// so want to drag the item which is the child of the container that is in the List items
|
|
@@ -32779,32 +32791,36 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32779
32791
|
return; // next in loop
|
|
32780
32792
|
}
|
|
32781
32793
|
if (target.vertical) {
|
|
32782
|
-
if (
|
|
32783
|
-
if (ghost.
|
|
32784
|
-
if (ghost.y
|
|
32785
|
-
|
|
32786
|
-
|
|
32787
|
-
|
|
32788
|
-
if (ghost.y
|
|
32789
|
-
|
|
32790
|
-
|
|
32791
|
-
|
|
32792
|
-
|
|
32793
|
-
|
|
32794
|
+
if (target.scrollYMax > 0) {
|
|
32795
|
+
if (ghost.x > target.zgb.x && ghost.x < target.zgb.x + target.zgb.width) {
|
|
32796
|
+
if (ghost.y < target.zgb.y) { // carefull - need to do these separately to turn off diamond
|
|
32797
|
+
if (ghost.y > target.zgbtarget.zgb.y - 50) scrollUp(target, dropScrollSpeed);
|
|
32798
|
+
else if (ghost.y > target.zgbtarget.zgb.y - 80) scrollUp(target, dropScrollSpeed*1.5);
|
|
32799
|
+
onCheck = true;
|
|
32800
|
+
} else if (ghost.y > target.zgbtarget.zgb.y + target.zgbtarget.zgb.height) {
|
|
32801
|
+
if (ghost.y < target.zgbtarget.zgb.y + target.zgbtarget.zgb.height + 50) scrollDown(target, dropScrollSpeed);
|
|
32802
|
+
else if (ghost.y < target.zgbtarget.zgb.y + target.zgbtarget.zgb.height + 80) scrollDown(target, dropScrollSpeed*1.5);
|
|
32803
|
+
onCheck = true;
|
|
32804
|
+
} else if (target.scrollInt) target.scrollInt.clear();
|
|
32805
|
+
} else {
|
|
32806
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
32807
|
+
}
|
|
32794
32808
|
}
|
|
32795
32809
|
} else {
|
|
32796
|
-
if (
|
|
32797
|
-
if (ghost.
|
|
32798
|
-
if (ghost.x
|
|
32799
|
-
|
|
32800
|
-
|
|
32801
|
-
|
|
32802
|
-
if (ghost.x
|
|
32803
|
-
|
|
32804
|
-
|
|
32805
|
-
|
|
32806
|
-
|
|
32807
|
-
|
|
32810
|
+
if (target.scrollXMax > 0) {
|
|
32811
|
+
if (ghost.y > target.zgb.y && ghost.y < target.zgb.y + target.zgb.height) {
|
|
32812
|
+
if (ghost.x < target.zgb.x) {
|
|
32813
|
+
if (ghost.x > target.zgb.x - 50) scrollUp(target, dropScrollSpeed);
|
|
32814
|
+
else if (ghost.x > target.zgb.x - 80) scrollUp(target, dropScrollSpeed*1.5);
|
|
32815
|
+
onCheck = true;
|
|
32816
|
+
} else if (ghost.x > target.zgb.x + target.zgb.width) {
|
|
32817
|
+
if (ghost.x < target.zgb.x + target.zgb.width + 50) scrollDown(target, dropScrollSpeed);
|
|
32818
|
+
else if (ghost.x < target.zgb.x + target.zgb.width + 80) scrollDown(target, dropScrollSpeed*1.5);
|
|
32819
|
+
onCheck = true;
|
|
32820
|
+
} else if (target.scrollInt) target.scrollInt.clear();
|
|
32821
|
+
} else {
|
|
32822
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
32823
|
+
}
|
|
32808
32824
|
}
|
|
32809
32825
|
}
|
|
32810
32826
|
|
|
@@ -32907,9 +32923,13 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32907
32923
|
|
|
32908
32924
|
that.dispatchEvent("dropdown");
|
|
32909
32925
|
|
|
32910
|
-
frame.
|
|
32911
|
-
|
|
32912
|
-
|
|
32926
|
+
// frame.on("mouseupplus", smu, null, true); // once - but does not work with touch
|
|
32927
|
+
// that.pointerUpEvent = frame.on("pointerup", smu); // pointer does not have a once!
|
|
32928
|
+
frame.stage.on("stagemouseup", smu, null, true); // once - seems to be working on iframes, etc.
|
|
32929
|
+
function smu() {
|
|
32930
|
+
frame.off("pointerup", that.pointerUpEvent)
|
|
32931
|
+
frame.stage.off("stagemousemove", that.dropStage);
|
|
32932
|
+
|
|
32913
32933
|
var empty = zim.loop(dropTargets, function(target) {
|
|
32914
32934
|
if (target.type != "List") return;
|
|
32915
32935
|
if (target.scrollInt) target.scrollInt.clear();
|
|
@@ -32923,33 +32943,36 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32923
32943
|
ghost.dispose();
|
|
32924
32944
|
downItem.alpha = itemAlpha;
|
|
32925
32945
|
ghost = null;
|
|
32926
|
-
downPoint = null;
|
|
32946
|
+
downPoint = null;
|
|
32927
32947
|
|
|
32928
32948
|
that.dropItem = downItem;
|
|
32929
32949
|
that.dropList = target;
|
|
32930
32950
|
that.dropNewIndex = target.dropReticleIndex;
|
|
32931
32951
|
target.dropReticleIndex = null;
|
|
32932
|
-
|
|
32952
|
+
downItem = null;
|
|
32953
|
+
|
|
32933
32954
|
return false;
|
|
32934
32955
|
}
|
|
32935
32956
|
});
|
|
32936
32957
|
|
|
32937
32958
|
if (empty) {
|
|
32959
|
+
if (!downItem) return;
|
|
32938
32960
|
var point = downItem.localToGlobal(itemPoint.x, itemPoint.y);
|
|
32939
32961
|
ghost.animate({x:point.x, y:point.y}, .1, null, function() {
|
|
32940
32962
|
ghost.dispose();
|
|
32941
32963
|
downItem.alpha = itemAlpha;
|
|
32942
32964
|
ghost = null;
|
|
32943
32965
|
downPoint = null;
|
|
32966
|
+
downItem = null;
|
|
32944
32967
|
})
|
|
32945
32968
|
that.dropItem = downItem;
|
|
32946
32969
|
that.dropList = that;
|
|
32947
32970
|
that.dropNewIndex = that.dropIndex;
|
|
32948
32971
|
}
|
|
32949
|
-
|
|
32950
32972
|
that.dispatchEvent("dropup");
|
|
32973
|
+
|
|
32951
32974
|
|
|
32952
|
-
}
|
|
32975
|
+
}
|
|
32953
32976
|
downItem.alp(.5);
|
|
32954
32977
|
}
|
|
32955
32978
|
});
|
|
@@ -53530,7 +53553,7 @@ sequenceCall - (default null) the function that will be called for each sequence
|
|
|
53530
53553
|
Note: the value of the sequenceCall parameter will be the object that just ended animation unless there is a sequenceParams value
|
|
53531
53554
|
sequenceParams - (default null) a parameter sent to the sequenceCall function
|
|
53532
53555
|
sequenceReverse - |ZIM VEE| (default false) set to true to sequence through container or array backwards
|
|
53533
|
-
|
|
53556
|
+
sequenceRatio - (default null) set to a value to adjust the rate based on item ratio property
|
|
53534
53557
|
see https://zimjs.com/016/normalize.html
|
|
53535
53558
|
see Container() ratio property and normalize() method which give a ratio property.
|
|
53536
53559
|
This will automatically set sequence to 0 so that each item in the container (or tile) is animated individually
|
|
@@ -74936,46 +74959,45 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
74936
74959
|
that.setMask(that.backing);
|
|
74937
74960
|
peel.addTo(that);
|
|
74938
74961
|
peel.c().f(zim.black).dr(0,0,0,0);
|
|
74939
|
-
that.moving = false;
|
|
74962
|
+
that.moving = false;
|
|
74940
74963
|
|
|
74941
74964
|
// backwards
|
|
74942
74965
|
if (pages[num-1]) {
|
|
74943
|
-
leftPage = pages[num-1].reg(0,0).rot(0).loc(0,0,that);
|
|
74966
|
+
leftPage = pages[num-1].reg(0,0).rot(0).loc(0,0,that).setMask(null);
|
|
74944
74967
|
} else if (num > 0) {
|
|
74945
74968
|
lastPage.reg(0,0).rot(0).loc(0,0,that).setMask(null);
|
|
74946
74969
|
}
|
|
74947
74970
|
|
|
74948
74971
|
if (pages[num-2]) {
|
|
74949
|
-
pageFore = pages[num-2].reg(width/2,height).loc(0,height,that).rot(-90);
|
|
74972
|
+
pageFore = pages[num-2].reg(width/2,height).loc(0,height,that).rot(-90).setMask(null);
|
|
74950
74973
|
} else {
|
|
74951
|
-
pageFore = new zim.Rectangle(width/2,height,backgroundColor).reg(width/2,height).loc(0,height,that).rot(-90);
|
|
74974
|
+
pageFore = new zim.Rectangle(width/2,height,backgroundColor).reg(width/2,height).loc(0,height,that).rot(-90).setMask(null);
|
|
74952
74975
|
}
|
|
74953
74976
|
if (pages[num-3]) {
|
|
74954
|
-
pagePrev = pages[num-3].rot(0).loc(0,0,that).setMask(peel);
|
|
74977
|
+
pagePrev = pages[num-3].reg(0,0).rot(0).loc(0,0,that).setMask(peel);
|
|
74955
74978
|
} else {
|
|
74956
|
-
pagePrev = new zim.Rectangle(width/2,height,backgroundColor).loc(0,0,that).setMask(peel);
|
|
74979
|
+
pagePrev = new zim.Rectangle(width/2,height,backgroundColor).reg(0,0).rot(0).loc(0,0,that).setMask(peel);
|
|
74957
74980
|
}
|
|
74958
74981
|
|
|
74959
74982
|
// forewards
|
|
74960
74983
|
if (pages[num]) {
|
|
74961
|
-
rightPage = pages[num].rot(0).reg(0,0).pos(0,0,zim.RIGHT,zim.TOP,that);
|
|
74984
|
+
rightPage = pages[num].rot(0).reg(0,0).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(null);
|
|
74962
74985
|
} else {
|
|
74963
74986
|
// need to make a first or last page here
|
|
74964
74987
|
stage.update();
|
|
74965
74988
|
return;
|
|
74966
74989
|
}
|
|
74967
74990
|
if (pages[num+1]) {
|
|
74968
|
-
pageBack = that.backNext = pages[num+1].reg(0,height).loc(width,height,that).rot(90);
|
|
74991
|
+
pageBack = that.backNext = pages[num+1].reg(0,height).loc(width,height,that).rot(90).setMask(null);
|
|
74969
74992
|
} else {
|
|
74970
|
-
pageBack = that.backNext = new zim.Rectangle(width/2,height,backgroundColor).reg(0,height).loc(width,height,that).rot(90);
|
|
74993
|
+
pageBack = that.backNext = new zim.Rectangle(width/2,height,backgroundColor).reg(0,height).loc(width,height,that).rot(90).setMask(null);
|
|
74971
74994
|
lastPage = pageBack;
|
|
74972
74995
|
}
|
|
74973
74996
|
if (pages[num+2]) {
|
|
74974
|
-
pageNext = that.backPrev = pages[num+2].rot(0).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(peel);
|
|
74997
|
+
pageNext = that.backPrev = pages[num+2].reg(0,0).rot(0).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(peel);
|
|
74975
74998
|
} else {
|
|
74976
|
-
pageNext = that.backPrev = new zim.Rectangle(width/2,height,backgroundColor).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(peel);
|
|
74977
|
-
}
|
|
74978
|
-
stage.update();
|
|
74999
|
+
pageNext = that.backPrev = new zim.Rectangle(width/2,height,backgroundColor).reg(0,0).rot(0).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(peel);
|
|
75000
|
+
}
|
|
74979
75001
|
}
|
|
74980
75002
|
toPage(startPage);
|
|
74981
75003
|
|
|
@@ -74984,17 +75006,30 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
74984
75006
|
return that._currentPage;
|
|
74985
75007
|
},
|
|
74986
75008
|
set: function(num) {
|
|
74987
|
-
offHTML();
|
|
75009
|
+
offHTML();
|
|
74988
75010
|
if (startPage%2==1) {
|
|
74989
|
-
num = Math.
|
|
75011
|
+
num = Math.floor(num/2)*2+1
|
|
74990
75012
|
} else {
|
|
74991
75013
|
num = Math.ceil(num/2)*2
|
|
74992
75014
|
}
|
|
74993
|
-
|
|
74994
|
-
|
|
75015
|
+
num = zim.constrain(num, 0, that.pages.length-1);
|
|
75016
|
+
|
|
75017
|
+
that.currentW = 0;
|
|
75018
|
+
that.currentH = 0;
|
|
75019
|
+
that.lastPage = zim.constrain(that._currentPage);
|
|
75020
|
+
|
|
75021
|
+
if (num==that.page) return;
|
|
75022
|
+
|
|
75023
|
+
else if (num>that.page) {
|
|
75024
|
+
that.direction = "right";
|
|
75025
|
+
that.pageNext = pageNext.zimBookIndex;
|
|
75026
|
+
|
|
74995
75027
|
pageBack.reg(0,0);
|
|
74996
75028
|
pageNext.setMask(null);
|
|
74997
|
-
} else {
|
|
75029
|
+
} else {
|
|
75030
|
+
that.direction = "left";
|
|
75031
|
+
that.pageNext = pageFore.zimBookIndex;
|
|
75032
|
+
|
|
74998
75033
|
pageFore.reg(0,0);
|
|
74999
75034
|
pagePrev.setMask(null);
|
|
75000
75035
|
}
|
|
@@ -75196,7 +75231,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
75196
75231
|
call:function () {
|
|
75197
75232
|
zim.Ticker.remove(ticker);
|
|
75198
75233
|
pageBack.reg(0,0);
|
|
75199
|
-
pageNext.setMask(null);
|
|
75234
|
+
pageNext.setMask(null);
|
|
75200
75235
|
toPage(that._currentPage+2);
|
|
75201
75236
|
that.moving = false;
|
|
75202
75237
|
turningCheck = false;
|
|
@@ -75250,7 +75285,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
75250
75285
|
that.dispatchEvent("page");
|
|
75251
75286
|
}
|
|
75252
75287
|
});
|
|
75253
|
-
var ticker = zim.Ticker.add(function() {
|
|
75288
|
+
var ticker = zim.Ticker.add(function() {
|
|
75254
75289
|
peel
|
|
75255
75290
|
.c()
|
|
75256
75291
|
.mt(0, height)
|
|
@@ -75299,7 +75334,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
75299
75334
|
if (zot(that.rollUp)) {setTimeout(function () {that.prevPage(speed);}, 10); return that;}
|
|
75300
75335
|
if (that.moving) return;
|
|
75301
75336
|
that.rollUp(width/2+.1, height+.1, "left", speed, "quadIn");
|
|
75302
|
-
}
|
|
75337
|
+
}
|
|
75303
75338
|
that.gotoPage = function(num, speed) {
|
|
75304
75339
|
if (zot(that.rollUp)) {setTimeout(function () {that.gotoPage(num, speed);}, 10); return that;}
|
|
75305
75340
|
num = zim.constrain(num, 0, that.pages.length-1);
|
|
@@ -77253,11 +77288,11 @@ zim.Emitter = function(obj, width, height, interval, num, life, fade, shrink, wa
|
|
|
77253
77288
|
var shrinkMe = particle.emitShape?false:that.shrink;
|
|
77254
77289
|
|
|
77255
77290
|
var myLife = (container?container:particle).life = zik(that.life);
|
|
77291
|
+
that.traceFadeTime = Math.min(myLife, that.traceFadeTime);
|
|
77292
|
+
that.decayTime = Math.min(myLife, that.decayTime);
|
|
77256
77293
|
|
|
77257
77294
|
if (that.decayTime > 0 && (that.fade || shrinkMe || (that.trace && that.traceFadeTime > 0))) {
|
|
77258
|
-
// zog(pool)
|
|
77259
77295
|
if (that.trace && that.traceFadeTime > 0) {
|
|
77260
|
-
// zog("here")
|
|
77261
77296
|
container.animate({
|
|
77262
77297
|
obj:{alpha:0},
|
|
77263
77298
|
time:that.traceFadeTime,
|
|
@@ -83001,7 +83036,15 @@ EVENTS
|
|
|
83001
83036
|
also stores F.altKey, F.ctrlKey, F.metaKey, F.shiftKey
|
|
83002
83037
|
Note: Alt ArrowLeft and Alt ArrowRight has been set to go back or forward in the browser history
|
|
83003
83038
|
"keyup" - fired on keyup - just like the window keyup event with eventObject.keyCode, etc.
|
|
83039
|
+
"pointerdown", "pointermove", "pointerup", "pointerenter", "pointerleave" - mirrors DOM Pointer Events
|
|
83040
|
+
Note: the event object is a raw JavaScript event object, not a CreateJS event object
|
|
83041
|
+
so there is no clear() on the event object nor a once parameter for the on() method, instead use:
|
|
83042
|
+
const ev = F.on("pointerdown", ()=>{
|
|
83043
|
+
F.off("pointerdown", ev);
|
|
83044
|
+
// this will only run once
|
|
83045
|
+
});
|
|
83004
83046
|
"mouseupplus" - fired when the browser window receives a mouseup event
|
|
83047
|
+
NOTE: deprecated - would suggest using pointerup instead of this
|
|
83005
83048
|
also fired when the mouse enters the stage from an iFrame and is no longer down.
|
|
83006
83049
|
Note there is no eventObject.
|
|
83007
83050
|
ALSO see mouseupplusonly for only firing as mouse enters the stage from an iFrame and is no longer down.
|
|
@@ -83014,6 +83057,7 @@ EVENTS
|
|
|
83014
83057
|
This will call the up function as the mouse comes back onto the stage
|
|
83015
83058
|
if the mouse was down when leaving the stage and let up outside the iframe the canvas is in - goodness.
|
|
83016
83059
|
"mouseuplusonly" - fired when the mouse comes back from an iframe (not holding the canvas)
|
|
83060
|
+
NOTE: deprecated - would suggest using pointerup instead of this
|
|
83017
83061
|
and the mouse was down on the canvas and up in the iframe.
|
|
83018
83062
|
this does not fire on a regular mouseup whereas the mouseupplus will.
|
|
83019
83063
|
"wheel" - fired on mousewheel (Window wheel event)
|
|
@@ -83475,6 +83519,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
83475
83519
|
canvas.releasePointerCapture(e.pointerId);
|
|
83476
83520
|
that.dispatchEvent(e);
|
|
83477
83521
|
});
|
|
83522
|
+
|
|
83478
83523
|
canvas.addEventListener("pointermove", function(e) {
|
|
83479
83524
|
that.dispatchEvent(e);
|
|
83480
83525
|
});
|
|
@@ -83502,10 +83547,10 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
83502
83547
|
}
|
|
83503
83548
|
WW.removeEventListener("mousedown", leftEvent, true);
|
|
83504
83549
|
WW.removeEventListener("mousemove", leftEvent, true);
|
|
83505
|
-
WW.removeEventListener("
|
|
83550
|
+
WW.removeEventListener("pointerup", leftEvent);
|
|
83506
83551
|
WW.addEventListener("mousedown", leftEvent, true);
|
|
83507
83552
|
WW.addEventListener("mousemove", leftEvent, true); // tell actual mousemove there was a mouseup
|
|
83508
|
-
WW.addEventListener("
|
|
83553
|
+
WW.addEventListener("pointerup", leftEvent); // give actual mouseup a chance to act
|
|
83509
83554
|
}
|
|
83510
83555
|
|
|
83511
83556
|
function makeStage() {
|
|
@@ -84325,6 +84370,35 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
84325
84370
|
if (assetHolder.sound) assetHolder.sound.pan = value;
|
|
84326
84371
|
}
|
|
84327
84372
|
});
|
|
84373
|
+
Object.defineProperty(assetHolder.proxy, 'paused', {
|
|
84374
|
+
get: function() {
|
|
84375
|
+
if (assetHolder.sound) return assetHolder.sound.paused;
|
|
84376
|
+
else return null;
|
|
84377
|
+
},
|
|
84378
|
+
set: function(value) {
|
|
84379
|
+
assetHolder.paused = value;
|
|
84380
|
+
if (assetHolder.sound) assetHolder.sound.paused = value;
|
|
84381
|
+
}
|
|
84382
|
+
});
|
|
84383
|
+
Object.defineProperty(assetHolder.proxy, 'position', {
|
|
84384
|
+
get: function() {
|
|
84385
|
+
if (assetHolder.sound) return assetHolder.sound.position;
|
|
84386
|
+
else return null;
|
|
84387
|
+
},
|
|
84388
|
+
set: function(value) {
|
|
84389
|
+
assetHolder.position = value;
|
|
84390
|
+
if (assetHolder.sound) assetHolder.sound.position = value;
|
|
84391
|
+
}
|
|
84392
|
+
});
|
|
84393
|
+
Object.defineProperty(assetHolder.proxy, 'duration', {
|
|
84394
|
+
get: function() {
|
|
84395
|
+
if (assetHolder.sound) return assetHolder.sound.duration;
|
|
84396
|
+
else return null;
|
|
84397
|
+
},
|
|
84398
|
+
set: function(value) {
|
|
84399
|
+
zogy("ZIM Aud - duration is read only");
|
|
84400
|
+
}
|
|
84401
|
+
});
|
|
84328
84402
|
return assetHolder.proxy;
|
|
84329
84403
|
}
|
|
84330
84404
|
}
|
|
@@ -84343,9 +84417,10 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
84343
84417
|
assetHolder.play = loaded.play;
|
|
84344
84418
|
assetHolder.type = "Sound";
|
|
84345
84419
|
assetHolder.src = loaded.src;
|
|
84346
|
-
assetHolder.item = loaded.item;
|
|
84420
|
+
assetHolder.item = loaded.item;
|
|
84347
84421
|
if (assetHolder.playParams) {
|
|
84348
84422
|
assetHolder.sound = assetHolder.play.apply(null, assetHolder.playParams);
|
|
84423
|
+
assetHolder.proxy.sound = assetHolder.sound;
|
|
84349
84424
|
if (assetHolder.volume != null) assetHolder.sound.volume = assetHolder.volume;
|
|
84350
84425
|
if (assetHolder.pan != null) assetHolder.sound.pan = assetHolder.pan;
|
|
84351
84426
|
assetHolder.sound.on("complete", function () {
|
|
@@ -85679,8 +85754,12 @@ ABSTRACT SOUND INSTANCE
|
|
|
85679
85754
|
The return result of the play() makes a CreateJS AbstractSoundInstance
|
|
85680
85755
|
var sound = Aud("sound.mp3").play(); // sound is an AbstractSoundInstance
|
|
85681
85756
|
// note: if lazy-loaded then the result of a play() before the sound has loaded
|
|
85682
|
-
// will be a proxy object with
|
|
85683
|
-
// methods, other properties and events will only be available on a play()
|
|
85757
|
+
// will be a proxy object with volume, pan, paused, position and duration properties and will dispatch a complete event
|
|
85758
|
+
// methods, other properties and events will only be available on a play() of the sound played after loaded
|
|
85759
|
+
// or if the sound is played before loaded, there will be a sound property added after loaded
|
|
85760
|
+
// that has the rest of the AbstractSoundInstance properties and methods
|
|
85761
|
+
// for instance, myLazyPlay.sound.muted or myLazyPlay.sound.stop()
|
|
85762
|
+
// If the sound were preloaded, then these would be myPreloadPlay.muted and myPreloadPlay.stop()
|
|
85684
85763
|
|
|
85685
85764
|
METHODS (of AbstractSoundInstance)
|
|
85686
85765
|
** full docs here: https://www.createjs.com/docs/soundjs/classes/AbstractSoundInstance.html
|