zimjs 17.2.7 → 17.2.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 +1 -1
- package/src/zim.js +60 -48
package/package.json
CHANGED
package/src/zim.js
CHANGED
|
@@ -747,11 +747,12 @@ EXAMPLE
|
|
|
747
747
|
const array = ["happy", "sad", "spooked"];
|
|
748
748
|
const randomFromArray = shuffle(array)[0];
|
|
749
749
|
// this will be randomized each time it is run
|
|
750
|
+
// or use ZIM pluck()
|
|
750
751
|
END EXAMPLE
|
|
751
752
|
|
|
752
753
|
EXAMPLE
|
|
753
754
|
const array = shuffle(["happy", "sad", "spooked"]);
|
|
754
|
-
|
|
755
|
+
loop(array, feeling=>{zog(feeling);});
|
|
755
756
|
// this will get random and unique elements of the array
|
|
756
757
|
END EXAMPLE
|
|
757
758
|
|
|
@@ -1652,7 +1653,7 @@ call - the function to call
|
|
|
1652
1653
|
if the obj is an object literal then the first and second parameters are the property name and property value at the current index
|
|
1653
1654
|
if the obj is an string then the first parameter is the letter
|
|
1654
1655
|
if the obj is an HTMLCollection then the first parameter is the tag
|
|
1655
|
-
if the obj is a Container then the first
|
|
1656
|
+
if the obj is a Container then the first parameter is the child
|
|
1656
1657
|
reverse - (default false) set to true to run the loop backwards to 0
|
|
1657
1658
|
interval - (default 0) set to a number of seconds between each loop
|
|
1658
1659
|
use return NEXT to go immediately to the next interval
|
|
@@ -1721,13 +1722,13 @@ RETURNS any value returned from the loop - or true if no value is returned from
|
|
|
1721
1722
|
i = start-i;
|
|
1722
1723
|
|
|
1723
1724
|
if (type=="number") {
|
|
1724
|
-
r = call(i, total, start, end, obj);
|
|
1725
|
+
r = call(i, total, start, end, obj, io);
|
|
1725
1726
|
} else if (type=="array" || type=="string") {
|
|
1726
|
-
r = call(obj[i], i, total, start, end, obj);
|
|
1727
|
+
r = call(obj[i], i, total, start, end, obj, io);
|
|
1727
1728
|
} else if (type=="Dictionary") {
|
|
1728
|
-
r = call(obj[i], vals[i], i, total, start, end, obj);
|
|
1729
|
+
r = call(obj[i], vals[i], i, total, start, end, obj, io);
|
|
1729
1730
|
} else { // nodelist
|
|
1730
|
-
r = call(obj.item(i), i, total, start, end, obj);
|
|
1731
|
+
r = call(obj.item(i), i, total, start, end, obj, io);
|
|
1731
1732
|
}
|
|
1732
1733
|
|
|
1733
1734
|
if (r == 'next') io.next();
|
|
@@ -1762,7 +1763,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
|
|
|
1762
1763
|
} else if (type=="array" || type=="string") {
|
|
1763
1764
|
r = call(obj[i], i, total, start, end, obj, io);
|
|
1764
1765
|
} else if (type=="Dictionary") {
|
|
1765
|
-
r = call(obj[i], vals[i], i, total, start, end, obj);
|
|
1766
|
+
r = call(obj[i], vals[i], i, total, start, end, obj, io);
|
|
1766
1767
|
} else { // nodelist or htmlcollection
|
|
1767
1768
|
r = call(obj.item(i), i, total, start, end, obj, io);
|
|
1768
1769
|
}
|
|
@@ -1799,7 +1800,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
|
|
|
1799
1800
|
if (step) i *= step;
|
|
1800
1801
|
i = start-i;
|
|
1801
1802
|
|
|
1802
|
-
r = call(props[i], obj[props[i]], i, total, start, end, obj);
|
|
1803
|
+
r = call(props[i], obj[props[i]], i, total, start, end, obj, io);
|
|
1803
1804
|
|
|
1804
1805
|
if (r == 'next') io.next();
|
|
1805
1806
|
else if (typeof r != 'undefined') {
|
|
@@ -1820,7 +1821,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
|
|
|
1820
1821
|
if (!immediate) i--;
|
|
1821
1822
|
if (step != 1) i = -start + i*step;
|
|
1822
1823
|
|
|
1823
|
-
r = call(props[i], obj[props[i]], i, total, start, end, obj);
|
|
1824
|
+
r = call(props[i], obj[props[i]], i, total, start, end, obj, io);
|
|
1824
1825
|
|
|
1825
1826
|
if (r == 'next') io.next();
|
|
1826
1827
|
else if (typeof r != 'undefined') {
|
|
@@ -2104,7 +2105,7 @@ pauseTimeLeft - if paused, get how much time is left once unpaused
|
|
|
2104
2105
|
setTimeout(function() {
|
|
2105
2106
|
(call)(obj);
|
|
2106
2107
|
checkTotal();
|
|
2107
|
-
},
|
|
2108
|
+
}, 5);
|
|
2108
2109
|
}
|
|
2109
2110
|
function checkTotal() {
|
|
2110
2111
|
if (total == -1) return;
|
|
@@ -5433,7 +5434,7 @@ speed = 0;
|
|
|
5433
5434
|
zog(sign(speed)); // 0
|
|
5434
5435
|
|
|
5435
5436
|
speed = -20;
|
|
5436
|
-
zog(
|
|
5437
|
+
zog(sign(speed)); // -1
|
|
5437
5438
|
END EXAMPLE
|
|
5438
5439
|
|
|
5439
5440
|
PARAMETERS
|
|
@@ -8878,18 +8879,20 @@ Might have set these on CreateJS DisplayObject
|
|
|
8878
8879
|
});
|
|
8879
8880
|
|
|
8880
8881
|
var frame;
|
|
8881
|
-
var
|
|
8882
|
+
var addCheck;
|
|
8882
8883
|
that.on("mousedown", function (e) {
|
|
8883
|
-
if (e.
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8884
|
+
if (e && e.nativeEvent && e.nativeEvent.touches) {
|
|
8885
|
+
if (e.target.stage) {
|
|
8886
|
+
frame = e.target.stage.frame;
|
|
8887
|
+
if (frame.allowDefault) {
|
|
8888
|
+
addCheck = true;
|
|
8889
|
+
frame.allowDefault = false;
|
|
8890
|
+
}
|
|
8888
8891
|
}
|
|
8889
|
-
}
|
|
8892
|
+
}
|
|
8890
8893
|
});
|
|
8891
8894
|
that.on("pressup", function () {
|
|
8892
|
-
if (frame &&
|
|
8895
|
+
if (frame && addCheck) frame.allowDefault = true;
|
|
8893
8896
|
});
|
|
8894
8897
|
|
|
8895
8898
|
// EFFECTS
|
|
@@ -9755,7 +9758,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
9755
9758
|
return that.cjsContainer_getBounds();
|
|
9756
9759
|
};
|
|
9757
9760
|
|
|
9758
|
-
this.disposeAllChildren = function() {
|
|
9761
|
+
this.disposeAllChildren = function() {
|
|
9759
9762
|
for (var i=this.numChildren-1; i>=0; i--) {
|
|
9760
9763
|
var child = this.getChildAt(i)
|
|
9761
9764
|
if (child.dispose) child.dispose();
|
|
@@ -9780,7 +9783,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
9780
9783
|
return (!zot(this[prop]) || Object.prototype.hasOwnProperty.call(this,prop));
|
|
9781
9784
|
};
|
|
9782
9785
|
};
|
|
9783
|
-
zim.Container.prototype.dispose = function(disposing) {
|
|
9786
|
+
zim.Container.prototype.dispose = function(disposing) {
|
|
9784
9787
|
recursiveDispose(this, disposing);
|
|
9785
9788
|
return true;
|
|
9786
9789
|
};
|
|
@@ -27344,7 +27347,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
27344
27347
|
return p2;
|
|
27345
27348
|
};
|
|
27346
27349
|
};
|
|
27347
|
-
zim.extend(zim.Pane, zim.Container, "clone", "zimContainer", false);
|
|
27350
|
+
zim.extend(zim.Pane, zim.Container, ["clone", "dispose"], "zimContainer", false);
|
|
27348
27351
|
//-58
|
|
27349
27352
|
|
|
27350
27353
|
/*--
|
|
@@ -33792,11 +33795,11 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
33792
33795
|
return that.cloneProps(new zim.List(width, originalHeight, zim.copy(that.originalList, true), viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, originalBorderColor, originalBorderWidth, padding, zim.copy(corner), swipe, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, scrollBarOverlay, slide, slideFactor, slideSnap, slideSnapDamp, shadowColor, shadowBlur, paddingH, paddingV, scrollWheel, damp, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, draggable, boundary, onTop, close, closeColor, collapse, collapseColor, collapsed, excludeCustomTap, organizer, checkBox, pulldown, clone, cancelCurrentDrag, index, noScale, pulldownToggle, optimize, keyEnabled, resizeHandle, resizeBoundary, resizeVisible, continuous, closeOthers, drop, dropTargets, dropSelf, dropCopy, dropColor, dropThickness, dropScrollSpeed, dropReticleAlpha, dropHitTest, dropFull, dropSnap, dropEnd, dropScale, dropWidth, dropHeight, selectedIndex, style, this.group, inherit));
|
|
33793
33796
|
};
|
|
33794
33797
|
this.dispose = function(a,b,disposing) {
|
|
33795
|
-
if (!disposing) {
|
|
33798
|
+
// if (!disposing) {
|
|
33796
33799
|
if (that.stageToggleEvent) stage.off("stagemousedown", that.stageToggleEvent);
|
|
33797
33800
|
if (that.organizer) that.organizer.dispose();
|
|
33798
33801
|
this.zimWindow_dispose();
|
|
33799
|
-
}
|
|
33802
|
+
// }
|
|
33800
33803
|
// that.tabs = that.selected = selected = that.originalList = list = that.organizer = null;
|
|
33801
33804
|
return true;
|
|
33802
33805
|
};
|
|
@@ -58961,13 +58964,13 @@ RETURNS any value returned from the loop - or true if no value is returned from
|
|
|
58961
58964
|
if (step) i *= step;
|
|
58962
58965
|
i = start-i;
|
|
58963
58966
|
if (type=="number") {
|
|
58964
|
-
r = call(i, total, start, end, obj);
|
|
58967
|
+
r = call(i, total, start, end, obj, io);
|
|
58965
58968
|
} else if (type=="array" || type=="string") {
|
|
58966
|
-
r = call(obj[i], i, total, start, end, obj);
|
|
58969
|
+
r = call(obj[i], i, total, start, end, obj, io);
|
|
58967
58970
|
} else if (type=="Dictionary") {
|
|
58968
|
-
r = call(obj[i], vals[i], i, total, start, end, obj);
|
|
58971
|
+
r = call(obj[i], vals[i], i, total, start, end, obj, io);
|
|
58969
58972
|
} else { // nodelist
|
|
58970
|
-
r = call(obj.item(i), i, total, start, end, obj);
|
|
58973
|
+
r = call(obj.item(i), i, total, start, end, obj, io);
|
|
58971
58974
|
}
|
|
58972
58975
|
|
|
58973
58976
|
if (r == 'next') io.next();
|
|
@@ -59002,7 +59005,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
|
|
|
59002
59005
|
} else if (type=="array" || type=="string") {
|
|
59003
59006
|
r = call(obj[i], i, total, start, end, obj, io);
|
|
59004
59007
|
} else if (type=="Dictionary") {
|
|
59005
|
-
r = call(obj[i], vals[i], i, total, start, end, obj);
|
|
59008
|
+
r = call(obj[i], vals[i], i, total, start, end, obj, io);
|
|
59006
59009
|
} else { // nodelist or htmlcollection
|
|
59007
59010
|
r = call(obj.item(i), i, total, start, end, obj, io);
|
|
59008
59011
|
}
|
|
@@ -59039,7 +59042,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
|
|
|
59039
59042
|
if (step) i *= step;
|
|
59040
59043
|
i = start-i;
|
|
59041
59044
|
|
|
59042
|
-
r = call(props[i], obj[props[i]], i, total, start, end, obj);
|
|
59045
|
+
r = call(props[i], obj[props[i]], i, total, start, end, obj, io);
|
|
59043
59046
|
|
|
59044
59047
|
if (r == 'next') io.next();
|
|
59045
59048
|
else if (typeof r != 'undefined') {
|
|
@@ -59060,7 +59063,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
|
|
|
59060
59063
|
if (!immediate) i--;
|
|
59061
59064
|
if (step != 1) i = -start + i*step;
|
|
59062
59065
|
|
|
59063
|
-
r = call(props[i], obj[props[i]], i, total, start, end, obj);
|
|
59066
|
+
r = call(props[i], obj[props[i]], i, total, start, end, obj, io);
|
|
59064
59067
|
|
|
59065
59068
|
if (r == 'next') io.next();
|
|
59066
59069
|
else if (typeof r != 'undefined') {
|
|
@@ -59088,7 +59091,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
|
|
|
59088
59091
|
if (step) i *= step;
|
|
59089
59092
|
i = start-i;
|
|
59090
59093
|
|
|
59091
|
-
r = call(obj.getChildAt(i), i, total, start, end, obj);
|
|
59094
|
+
r = call(obj.getChildAt(i), i, total, start, end, obj, io);
|
|
59092
59095
|
|
|
59093
59096
|
if (r == 'next') io.next();
|
|
59094
59097
|
else if (typeof r != 'undefined') {
|
|
@@ -59109,7 +59112,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
|
|
|
59109
59112
|
if (!immediate) i--;
|
|
59110
59113
|
if (step != 1) i = -start + i*step;
|
|
59111
59114
|
|
|
59112
|
-
r = call(obj.getChildAt(i), i, total, start, end, obj);
|
|
59115
|
+
r = call(obj.getChildAt(i), i, total, start, end, obj, io);
|
|
59113
59116
|
|
|
59114
59117
|
if (r == 'next') io.next();
|
|
59115
59118
|
else if (typeof r != 'undefined') {
|
|
@@ -65059,7 +65062,8 @@ note: the item is not the event object target - as that is the tile
|
|
|
65059
65062
|
var rowSpacings;
|
|
65060
65063
|
var widthScaling = 1;
|
|
65061
65064
|
var heightScaling = 1;
|
|
65062
|
-
|
|
65065
|
+
|
|
65066
|
+
|
|
65063
65067
|
function resize(width, height) {
|
|
65064
65068
|
|
|
65065
65069
|
if (that.normalized) that.resetOriginalReg();
|
|
@@ -69074,6 +69078,7 @@ function apply () {
|
|
|
69074
69078
|
window.addEventListener("pointerdown", that.doPointerDown);
|
|
69075
69079
|
function doDown(e) {
|
|
69076
69080
|
|
|
69081
|
+
|
|
69077
69082
|
if (!that.raycast) return;
|
|
69078
69083
|
|
|
69079
69084
|
if (XR) {
|
|
@@ -69115,6 +69120,7 @@ function apply () {
|
|
|
69115
69120
|
break;
|
|
69116
69121
|
}
|
|
69117
69122
|
}
|
|
69123
|
+
|
|
69118
69124
|
if (material
|
|
69119
69125
|
&& material.map
|
|
69120
69126
|
&& material.map.source
|
|
@@ -69123,11 +69129,12 @@ function apply () {
|
|
|
69123
69129
|
&& material.userData.ta_content
|
|
69124
69130
|
) {
|
|
69125
69131
|
currentDown = obj;
|
|
69132
|
+
|
|
69126
69133
|
var content = material.userData.ta_content;
|
|
69127
69134
|
that.pointerData.mousedown = true;
|
|
69128
|
-
|
|
69129
|
-
|
|
69130
|
-
|
|
69135
|
+
|
|
69136
|
+
doRaycast(content, intersects[i], material.userData.ta_flipped);
|
|
69137
|
+
createjs.handleRemotePointer(that.pointerData.x, that.pointerData.y, "down", e, stage, e.pointerId);
|
|
69131
69138
|
if (controls && controls.maxAzimuthAngle && content) {
|
|
69132
69139
|
if (content.backingOrbit) {
|
|
69133
69140
|
var p = content.globalToLocal(frame.mouseX, frame.mouseY);
|
|
@@ -69140,6 +69147,7 @@ function apply () {
|
|
|
69140
69147
|
}
|
|
69141
69148
|
}
|
|
69142
69149
|
var e2 = new createjs.Event("raydown");
|
|
69150
|
+
|
|
69143
69151
|
e2.mesh = that.mesh = obj;
|
|
69144
69152
|
e2.material = that.material = material;
|
|
69145
69153
|
e2.textureActive = that.textureActive = content;
|
|
@@ -76643,10 +76651,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
76643
76651
|
if (zot(backPress)) backPress = DS.backPress!=null?DS.backPress:true;
|
|
76644
76652
|
if (zot(reverse)) reverse = DS.reverse!=null?DS.reverse:false;
|
|
76645
76653
|
if (zot(continuous)) continuous = DS.continuous!=null?DS.continuous:false;
|
|
76646
|
-
|
|
76647
|
-
|
|
76654
|
+
|
|
76648
76655
|
this.flipped = flipped;
|
|
76649
|
-
var that = this;
|
|
76656
|
+
var that = this;
|
|
76650
76657
|
|
|
76651
76658
|
front.centerReg(this);
|
|
76652
76659
|
var obj;
|
|
@@ -76670,13 +76677,13 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
76670
76677
|
|
|
76671
76678
|
this.flip = function(state, time) {
|
|
76672
76679
|
if (state == that.flipped) return;
|
|
76673
|
-
if (
|
|
76674
|
-
else spin(
|
|
76680
|
+
if (that.flipped) spin(back,front,-1,time);
|
|
76681
|
+
else spin(front,back,1,time);
|
|
76675
76682
|
};
|
|
76676
76683
|
function spin(f, b, d, t) { // current front, back, direction
|
|
76677
76684
|
if (zot(d)) d = 1;
|
|
76678
76685
|
d *= reverse?-1:1;
|
|
76679
|
-
if (continuous) d = reverse
|
|
76686
|
+
if (continuous) d = reverse?-1:1;
|
|
76680
76687
|
if (zot(t)) t = time;
|
|
76681
76688
|
that.flipped = !that.flipped;
|
|
76682
76689
|
that.dispatchEvent("flip");
|
|
@@ -76716,6 +76723,11 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
76716
76723
|
});
|
|
76717
76724
|
}
|
|
76718
76725
|
|
|
76726
|
+
if (flipped) {
|
|
76727
|
+
that.flipped = false;
|
|
76728
|
+
that.flip(true, 0);
|
|
76729
|
+
}
|
|
76730
|
+
|
|
76719
76731
|
if (style!==false) zim.styleTransforms(this, DS);
|
|
76720
76732
|
this.clone = function() {
|
|
76721
76733
|
return that.cloneProps(new zim.Flipper(front.clone(), back.clone(), interactive, time, vertical, flipped, easeRoot, frontPress, backPress, reverse, continuous, style, this.group, inherit));
|
|
@@ -87208,7 +87220,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
87208
87220
|
[127.55,73.3, "#A1E543","AAjLSIAAp6IEiAAIAAJ6gAlELOIAAp2IEiAAIAAJ2gAlEihIAAowIKEAAIAAIwg"],
|
|
87209
87221
|
[32.55,73.05, "#B545E4","Ak6LQIAA2fIJ1AAIAAWfg"]
|
|
87210
87222
|
];
|
|
87211
|
-
var icon = new zim.Rectangle(200,200);
|
|
87223
|
+
var icon = new zim.Rectangle(200,200,color);
|
|
87212
87224
|
zim.loop(data, function (d) {
|
|
87213
87225
|
var s = new zim.Shape().f(d[2]).p(d[3]);
|
|
87214
87226
|
s.setTransform(d[0]+20,d[1]+27);
|
|
@@ -91623,10 +91635,10 @@ pause(state) - pause or unpause the gif
|
|
|
91623
91635
|
see also the startPaused parameter
|
|
91624
91636
|
stop() - stop the gif (same as dispose())
|
|
91625
91637
|
keyout(color, tolerance, replacement) - remove color from Bitmap and a tolerance between 0-1
|
|
91626
|
-
|
|
91627
|
-
|
|
91628
|
-
|
|
91629
|
-
|
|
91638
|
+
the default color is "#389b26" which is a medium dark green
|
|
91639
|
+
the default tolerance is .1 - the higher the tolerance the less sensitive the keying process - so more colors will be removed similar to the provided color
|
|
91640
|
+
color and tolerance can be an array of colors and tolerances (or just one tolerance if all are the same)
|
|
91641
|
+
replacement (default clear) a color to replace the keyed out color with or an optional array to match the colors array if an array is used
|
|
91630
91642
|
reset() - restarts the GIF
|
|
91631
91643
|
dispose() - delete the GIF and remove Ticker
|
|
91632
91644
|
|