zimjs 17.0.0 → 17.0.1
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 +595 -60
- package/ts-src/typings/zim/index.d.ts +87 -46
package/src/zim.js
CHANGED
|
@@ -1698,7 +1698,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
|
|
|
1698
1698
|
}
|
|
1699
1699
|
length = type=="number"?obj:obj.length;
|
|
1700
1700
|
total = getTotal(length-1);
|
|
1701
|
-
if (total == 0) return;
|
|
1701
|
+
if (total == 0) return true;
|
|
1702
1702
|
if (reverse) {
|
|
1703
1703
|
if (interval === 0) {
|
|
1704
1704
|
for(i=start; i>=end; i-=step) {
|
|
@@ -1785,7 +1785,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
|
|
|
1785
1785
|
props.push(i);
|
|
1786
1786
|
}
|
|
1787
1787
|
total = getTotal(length-1);
|
|
1788
|
-
if (total == 0) return;
|
|
1788
|
+
if (total == 0) return true;
|
|
1789
1789
|
if (reverse) {
|
|
1790
1790
|
if (interval === 0) {
|
|
1791
1791
|
for(i=start; i>=end; i-=step) {
|
|
@@ -5617,13 +5617,13 @@ representing the rectangle around the points provided
|
|
|
5617
5617
|
};//-13.34
|
|
5618
5618
|
|
|
5619
5619
|
/*--
|
|
5620
|
-
zim.angle = function(
|
|
5620
|
+
zim.angle = function(a, b, c, d)
|
|
5621
5621
|
|
|
5622
5622
|
angle
|
|
5623
5623
|
zim function
|
|
5624
5624
|
|
|
5625
5625
|
DESCRIPTION
|
|
5626
|
-
Calculates the angle between two points
|
|
5626
|
+
Calculates the angle between two points
|
|
5627
5627
|
|
|
5628
5628
|
NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
|
|
5629
5629
|
|
|
@@ -5636,19 +5636,51 @@ const angle2 = angle(W/2, H/2, W/2-100, H/2+100); // 135
|
|
|
5636
5636
|
const angle3 = angle(W/2, H/2, W/2+100, H/2-100); // 315
|
|
5637
5637
|
END EXAMPLE
|
|
5638
5638
|
|
|
5639
|
+
EXAMPLE
|
|
5640
|
+
// make an orange orthographic pipe with a red end
|
|
5641
|
+
const circle1 = new Circle(20,orange).center();
|
|
5642
|
+
const circle2 = new Circle(20,red).loc(600,500);
|
|
5643
|
+
new Rectangle(20,20,orange)
|
|
5644
|
+
.reg(LEFT,CENTER)
|
|
5645
|
+
.loc(circle1)
|
|
5646
|
+
.bot()
|
|
5647
|
+
.siz(dist(circle1, circle2), circle1.width)
|
|
5648
|
+
.rot(angle(circle1, circle2));
|
|
5649
|
+
END EXAMPLE
|
|
5650
|
+
|
|
5639
5651
|
PARAMETERS
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5652
|
+
a - first Point - any object with x and y values - eg. a zim Container or zim Point or {x:10, y:30}
|
|
5653
|
+
or if four parameter values, an x value of the first point
|
|
5654
|
+
b - second Point - any object with x and y values
|
|
5655
|
+
or if four parameter values, a y value of the first point - see also **
|
|
5656
|
+
c - (default null) an x value of a second point - if using x and y values
|
|
5657
|
+
d - (default null) a y value of a second point - if using x and y values
|
|
5658
|
+
|
|
5659
|
+
** if there is only one point provided, then a first point of 0,0 is assumed
|
|
5660
|
+
and the the point provided becomes the second point
|
|
5643
5661
|
|
|
5644
|
-
RETURNS a positive Number that is the angle between first and second point
|
|
5662
|
+
RETURNS a positive Number that is the angle between first and second point
|
|
5645
5663
|
--*///+13.4
|
|
5646
|
-
zim.angle = function(
|
|
5664
|
+
zim.angle = function(a, b, c, d) {
|
|
5647
5665
|
if (!zim.angleCheck) {z_d("13.4"); zim.angleCheck = true;}
|
|
5648
|
-
if (zot(
|
|
5649
|
-
if (zot(
|
|
5650
|
-
|
|
5651
|
-
|
|
5666
|
+
if (zot(a) || zot(b)) return;
|
|
5667
|
+
if (!zot(a.x)) {
|
|
5668
|
+
if (zot(b)) {
|
|
5669
|
+
a = 0;
|
|
5670
|
+
b = 0;
|
|
5671
|
+
c = a.x;
|
|
5672
|
+
d = a.y;
|
|
5673
|
+
} else {
|
|
5674
|
+
d = b.y;
|
|
5675
|
+
c = b.x;
|
|
5676
|
+
b = a.y;
|
|
5677
|
+
a = a.x;
|
|
5678
|
+
}
|
|
5679
|
+
} else {
|
|
5680
|
+
if (zot(c)) {c = a; a = 0;}
|
|
5681
|
+
if (zot(d)) {d = b; b = 0;}
|
|
5682
|
+
}
|
|
5683
|
+
return (Math.atan2(d-b, c-a)*180/Math.PI+360)%360;
|
|
5652
5684
|
};//-13.4
|
|
5653
5685
|
|
|
5654
5686
|
|
|
@@ -7155,7 +7187,7 @@ lastValue - setting this would go immediately to this value (would not normally
|
|
|
7155
7187
|
};//-14
|
|
7156
7188
|
|
|
7157
7189
|
/*--
|
|
7158
|
-
zim.Proportion = function(baseMin, baseMax, targetMin, targetMax, factor, targetRound, clamp)
|
|
7190
|
+
zim.Proportion = function(baseMin, baseMax, targetMin, targetMax, factor, targetRound, clamp, clampMin, clampMax)
|
|
7159
7191
|
|
|
7160
7192
|
Proportion
|
|
7161
7193
|
zim class
|
|
@@ -7167,6 +7199,8 @@ For instance, like a slider controlling the scale of an object or sound volume.
|
|
|
7167
7199
|
Make a Proportion object and then in an interval, ticker or event,
|
|
7168
7200
|
convert the base value to the target value using the convert method.
|
|
7169
7201
|
|
|
7202
|
+
SEE: https://zimjs.com/test8/clamp.html
|
|
7203
|
+
|
|
7170
7204
|
NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
|
|
7171
7205
|
|
|
7172
7206
|
EXAMPLE
|
|
@@ -7191,6 +7225,9 @@ targetMax - (default 1) max for the output scale (say volume)
|
|
|
7191
7225
|
factor - (default 1) is going the same direction and -1 is going in opposite direction
|
|
7192
7226
|
targetRound - (default false) set to true to round the converted number
|
|
7193
7227
|
clamp - (default true) set to false to let results go outside min and max range
|
|
7228
|
+
also see clampMin and clampMax to adjust ends individually
|
|
7229
|
+
clampMin - (default clamp) set to true or false to let results go outside min range
|
|
7230
|
+
clampMax - (default clamp) set to true or false to let results go outside max range
|
|
7194
7231
|
|
|
7195
7232
|
METHODS
|
|
7196
7233
|
convert(input) - will return the output property (for instance, a volume)
|
|
@@ -7200,8 +7237,8 @@ just call the convert method right away if you want it to start at a different b
|
|
|
7200
7237
|
for instance, if your slider went from 100 to 500 and you want to start at half way
|
|
7201
7238
|
make the object and call p.convert(300); on the next line
|
|
7202
7239
|
--*///+15
|
|
7203
|
-
zim.Proportion = function(baseMin, baseMax, targetMin, targetMax, factor, targetRound, clamp) {
|
|
7204
|
-
var sig = "baseMin, baseMax, targetMin, targetMax, factor, targetRound, clamp";
|
|
7240
|
+
zim.Proportion = function(baseMin, baseMax, targetMin, targetMax, factor, targetRound, clamp, clampMin, clampMax) {
|
|
7241
|
+
var sig = "baseMin, baseMax, targetMin, targetMax, factor, targetRound, clamp, clampMin, clampMax";
|
|
7205
7242
|
var duo; if (duo = zob(zim.Proportion, arguments, sig, this)) return duo;
|
|
7206
7243
|
z_d("15");
|
|
7207
7244
|
// factor - set to 1 for increasing and -1 for decreasing
|
|
@@ -7211,6 +7248,8 @@ make the object and call p.convert(300); on the next line
|
|
|
7211
7248
|
if (zot(factor)) factor = 1;
|
|
7212
7249
|
if (zot(targetRound)) targetRound = false;
|
|
7213
7250
|
if (zot(clamp)) clamp = true;
|
|
7251
|
+
if (zot(clampMin)) clampMin = clamp;
|
|
7252
|
+
if (zot(clampMax)) clampMax = clamp;
|
|
7214
7253
|
|
|
7215
7254
|
// proportion
|
|
7216
7255
|
var proportion;
|
|
@@ -7219,10 +7258,8 @@ make the object and call p.convert(300); on the next line
|
|
|
7219
7258
|
this.convert = function(baseAmount) {
|
|
7220
7259
|
if (zot(baseAmount)) baseAmount = baseMin; // just start at the min otherwise call immediate(baseValue);
|
|
7221
7260
|
if (isNaN(baseAmount) || (baseMax-baseMin==0)) {return;}
|
|
7222
|
-
if (
|
|
7223
|
-
|
|
7224
|
-
baseAmount = Math.min(baseAmount, baseMax);
|
|
7225
|
-
}
|
|
7261
|
+
if (clampMin) baseAmount = Math.max(baseAmount, baseMin);
|
|
7262
|
+
if (clampMax) baseAmount = Math.min(baseAmount, baseMax);
|
|
7226
7263
|
proportion = (baseAmount - baseMin) / (baseMax - baseMin);
|
|
7227
7264
|
if (factor > 0) {
|
|
7228
7265
|
targetAmount = targetMin + (targetMax-targetMin) * proportion;
|
|
@@ -7235,7 +7272,7 @@ make the object and call p.convert(300); on the next line
|
|
|
7235
7272
|
};//-15
|
|
7236
7273
|
|
|
7237
7274
|
/*--
|
|
7238
|
-
zim.ProportionDamp = function(baseMin, baseMax, targetMin, targetMax, damp, factor, targetRound, clamp)
|
|
7275
|
+
zim.ProportionDamp = function(baseMin, baseMax, targetMin, targetMax, damp, factor, targetRound, clamp, clampMin, clampMax)
|
|
7239
7276
|
|
|
7240
7277
|
ProportionDamp
|
|
7241
7278
|
zim class
|
|
@@ -7266,6 +7303,9 @@ damp - (default .1) the damp value with 1 being no damping and 0 being no moveme
|
|
|
7266
7303
|
factor - (default 1) is going the same direction and -1 is going in opposite direction
|
|
7267
7304
|
targetRound - (default false) set to true to round the converted number
|
|
7268
7305
|
clamp - (default true) set to false to let results go outside min and max range
|
|
7306
|
+
also see clampMin and clampMax to adjust ends individually
|
|
7307
|
+
clampMin - (default clamp) set to true or false to let results go outside min range
|
|
7308
|
+
clampMax - (default clamp) set to true or false to let results go outside max range
|
|
7269
7309
|
|
|
7270
7310
|
METHODS
|
|
7271
7311
|
convert(input) - converts a base value to a target value
|
|
@@ -7280,8 +7320,8 @@ NOTE: the object always starts by assuming baseMin as baseValue
|
|
|
7280
7320
|
if you want to start or go to an immediate value without easing then
|
|
7281
7321
|
call the pd.immediate(baseValue) method with your desired baseValue (not targetValue)
|
|
7282
7322
|
--*///+16
|
|
7283
|
-
zim.ProportionDamp = function(baseMin, baseMax, targetMin, targetMax, damp, factor, targetRound, clamp) {
|
|
7284
|
-
var sig = "baseMin, baseMax, targetMin, targetMax, damp, factor, targetRound, clamp";
|
|
7323
|
+
zim.ProportionDamp = function(baseMin, baseMax, targetMin, targetMax, damp, factor, targetRound, clamp, clampMin, clampMax) {
|
|
7324
|
+
var sig = "baseMin, baseMax, targetMin, targetMax, damp, factor, targetRound, clamp, clampMin, clampMax";
|
|
7285
7325
|
var duo; if (duo = zob(zim.ProportionDamp, arguments, sig, this)) return duo;
|
|
7286
7326
|
z_d("16");
|
|
7287
7327
|
// damp - can be changed via damp get/set method property
|
|
@@ -7294,6 +7334,8 @@ call the pd.immediate(baseValue) method with your desired baseValue (not targetV
|
|
|
7294
7334
|
if (zot(factor)) factor = 1;
|
|
7295
7335
|
if (zot(targetRound)) targetRound = false;
|
|
7296
7336
|
if (zot(clamp)) clamp = true;
|
|
7337
|
+
if (zot(clampMin)) clampMin = clamp;
|
|
7338
|
+
if (zot(clampMax)) clampMax = clamp;
|
|
7297
7339
|
|
|
7298
7340
|
this.damp = damp; // want to expose as a property we can change
|
|
7299
7341
|
var that = this;
|
|
@@ -7317,10 +7359,8 @@ call the pd.immediate(baseValue) method with your desired baseValue (not targetV
|
|
|
7317
7359
|
function calculate() {
|
|
7318
7360
|
if (isNaN(baseAmount) || (baseMax-baseMin==0)) {return;}
|
|
7319
7361
|
|
|
7320
|
-
if (
|
|
7321
|
-
|
|
7322
|
-
baseAmount = Math.min(baseAmount, baseMax);
|
|
7323
|
-
}
|
|
7362
|
+
if (clampMin) baseAmount = Math.max(baseAmount, baseMin);
|
|
7363
|
+
if (clampMax) baseAmount = Math.min(baseAmount, baseMax);
|
|
7324
7364
|
|
|
7325
7365
|
proportion = (baseAmount - baseMin) / (baseMax - baseMin);
|
|
7326
7366
|
targetDifference = targetMax - targetMin;
|
|
@@ -14806,7 +14846,7 @@ adjust - (default 0) pixels to bring center towards vertical base
|
|
|
14806
14846
|
dashed - (default false) set to true for dashed border (if borderWidth or borderColor set)
|
|
14807
14847
|
or set to an array of line size then space size, etc.
|
|
14808
14848
|
eg. [20, 10] is 20 line and 10 space repeated and [20,100,50,10] is 20 line, 100 space, 50 line, 10 space, etc.
|
|
14809
|
-
|
|
14849
|
+
strokeObj - (default {caps:"butt", joints:"miter", miterLimit:10, ignoreScale:false}) set to adjust stroke properties
|
|
14810
14850
|
caps options: "butt", "round", "square" or 0,1,2
|
|
14811
14851
|
joints options: "miter", "round", "bevel" or 0,1,2
|
|
14812
14852
|
miterLimit is the ration at which the mitered joint will be clipped
|
|
@@ -22449,8 +22489,8 @@ type - the name of the class as a String
|
|
|
22449
22489
|
text - get or set the text on the path
|
|
22450
22490
|
path - read-only access to path - but can manipulate the path
|
|
22451
22491
|
letters - access to ZIM Container of labels used for letters
|
|
22452
|
-
for instance labels.loop(
|
|
22453
|
-
or animate as a sequence labels.animate({props:{scale:1.5}, loop:true, rewind:true, sequence
|
|
22492
|
+
for instance labels.loop(label=>{label.color = red;});
|
|
22493
|
+
or animate as a sequence labels.animate({props:{scale:1.5}, loop:true, rewind:true, sequence:.2});
|
|
22454
22494
|
numLetters - how many letters - same as letters.numChildren
|
|
22455
22495
|
percents - access to the array of percents for letter positioning - resize() after changing unless interactive which auto resizes
|
|
22456
22496
|
color - get or set the color of the text
|
|
@@ -24109,8 +24149,10 @@ METHODS
|
|
|
24109
24149
|
setBacking(type, newBacking) - dynamically set any type of backing for button (if null removes backing for that type)
|
|
24110
24150
|
Backing types are: "backing", "rollBacking", "downBacking", "toggleBacking", "rollToggleBacking", "downToggleBacking", "waitBacking", "rollWaitBacking", "downWaitBacking"
|
|
24111
24151
|
note - all backing will have a pattern property if a pattern is set as a backing
|
|
24152
|
+
returns object for chaining
|
|
24112
24153
|
setIcon(type, newIcon) - dynamically set any type of icon for button (if null removes icon for that type)
|
|
24113
24154
|
Icon types are: "icon", "rollIcon", "downIcon", "toggleIcon", "rollToggleIcon", "downToggleIcon", "waitIcon", "rollWaitIcon", "downWaitIcon"
|
|
24155
|
+
returns object for chaining
|
|
24114
24156
|
toggle(state) - forces a toggle of label, backing and icon if set
|
|
24115
24157
|
state defaults to null so just toggles if left blank
|
|
24116
24158
|
pass in true to go to the toggled state and false to go to the original state
|
|
@@ -24955,10 +24997,12 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
24955
24997
|
// setBacking or leave backing parameter blank to remove this type of backing
|
|
24956
24998
|
this.setBacking = function(type, newBacking) {
|
|
24957
24999
|
setObject(type, newBacking);
|
|
25000
|
+
return that;
|
|
24958
25001
|
};
|
|
24959
25002
|
// setIcon or leave icon parameter blank to remove this type of icon
|
|
24960
25003
|
this.setIcon = function(type, newIcon) {
|
|
24961
25004
|
setObject(type, newIcon);
|
|
25005
|
+
return that;
|
|
24962
25006
|
};
|
|
24963
25007
|
function setObject(type, newObject) {
|
|
24964
25008
|
if (zot(type)) return that;
|
|
@@ -27467,7 +27511,8 @@ scrollBarH - (default true) if scrolling in horizontal is needed then show scrol
|
|
|
27467
27511
|
scrollBarV - (default true) if scrolling in vertical is needed then show scrollBar
|
|
27468
27512
|
slide - (default true) Boolean to throw the content when drag/swipe released
|
|
27469
27513
|
slideFactor - (default .9) is the factor multiplied by dragging velocity (1 no slowing, .7 fast slowing)
|
|
27470
|
-
slideSnap - (default true) slides past boundary and then snaps back to boundary when released
|
|
27514
|
+
slideSnap - (default true - false if no vertical scroll) slides past boundary and then snaps back to boundary when released
|
|
27515
|
+
also VERTICAL, HORIZONTAL, and false
|
|
27471
27516
|
slideSnapDamp - (default .1) the damping to snap back to boundary
|
|
27472
27517
|
interactive - (default true) allows interaction with content in window
|
|
27473
27518
|
set to false and whole window will be swipeable but not interactive inside
|
|
@@ -27655,6 +27700,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
27655
27700
|
if (scrollBarDrag) scrollBarFade = DS.scrollBarFade!=null?DS.scrollBarFade:false;
|
|
27656
27701
|
if (zot(slide)) slide=DS.slide!=null?DS.slide:true;
|
|
27657
27702
|
if (zot(slideFactor)) slideFactor=DS.slideFactor!=null?DS.slideFactor:.9;
|
|
27703
|
+
if (!scrollBarV && zot(slideSnap) && DS.slideSnap==null) slideSnap = false;
|
|
27658
27704
|
if (zot(slideSnap)) slideSnap=DS.slideSnap!=null?DS.slideSnap:"vertical"; // true / auto, vertical, horizontal, false / none
|
|
27659
27705
|
if (zot(interactive)) interactive=DS.interactive!=null?DS.interactive:true;
|
|
27660
27706
|
if (zot(shadowColor)) shadowColor=DS.shadowColor!=null?DS.shadowColor:"rgba(0,0,0,.3)";
|
|
@@ -30880,6 +30926,8 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
|
|
|
30880
30926
|
that.label.dispose();
|
|
30881
30927
|
edgeLeft.dispose();
|
|
30882
30928
|
edgeRight.dispose();
|
|
30929
|
+
that.label.positionBlinkerAndSelection();
|
|
30930
|
+
if (that.label.focus) that.label.blinker.replayTween();
|
|
30883
30931
|
}
|
|
30884
30932
|
|
|
30885
30933
|
var lastText = label.text;
|
|
@@ -30926,6 +30974,7 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
|
|
|
30926
30974
|
lastText = value;
|
|
30927
30975
|
label.setText(value, true); // true for noEvent
|
|
30928
30976
|
doPlaceholder();
|
|
30977
|
+
that.label.positionBlinkerAndSelection();
|
|
30929
30978
|
if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && that.stage) that.stage.update();
|
|
30930
30979
|
}
|
|
30931
30980
|
});
|
|
@@ -31327,7 +31376,7 @@ zim.extend(zim.TextInput.LabelInput, zim.Label, "dispose", "zimLabel", false);
|
|
|
31327
31376
|
|
|
31328
31377
|
|
|
31329
31378
|
/*--
|
|
31330
|
-
zim.List = function(width, height, list, viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, borderColor, borderWidth, padding, 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, selectedIndex, style, group, inherit)
|
|
31379
|
+
zim.List = function(width, height, list, viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, borderColor, borderWidth, padding, 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, dropColor, dropThickness, dropScrollSpeed, dropReticleAlpha, selectedIndex, style, group, inherit)
|
|
31331
31380
|
|
|
31332
31381
|
List
|
|
31333
31382
|
zim class - extends a zim.Window which extends a zim.Container which extends a createjs.Container
|
|
@@ -31399,6 +31448,30 @@ const list = new List({
|
|
|
31399
31448
|
S.update();
|
|
31400
31449
|
END EXAMPLE
|
|
31401
31450
|
|
|
31451
|
+
EXAMPLE
|
|
31452
|
+
// drop items onto own list or other list
|
|
31453
|
+
// drop is set to true in the STYLE - this means the list can drop its items onto itself
|
|
31454
|
+
// dropTargets is set after the lists are made - to be able to drop onto other lists
|
|
31455
|
+
// these two things are separate - items can be dropped onto other lists but not their own, etc.
|
|
31456
|
+
|
|
31457
|
+
const w = 60;
|
|
31458
|
+
const h = 60;
|
|
31459
|
+
STYLE = {
|
|
31460
|
+
Rectangle:{width:w, height:h, color:series(blue,green,orange,yellow,pink)},
|
|
31461
|
+
List:{vertical:false, spacing:null, viewNum:9, drop:true}
|
|
31462
|
+
}
|
|
31463
|
+
const items = [];
|
|
31464
|
+
loop(40,()=>{items.push(new Rectangle())})
|
|
31465
|
+
const list = new List(600, h*1.5, items).center().mov(0, -100);
|
|
31466
|
+
|
|
31467
|
+
const items2 = [];
|
|
31468
|
+
loop(40,()=>{items2.push(new Rectangle())})
|
|
31469
|
+
const list2 = new List(600, h*1.5, items2).center().mov(0,100);
|
|
31470
|
+
|
|
31471
|
+
list.dropTargets = list2;
|
|
31472
|
+
list2.dropTargets = list;
|
|
31473
|
+
END EXAMPLE
|
|
31474
|
+
|
|
31402
31475
|
EXAMPLE
|
|
31403
31476
|
// make a pulldown - this must start with a name for the list
|
|
31404
31477
|
// see https://zimjs.com/ten/pulldown.html for nested lists
|
|
@@ -31627,6 +31700,24 @@ resizeBoundary - (default null) add a ZIM Boundary() object for the resize handl
|
|
|
31627
31700
|
resizeVisible - (default false) set to true to always see the resizeHandle - if resizeHandle is set to true
|
|
31628
31701
|
continuous - (default false) set to true to make the list scroll continuously - should have more elements than the viewNum for this
|
|
31629
31702
|
closeOthers - (default false) set to true to close any open branches before expanding selected branch
|
|
31703
|
+
drop - (default false) - set to true to allow drag and drop of items onto the current list
|
|
31704
|
+
if the list is vertical, dragging the item horizontally will pull it from the list
|
|
31705
|
+
the item can then be dragged to a different location and dropped in place
|
|
31706
|
+
for a horizontal list, dragging the item vertical will pull it from the list
|
|
31707
|
+
also see the dropTargets parameter and the drop and dropTarget properties
|
|
31708
|
+
note: the dropTargets alone can be set to drop onto other lists but not the current list
|
|
31709
|
+
also see updateDrop() method if a list has been moved or scaled
|
|
31710
|
+
dropTargets - (default null) - add a list or an array of lists to drop an item from the current list
|
|
31711
|
+
see the drop parameter and the drop and dropTargets properties
|
|
31712
|
+
note: dropTargets can be set without setting the drop parameter to true
|
|
31713
|
+
and then items can be dragged to the target lists but not onto the current list
|
|
31714
|
+
also see updateDrop() method if a list has been moved or scaled
|
|
31715
|
+
dropColor - (default white) - the color of the diamond reticle that indicates where an item will be dropped
|
|
31716
|
+
dropThickness - (default 1) - the thickness of the diamond reticle that indicates where an item will be dropped
|
|
31717
|
+
dropScrollSpeed - (default 5) - the speed the list is scrolled as a drop item is dragged up to 50px off an end of the list
|
|
31718
|
+
this is only applied if the list scrolls on that end
|
|
31719
|
+
the speed is multiplied by 1.5 when the item is between 50px and 80px off the end
|
|
31720
|
+
dropReticleAlpha - (default 1) - set the alpha of the drop reticle diamond - set to 0 to not show reticle
|
|
31630
31721
|
selectedIndex - same as index, kept in for backwards compatibility in ZIM DUO
|
|
31631
31722
|
style - (default true) set to false to ignore styles set with the STYLE - will receive original parameter defaults
|
|
31632
31723
|
group - (default null) set to String (or comma delimited String) so STYLE can set default styles to the group(s) (like a CSS class)
|
|
@@ -31674,6 +31765,7 @@ openAtNum(idNum, closeOthers) - open an accordion list at a specific id number
|
|
|
31674
31765
|
and then expand any ids to see more ids nested inside
|
|
31675
31766
|
the idNum should be something like 6 or 12 without the word id.
|
|
31676
31767
|
closeOthers defaults to false - set to true to close any open branches before opening at idNum
|
|
31768
|
+
updateDrop() - updates global locations of list if being used as a drop location and list has been moved or scaled
|
|
31677
31769
|
hasProp(property as String) - returns true if property exists on object else returns false
|
|
31678
31770
|
clone() - makes a copy with properties such as x, y, etc. also copied
|
|
31679
31771
|
dispose() - removes from parent, removes event listeners - must still set outside references to null for garbage collection
|
|
@@ -31739,6 +31831,7 @@ checkBoxes - read-only array of CheckBox objects if checkBox parameter is true
|
|
|
31739
31831
|
itemsText - read-only array of text for labels (or null element if no label)
|
|
31740
31832
|
itemWidth - the width of each item (unless custom items)
|
|
31741
31833
|
itemHeight - the height of each item (unless custom items)
|
|
31834
|
+
spacing - get the spacing
|
|
31742
31835
|
length - read-only length of the list
|
|
31743
31836
|
tabs - a reference to the tabs object used in the list
|
|
31744
31837
|
organizer - a reference to the organizer object if used
|
|
@@ -31752,6 +31845,15 @@ toggled - for accordion get or set whether the main (root) accordion is open (tr
|
|
|
31752
31845
|
collapseIcon - access to the ZIM Shape if there is a collapse triangle
|
|
31753
31846
|
collapsed - get or set whether the list is collapsed - must start with collapse parameter set to true
|
|
31754
31847
|
also see collapse() method
|
|
31848
|
+
drop - get or set to allow drag and drop of items onto the current lists - see drop parameter
|
|
31849
|
+
dropTargets - get or set a list or an array of lists to drop an item from the current list - see dropTargets parameter
|
|
31850
|
+
dropColor - get or set the color of the diamond reticle that indicates where an item will be dropped - see dropColor
|
|
31851
|
+
dropReticle - each list that can be dropped on gets a dropReticle property that is the ZIM rectangle
|
|
31852
|
+
so individual reticles can be adjusted - say different colors for different lists
|
|
31853
|
+
dropItem - after a dropdown event, the dropItem is the ghost being dragged
|
|
31854
|
+
dropIndex - after a dropdown event, the dropIndex is the original index of the item being dragged
|
|
31855
|
+
dropList - after a dropup event, the dropList is the list that the item was dropped into (could be original list)
|
|
31856
|
+
dropNewIndex - after a dropup event, the dropNewIndex is the index in the list the item has been dropped
|
|
31755
31857
|
enabled - default is true - set to false to disable
|
|
31756
31858
|
|
|
31757
31859
|
ALSO: see all Window properties - like titleBar, titleBarLabel, resizeHandle, etc.
|
|
@@ -31771,14 +31873,18 @@ dispatches a "bloom" event for each item that is created when blooming
|
|
|
31771
31873
|
dispatches an "expanded" event when items have been expanded
|
|
31772
31874
|
this receives an event object with an items property of the items just opened
|
|
31773
31875
|
dispatches a "collapsed" event when items have been collapsed
|
|
31876
|
+
dispatches a "dropdown" event when drop item is pulled from list
|
|
31877
|
+
list will have dropItem and dropIndex properties
|
|
31878
|
+
dispatches a "dropup" event when drop item is dropped
|
|
31879
|
+
list will have dropItem, dropList and dropNewIndex properties
|
|
31774
31880
|
|
|
31775
31881
|
ALSO: All Window events including "scrolling"
|
|
31776
31882
|
|
|
31777
31883
|
ALSO: see the CreateJS Easel Docs for Container events such as:
|
|
31778
31884
|
added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmove, pressup, removed, rollout, rollover
|
|
31779
31885
|
--*///+60.5
|
|
31780
|
-
zim.List = function(width, height, list, viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, borderColor, borderWidth, padding, 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, selectedIndex, style, group, inherit) {
|
|
31781
|
-
var sig = "width, height, list, viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, borderColor, borderWidth, padding, 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, selectedIndex, style, group, inherit";
|
|
31886
|
+
zim.List = function(width, height, list, viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, borderColor, borderWidth, padding, 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, dropColor, dropThickness, dropScrollSpeed, dropReticleAlpha, selectedIndex, style, group, inherit) {
|
|
31887
|
+
var sig = "width, height, list, viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, borderColor, borderWidth, padding, 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, dropColor, dropThickness, dropScrollSpeed, dropReticleAlpha, selectedIndex, style, group, inherit";
|
|
31782
31888
|
var duo; if (duo = zob(zim.List, arguments, sig, this)) return duo;
|
|
31783
31889
|
z_d("60.5");
|
|
31784
31890
|
|
|
@@ -31871,6 +31977,14 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
31871
31977
|
if (zot(continuous)) continuous = DS.continuous!=null?DS.continuous:false;
|
|
31872
31978
|
if (zot(closeOthers)) closeOthers = DS.closeOthers!=null?DS.closeOthers:false;
|
|
31873
31979
|
|
|
31980
|
+
if (zot(drop)) drop = DS.drop!=null?DS.drop:false;
|
|
31981
|
+
if (zot(dropTargets)) dropTargets = DS.dropTargets!=null?DS.dropTargets:null;
|
|
31982
|
+
if (zot(dropColor)) dropColor = DS.dropColor!=null?DS.dropColor:zim.white;
|
|
31983
|
+
if (zot(dropThickness)) dropThickness = DS.dropThickness!=null?DS.dropThickness:1;
|
|
31984
|
+
if (zot(dropScrollSpeed)) dropScrollSpeed = DS.dropScrollSpeed!=null?DS.dropScrollSpeed:5;
|
|
31985
|
+
if (zot(dropReticleAlpha)) dropReticleAlpha = DS.dropReticleAlpha!=null?DS.dropReticleAlpha:1;
|
|
31986
|
+
|
|
31987
|
+
|
|
31874
31988
|
if (titleBar === false) titleBar = null;
|
|
31875
31989
|
this.vertical = vertical;
|
|
31876
31990
|
|
|
@@ -31965,6 +32079,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
31965
32079
|
this.align = align;
|
|
31966
32080
|
this.valign = valign;
|
|
31967
32081
|
this.indent = indent;
|
|
32082
|
+
this.spacing = spacing;
|
|
31968
32083
|
|
|
31969
32084
|
if (!zot(organizer)) {
|
|
31970
32085
|
height = height - organizer.height;
|
|
@@ -32415,6 +32530,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32415
32530
|
|
|
32416
32531
|
this.addAt = function(items, index, style, clone) {
|
|
32417
32532
|
if (zot(items)) return that;
|
|
32533
|
+
var lastO = that.optimize;
|
|
32534
|
+
that.optimize = false;
|
|
32418
32535
|
that.tabs.loop(function(item) {
|
|
32419
32536
|
item.visible = true;
|
|
32420
32537
|
});
|
|
@@ -32463,19 +32580,22 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32463
32580
|
// that.contentContainer.y = 0;
|
|
32464
32581
|
|
|
32465
32582
|
that.update();
|
|
32583
|
+
that.optimize = lastO;
|
|
32466
32584
|
return that;
|
|
32467
32585
|
};
|
|
32468
32586
|
|
|
32469
32587
|
this.removeAt = function(num, index) {
|
|
32588
|
+
var lastO = that.optimize;
|
|
32589
|
+
that.optimize = false;
|
|
32470
32590
|
if (continuous) that.tabs.removeAt(num, index+list.length);
|
|
32471
32591
|
that.tabs.removeAt(num, index);
|
|
32472
|
-
that.tabs.loop(function(item) {
|
|
32592
|
+
that.tabs.loop(function(item) { // optimize sets off stage items to visible false
|
|
32473
32593
|
item.visible = true;
|
|
32474
32594
|
});
|
|
32475
32595
|
_index = that.tabs.index;
|
|
32476
32596
|
var b = tabs.getBounds();
|
|
32477
32597
|
tabs.setBounds(0,0,b.width,b.height);
|
|
32478
|
-
|
|
32598
|
+
|
|
32479
32599
|
// that.contentContainer.x = 0; // why go back to 0? Changed in Cat 01
|
|
32480
32600
|
// that.contentContainer.y = 0;
|
|
32481
32601
|
|
|
@@ -32484,6 +32604,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32484
32604
|
if (b.height < height) that.scrollY = 0; // zot(titleBar)?0:titleBarHeight;
|
|
32485
32605
|
|
|
32486
32606
|
that.update();
|
|
32607
|
+
that.optimize = lastO;
|
|
32487
32608
|
|
|
32488
32609
|
return that;
|
|
32489
32610
|
};
|
|
@@ -32516,6 +32637,396 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32516
32637
|
});
|
|
32517
32638
|
return that;
|
|
32518
32639
|
};
|
|
32640
|
+
|
|
32641
|
+
// DROP - Added for ZIM 017 to drag and drop items to same list or other lists
|
|
32642
|
+
|
|
32643
|
+
var dropCheck = false;
|
|
32644
|
+
var frame;
|
|
32645
|
+
if (drop || dropTargets) makeDrop();
|
|
32646
|
+
|
|
32647
|
+
function makeDrop() {
|
|
32648
|
+
if (dropCheck) return true;
|
|
32649
|
+
dropCheck = true;
|
|
32650
|
+
|
|
32651
|
+
var downPoint;
|
|
32652
|
+
var downItem;
|
|
32653
|
+
var checkItem;
|
|
32654
|
+
var itemPoint;
|
|
32655
|
+
var itemIndex;
|
|
32656
|
+
var itemAlpha;
|
|
32657
|
+
var ghost;
|
|
32658
|
+
|
|
32659
|
+
|
|
32660
|
+
// drop and dropTargets are assigned independently but both are added to dropTargets array
|
|
32661
|
+
if (dropTargets && !Array.isArray(dropTargets)) dropTargets = [dropTargets];
|
|
32662
|
+
if (!dropTargets) dropTargets = [];
|
|
32663
|
+
if (drop) dropTargets.unshift(that);
|
|
32664
|
+
|
|
32665
|
+
that.added(function(stage) {
|
|
32666
|
+
frame = stage.frame;
|
|
32667
|
+
zim.loop(dropTargets, function(target) {
|
|
32668
|
+
target.dropReticle = new zim.Rectangle(20,20,clear,dropColor,dropThickness).reg(CENTER).rot(45).alp(dropReticleAlpha);
|
|
32669
|
+
target.dropReticleIndex = null;
|
|
32670
|
+
target.zgb = target.boundsToGlobal();
|
|
32671
|
+
target.zgs = target.getConcatenatedDisplayProps().matrix.decompose().scaleX/stage.scaleX;
|
|
32672
|
+
});
|
|
32673
|
+
});
|
|
32674
|
+
|
|
32675
|
+
that.dropDown = that.on("mousedown", function(e){
|
|
32676
|
+
// make sure is item in list
|
|
32677
|
+
downItem = checkItem = e.target;
|
|
32678
|
+
// e.target can be something in the item - or the item
|
|
32679
|
+
// but custom List items are usually in a Container
|
|
32680
|
+
// so want to drag the item which is the child of the container that is in the List items
|
|
32681
|
+
if (!that.items.includes(downItem)) {
|
|
32682
|
+
var good = false;
|
|
32683
|
+
var checkItem = downItem
|
|
32684
|
+
while(checkItem.parent) {
|
|
32685
|
+
if (that.items.includes(checkItem.parent)) {
|
|
32686
|
+
good = true;
|
|
32687
|
+
downItem = checkItem;
|
|
32688
|
+
break;
|
|
32689
|
+
}
|
|
32690
|
+
checkItem = checkItem.parent;
|
|
32691
|
+
}
|
|
32692
|
+
if (!good) return;
|
|
32693
|
+
}
|
|
32694
|
+
downPoint = that.globalToLocal(frame.mouseX, frame.mouseY);
|
|
32695
|
+
itemPoint = downItem.globalToLocal(frame.mouseX, frame.mouseY);
|
|
32696
|
+
itemIndex = zot(checkItem.znum) ? checkItem.parent.znum : checkItem.znum;
|
|
32697
|
+
itemAlpha = downItem.alpha;
|
|
32698
|
+
|
|
32699
|
+
that.dropList = null;
|
|
32700
|
+
that.dropNewIndex = null;
|
|
32701
|
+
});
|
|
32702
|
+
|
|
32703
|
+
function scrollUp(target, dropScrollSpeed) {
|
|
32704
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
32705
|
+
target.scrollInt = zim.interval(.01, function() {
|
|
32706
|
+
if (target.dropReticle.parent) target.dropReticle.removeFrom();
|
|
32707
|
+
if (target.vertical) {
|
|
32708
|
+
target.scrollY += dropScrollSpeed;
|
|
32709
|
+
if (target.scrollY > 0) {
|
|
32710
|
+
target.scrollY = 0;
|
|
32711
|
+
target.scrollInt.clear();
|
|
32712
|
+
}
|
|
32713
|
+
} else {
|
|
32714
|
+
target.scrollX += dropScrollSpeed;
|
|
32715
|
+
if (target.scrollX > 0) {
|
|
32716
|
+
target.scrollX = 0;
|
|
32717
|
+
target.scrollInt.clear();
|
|
32718
|
+
}
|
|
32719
|
+
}
|
|
32720
|
+
}, null, null, null, "seconds");
|
|
32721
|
+
}
|
|
32722
|
+
|
|
32723
|
+
function scrollDown(target, dropScrollSpeed) {
|
|
32724
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
32725
|
+
target.scrollInt = zim.interval(.01, function() {
|
|
32726
|
+
if (target.dropReticle.parent) target.dropReticle.removeFrom();
|
|
32727
|
+
if (target.vertical) {
|
|
32728
|
+
target.scrollY -= dropScrollSpeed;
|
|
32729
|
+
if (target.scrollY < -target.scrollYMax) {
|
|
32730
|
+
target.scrollY = -target.scrollYMax;
|
|
32731
|
+
target.scrollInt.clear();
|
|
32732
|
+
}
|
|
32733
|
+
} else {
|
|
32734
|
+
target.scrollX -= dropScrollSpeed;
|
|
32735
|
+
if (target.scrollX < -target.scrollXMax) {
|
|
32736
|
+
target.scrollX = -target.scrollXMax;
|
|
32737
|
+
target.scrollInt.clear();
|
|
32738
|
+
}
|
|
32739
|
+
}
|
|
32740
|
+
}, null, null, null, "seconds");
|
|
32741
|
+
}
|
|
32742
|
+
|
|
32743
|
+
that.dropMove = that.on("pressmove", function() {
|
|
32744
|
+
if (ghost || !downPoint) return;
|
|
32745
|
+
var point = that.localToGlobal(downPoint.x, downPoint.y);
|
|
32746
|
+
if (
|
|
32747
|
+
((
|
|
32748
|
+
// mouse is mostly not in direction of travel
|
|
32749
|
+
(that.vertical && Math.abs(point.x-frame.mouseX) > Math.abs(point.y-frame.mouseY)) ||
|
|
32750
|
+
(!that.vertical && Math.abs(point.x-frame.mouseX) < Math.abs(point.y-frame.mouseY))
|
|
32751
|
+
) && !that.hitTestPoint(frame.mouseX, frame.mouseY))
|
|
32752
|
+
|
|
32753
|
+
|| (that.vertical && !scrollBarV)
|
|
32754
|
+
|| (!that.vertical && !scrollBarH)
|
|
32755
|
+
) {
|
|
32756
|
+
that.cancelCurrentDrag();
|
|
32757
|
+
var sc = downItem.getConcatenatedDisplayProps().matrix.decompose().scaleX/F.stage.scaleX; // sigh
|
|
32758
|
+
ghost = downItem.clone().reg(itemPoint.x, itemPoint.y).sca(sc).alp(.5); //.sha("rgba(0,0,0,.3)",5,5,5);
|
|
32759
|
+
that.dropItem = ghost;
|
|
32760
|
+
that.dropIndex = itemIndex;
|
|
32761
|
+
that.dropStage = frame.stage.on("stagemousemove", function(){
|
|
32762
|
+
ghost.loc(frame.mouseX, frame.mouseY)
|
|
32763
|
+
|
|
32764
|
+
// scroll if ghost is at edges of scrollable list
|
|
32765
|
+
var onCheck = false;
|
|
32766
|
+
zim.loop(dropTargets, function(target) {
|
|
32767
|
+
if (target.type != "List") return;
|
|
32768
|
+
if (onCheck) {
|
|
32769
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
32770
|
+
target.dropReticle.removeFrom();
|
|
32771
|
+
target.dropReticleIndex = null;
|
|
32772
|
+
return; // next in loop
|
|
32773
|
+
}
|
|
32774
|
+
if (target.vertical) {
|
|
32775
|
+
if (ghost.x > target.zgb.x && ghost.x < target.zgb.x + target.zgb.width) {
|
|
32776
|
+
if (ghost.y < target.zgb.y) { // carefull - need to do these separately to turn off diamond
|
|
32777
|
+
if (ghost.y > target.zgbtarget.zgb.y - 50) scrollUp(target, dropScrollSpeed);
|
|
32778
|
+
else if (ghost.y > target.zgbtarget.zgb.y - 80) scrollUp(target, dropScrollSpeed*1.5);
|
|
32779
|
+
onCheck = true;
|
|
32780
|
+
} else if (ghost.y > target.zgbtarget.zgb.y + target.zgbtarget.zgb.height) {
|
|
32781
|
+
if (ghost.y < target.zgbtarget.zgb.y + target.zgbtarget.zgb.height + 50) scrollDown(target, dropScrollSpeed);
|
|
32782
|
+
else if (ghost.y < target.zgbtarget.zgb.y + target.zgbtarget.zgb.height + 80) scrollDown(target, dropScrollSpeed*1.5);
|
|
32783
|
+
onCheck = true;
|
|
32784
|
+
} else if (target.scrollInt) target.scrollInt.clear();
|
|
32785
|
+
} else {
|
|
32786
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
32787
|
+
}
|
|
32788
|
+
} else {
|
|
32789
|
+
if (ghost.y > target.zgb.y && ghost.y < target.zgb.y + target.zgb.height) {
|
|
32790
|
+
if (ghost.x < target.zgb.x) {
|
|
32791
|
+
if (ghost.x > target.zgb.x - 50) scrollUp(target, dropScrollSpeed);
|
|
32792
|
+
else if (ghost.x > target.zgb.x - 80) scrollUp(target, dropScrollSpeed*1.5);
|
|
32793
|
+
onCheck = true;
|
|
32794
|
+
} else if (ghost.x > target.zgb.x + target.zgb.width) {
|
|
32795
|
+
if (ghost.x < target.zgb.x + target.zgb.width + 50) scrollDown(target, dropScrollSpeed);
|
|
32796
|
+
else if (ghost.x < target.zgb.x + target.zgb.width + 80) scrollDown(target, dropScrollSpeed*1.5);
|
|
32797
|
+
onCheck = true;
|
|
32798
|
+
} else if (target.scrollInt) target.scrollInt.clear();
|
|
32799
|
+
} else {
|
|
32800
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
32801
|
+
}
|
|
32802
|
+
}
|
|
32803
|
+
|
|
32804
|
+
// place reticle
|
|
32805
|
+
if (target.hitTestReg(ghost)) {
|
|
32806
|
+
onCheck = true;
|
|
32807
|
+
var point = target.tabs.globalToLocal(ghost.x, ghost.y);
|
|
32808
|
+
var item = target.tabs.getObjectUnderPoint(point.x, point.y, 1);
|
|
32809
|
+
var yy;
|
|
32810
|
+
var xx;
|
|
32811
|
+
var bounds;
|
|
32812
|
+
if (item) {
|
|
32813
|
+
checkItem = item;
|
|
32814
|
+
var good = target.items.includes(checkItem);
|
|
32815
|
+
if (zot(item.znum)) {
|
|
32816
|
+
while(checkItem.parent) {
|
|
32817
|
+
if (target.items.includes(checkItem.parent)) {
|
|
32818
|
+
good = true;
|
|
32819
|
+
item = checkItem.parent;
|
|
32820
|
+
break;
|
|
32821
|
+
}
|
|
32822
|
+
checkItem = checkItem.parent;
|
|
32823
|
+
}
|
|
32824
|
+
}
|
|
32825
|
+
if (!good) return;
|
|
32826
|
+
bounds = item.boundsToGlobal();
|
|
32827
|
+
|
|
32828
|
+
// target.dropReticle.visible = true;
|
|
32829
|
+
// if (checkItem == downItem) target.dropReticle.visible = false;
|
|
32830
|
+
|
|
32831
|
+
if (target.vertical) {
|
|
32832
|
+
if (ghost.y > bounds.y + bounds.height/2) {
|
|
32833
|
+
yy = bounds.y + bounds.height + target.spacing*target.zgs/2;
|
|
32834
|
+
if (yy > target.zgb.y && yy < target.zgb.y + target.zgb.height) {
|
|
32835
|
+
target.dropReticle.loc(bounds.x + bounds.width/2, yy);
|
|
32836
|
+
target.dropReticleIndex = item.znum + 1;
|
|
32837
|
+
}
|
|
32838
|
+
} else {
|
|
32839
|
+
yy = bounds.y - target.spacing*target.zgs/2;
|
|
32840
|
+
if (yy > target.zgb.y && yy < target.zgb.y + target.zgb.height) {
|
|
32841
|
+
target.dropReticle.loc(bounds.x + bounds.width/2, yy);
|
|
32842
|
+
target.dropReticleIndex = item.znum;
|
|
32843
|
+
}
|
|
32844
|
+
}
|
|
32845
|
+
} else {
|
|
32846
|
+
if (ghost.x > bounds.x + bounds.width/2) {
|
|
32847
|
+
xx = bounds.x + bounds.width + target.spacing*target.zgs/2;
|
|
32848
|
+
if (xx > target.zgb.x && xx < target.zgb.x + target.zgb.width) {
|
|
32849
|
+
target.dropReticle.loc(xx, bounds.y + bounds.height/2);
|
|
32850
|
+
target.dropReticleIndex = item.znum + 1;
|
|
32851
|
+
}
|
|
32852
|
+
} else {
|
|
32853
|
+
xx = bounds.x - target.spacing*target.zgs/2;
|
|
32854
|
+
if (xx > target.zgb.x && xx < target.zgb.x + target.zgb.width) {
|
|
32855
|
+
target.dropReticle.loc(xx, bounds.y + bounds.height/2);
|
|
32856
|
+
target.dropReticleIndex = item.znum;
|
|
32857
|
+
}
|
|
32858
|
+
}
|
|
32859
|
+
}
|
|
32860
|
+
} else {
|
|
32861
|
+
if (target.items.length > 0) {
|
|
32862
|
+
bounds = target.items[target.items.length-1].boundsToGlobal();
|
|
32863
|
+
if (target.vertical) {
|
|
32864
|
+
if (ghost.y > bounds.y + bounds.height) {
|
|
32865
|
+
yy = bounds.y + bounds.height + target.spacing*target.zgs/2;
|
|
32866
|
+
target.dropReticle.loc(target.zgb.x + target.zgb.width/2, yy);
|
|
32867
|
+
target.dropReticleIndex = target.items.length;
|
|
32868
|
+
} else {
|
|
32869
|
+
target.dropReticle.removeFrom();
|
|
32870
|
+
target.dropReticleIndex = null;
|
|
32871
|
+
}
|
|
32872
|
+
} else {
|
|
32873
|
+
if (ghost.x > bounds.x + bounds.width) {
|
|
32874
|
+
xx = bounds.x + bounds.width + target.spacing*target.zgs/2;
|
|
32875
|
+
target.dropReticle.loc(xx, target.zgb.y + target.zgb.height/2);
|
|
32876
|
+
target.dropReticleIndex = target.items.length;
|
|
32877
|
+
} else {
|
|
32878
|
+
target.dropReticle.removeFrom();
|
|
32879
|
+
target.dropReticleIndex = null;
|
|
32880
|
+
}
|
|
32881
|
+
}
|
|
32882
|
+
} else {
|
|
32883
|
+
if (target.vertical) {
|
|
32884
|
+
yy = target.zgb.y + target.spacing*target.zgs/2;
|
|
32885
|
+
target.dropReticle.loc(target.zgb.x + target.zgb.width/2, yy);
|
|
32886
|
+
target.dropReticleIndex = 0;
|
|
32887
|
+
} else {
|
|
32888
|
+
xx = target.zgb.x + target.spacing*target.zgs/2;
|
|
32889
|
+
target.dropReticle.loc(xx, target.zgb.y + target.zgb.height/2);
|
|
32890
|
+
target.dropReticleIndex = 0;
|
|
32891
|
+
}
|
|
32892
|
+
}
|
|
32893
|
+
}
|
|
32894
|
+
} else {
|
|
32895
|
+
target.dropReticle.removeFrom();
|
|
32896
|
+
target.dropReticleIndex = null;
|
|
32897
|
+
}
|
|
32898
|
+
});
|
|
32899
|
+
});
|
|
32900
|
+
|
|
32901
|
+
that.dispatchEvent("dropdown");
|
|
32902
|
+
|
|
32903
|
+
frame.stage.on("stagemouseup", function(){
|
|
32904
|
+
frame.stage.off("stagemousemove", that.dropStage);
|
|
32905
|
+
|
|
32906
|
+
var empty = zim.loop(dropTargets, function(target) {
|
|
32907
|
+
if (target.type != "List") return;
|
|
32908
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
32909
|
+
if (!zot(target.dropReticleIndex)) {
|
|
32910
|
+
target.dropReticle.removeFrom();
|
|
32911
|
+
that.removeAt(1,itemIndex);
|
|
32912
|
+
|
|
32913
|
+
if (itemIndex < target.dropReticleIndex && that == target) target.dropReticleIndex--;
|
|
32914
|
+
target.addAt(downItem, target.dropReticleIndex);
|
|
32915
|
+
|
|
32916
|
+
ghost.dispose();
|
|
32917
|
+
downItem.alpha = itemAlpha;
|
|
32918
|
+
ghost = null;
|
|
32919
|
+
downPoint = null;
|
|
32920
|
+
|
|
32921
|
+
that.dropItem = downItem;
|
|
32922
|
+
that.dropList = target;
|
|
32923
|
+
that.dropNewIndex = target.dropReticleIndex;
|
|
32924
|
+
target.dropReticleIndex = null;
|
|
32925
|
+
|
|
32926
|
+
return false;
|
|
32927
|
+
}
|
|
32928
|
+
});
|
|
32929
|
+
|
|
32930
|
+
if (empty) {
|
|
32931
|
+
var point = downItem.localToGlobal(itemPoint.x, itemPoint.y);
|
|
32932
|
+
ghost.animate({x:point.x, y:point.y}, .1, null, function() {
|
|
32933
|
+
ghost.dispose();
|
|
32934
|
+
downItem.alpha = itemAlpha;
|
|
32935
|
+
ghost = null;
|
|
32936
|
+
downPoint = null;
|
|
32937
|
+
})
|
|
32938
|
+
that.dropItem = downItem;
|
|
32939
|
+
that.dropList = that;
|
|
32940
|
+
that.dropNewIndex = that.dropIndex;
|
|
32941
|
+
}
|
|
32942
|
+
|
|
32943
|
+
that.dispatchEvent("dropup");
|
|
32944
|
+
|
|
32945
|
+
}, null, true); // once
|
|
32946
|
+
downItem.alp(.5);
|
|
32947
|
+
}
|
|
32948
|
+
});
|
|
32949
|
+
}
|
|
32950
|
+
|
|
32951
|
+
function disposeDrop() {
|
|
32952
|
+
if (that.dropDown) that.off("mousedown", that.dropDown);
|
|
32953
|
+
if (that.dropMove) that.off("pressmove", that.dropMove);
|
|
32954
|
+
if (that.dropStage) frame.stage.off("stagemousemove", that.dropStage);
|
|
32955
|
+
zim.loop(dropTargets, function(target) {
|
|
32956
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
32957
|
+
});
|
|
32958
|
+
dropTargets = [];
|
|
32959
|
+
dropCheck = false;
|
|
32960
|
+
}
|
|
32961
|
+
|
|
32962
|
+
Object.defineProperty(that, 'drop', {
|
|
32963
|
+
get: function() {
|
|
32964
|
+
return drop;
|
|
32965
|
+
},
|
|
32966
|
+
set: function(value) {
|
|
32967
|
+
drop = value;
|
|
32968
|
+
if (value) {
|
|
32969
|
+
makeDrop(); // if already made, it will just return
|
|
32970
|
+
// if not in dropTarget, add it
|
|
32971
|
+
if (!dropTargets.includes(that)) dropTargets.unshift(that);
|
|
32972
|
+
} else {
|
|
32973
|
+
// if in dropTarget, remove it
|
|
32974
|
+
if (dropTargets) {
|
|
32975
|
+
var ii = dropTargets.indexOf(that);
|
|
32976
|
+
if (ii >= 0) dropTargets.splice(ii, 1);
|
|
32977
|
+
if (dropTargets.length == 0) disposeDrop();
|
|
32978
|
+
}
|
|
32979
|
+
}
|
|
32980
|
+
}
|
|
32981
|
+
});
|
|
32982
|
+
|
|
32983
|
+
that.updateDrop = function() {
|
|
32984
|
+
zim.loop(dropTargets, function(target) {
|
|
32985
|
+
target.zgb = target.boundsToGlobal();
|
|
32986
|
+
target.zgs = target.getConcatenatedDisplayProps().matrix.decompose().scaleX/frame.stage.scaleX;
|
|
32987
|
+
});
|
|
32988
|
+
}
|
|
32989
|
+
|
|
32990
|
+
Object.defineProperty(that, 'dropTargets', {
|
|
32991
|
+
get: function() {
|
|
32992
|
+
return dropTargets;
|
|
32993
|
+
},
|
|
32994
|
+
set: function(value) {
|
|
32995
|
+
dropTargets = value;
|
|
32996
|
+
var already = false
|
|
32997
|
+
// makeDrop will handle things
|
|
32998
|
+
already = makeDrop(); // if already made, it will just return true
|
|
32999
|
+
if (already) { // then need to handle new list
|
|
33000
|
+
if (value && !Array.isArray(dropTargets)) dropTargets = [dropTargets];
|
|
33001
|
+
if (!dropTargets) dropTargets = [];
|
|
33002
|
+
if (drop && !dropTargets.includes(that)) dropTargets.unshift(that);
|
|
33003
|
+
zim.loop(dropTargets, function(target) {
|
|
33004
|
+
if (target.dropReticle) target.dropReticle.dispose();
|
|
33005
|
+
target.dropReticle = new zim.Rectangle(20,20,clear,dropColor,dropThickness).reg(CENTER).rot(45).alp(dropReticleAlpha);
|
|
33006
|
+
target.zgb = target.boundsToGlobal();
|
|
33007
|
+
target.zgs = target.getConcatenatedDisplayProps().matrix.decompose().scaleX/zdf.stage.scaleX;
|
|
33008
|
+
target.dropReticleIndex = null;
|
|
33009
|
+
});
|
|
33010
|
+
if (dropTargets.length == 0) disposeDrop();
|
|
33011
|
+
}
|
|
33012
|
+
}
|
|
33013
|
+
});
|
|
33014
|
+
|
|
33015
|
+
Object.defineProperty(that, 'dropColor', {
|
|
33016
|
+
get: function() {
|
|
33017
|
+
return dropColor;
|
|
33018
|
+
},
|
|
33019
|
+
set: function(value) {
|
|
33020
|
+
dropColor = value;
|
|
33021
|
+
zim.loop(dropTargets, function(target) {
|
|
33022
|
+
if (target.dropReticle) target.dropReticle.borderColor = value;
|
|
33023
|
+
});
|
|
33024
|
+
}
|
|
33025
|
+
});
|
|
33026
|
+
|
|
33027
|
+
// END DROP - Also see gets setter methods lower below
|
|
33028
|
+
|
|
33029
|
+
|
|
32519
33030
|
|
|
32520
33031
|
Object.defineProperty(that, 'items', {
|
|
32521
33032
|
get: function() {
|
|
@@ -32797,7 +33308,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32797
33308
|
|
|
32798
33309
|
if (style!==false) zim.styleTransforms(this, DS);
|
|
32799
33310
|
this.clone = function() {
|
|
32800
|
-
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, selectedIndex, style, this.group, inherit));
|
|
33311
|
+
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, dropColor, dropThickness, dropScrollSpeed, dropReticleAlpha, selectedIndex, style, this.group, inherit));
|
|
32801
33312
|
};
|
|
32802
33313
|
this.dispose = function(a,b,disposing) {
|
|
32803
33314
|
if (!disposing) {
|
|
@@ -36429,6 +36940,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36429
36940
|
|
|
36430
36941
|
// finalize index, location, bounds
|
|
36431
36942
|
function prepareAllButtons() {
|
|
36943
|
+
|
|
36432
36944
|
var lastX = 0; var lastY = 0; var button;
|
|
36433
36945
|
for (i=0; i<buttons.length; i++) {
|
|
36434
36946
|
button = buttons[i];
|
|
@@ -36459,7 +36971,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36459
36971
|
else if (valign=="bottom") button.y = height-button.height-(button.type=="TabsButton" && !mix?0:indent);
|
|
36460
36972
|
}
|
|
36461
36973
|
if (i==myIndex && !currentEnabled) button.enabled = false;
|
|
36462
|
-
else button.enabled = true;
|
|
36974
|
+
else button.enabled = true;
|
|
36975
|
+
button.visible = true; // need to override optimize
|
|
36463
36976
|
}
|
|
36464
36977
|
|
|
36465
36978
|
// might have to use w and h rather than width and height if run multiple times...
|
|
@@ -36556,6 +37069,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36556
37069
|
};
|
|
36557
37070
|
|
|
36558
37071
|
this.removeAt = function(num, index) {
|
|
37072
|
+
|
|
36559
37073
|
if (buttons.length == 0) return that;
|
|
36560
37074
|
if (zot(num)) num = 1;
|
|
36561
37075
|
if (zot(index)) index = buttons.length-num;
|
|
@@ -36563,7 +37077,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36563
37077
|
|
|
36564
37078
|
// adjust selection
|
|
36565
37079
|
if (myIndex >= index && myIndex <= index+num) myIndex = -1;
|
|
36566
|
-
if (myIndex > index+num) myIndex -= num;
|
|
37080
|
+
if (myIndex > index+num) myIndex -= num;
|
|
36567
37081
|
|
|
36568
37082
|
// remove listeners
|
|
36569
37083
|
for (i=index; i<index+num; i++) {
|
|
@@ -36575,6 +37089,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36575
37089
|
else buttons[i].off((!zns?WW.ACTIONEVENT=="mousedown":zim.ACTIONEVENT=="mousedown")?"mousedown":"click", buttons[i].zimTabEvent);
|
|
36576
37090
|
buttons[i].removeFrom();
|
|
36577
37091
|
}
|
|
37092
|
+
|
|
37093
|
+
|
|
36578
37094
|
// splice from buttons and labels from labels
|
|
36579
37095
|
buttons.splice(index, num);
|
|
36580
37096
|
labels.splice(index, num);
|
|
@@ -48983,6 +49499,7 @@ RETURNS obj for chaining
|
|
|
48983
49499
|
}
|
|
48984
49500
|
return {x:x,y:y};
|
|
48985
49501
|
}
|
|
49502
|
+
obj.zimCheckBounds = checkBounds;
|
|
48986
49503
|
|
|
48987
49504
|
function testMove(o,x,y,desiredX,desiredY) {
|
|
48988
49505
|
if (Math.abs(o.x-lastX) < .1 && Math.abs(o.y-lastY) < .1) {
|
|
@@ -49125,13 +49642,15 @@ END EXAMPLE
|
|
|
49125
49642
|
|
|
49126
49643
|
PARAMETERS
|
|
49127
49644
|
recursive (default true) - turns off drags on children
|
|
49645
|
+
snapBack (default true) - if outside of bounds will animate back to inside bounds
|
|
49128
49646
|
|
|
49129
49647
|
RETURNS obj for chaining
|
|
49130
49648
|
--*///+32
|
|
49131
|
-
zim.noDrag = function(obj, recursive) {
|
|
49649
|
+
zim.noDrag = function(obj, recursive, snapBack) {
|
|
49132
49650
|
z_d("32");
|
|
49133
49651
|
if (zot(obj) || !obj.on) return;
|
|
49134
49652
|
if (zot(recursive)) recursive = true;
|
|
49653
|
+
if (zot(snapBack)) snapBack = true;
|
|
49135
49654
|
if (recursive && obj.numChildren && obj.numChildren > 1) {
|
|
49136
49655
|
for (var i=0; i<obj.numChildren; i++) {
|
|
49137
49656
|
var o = obj.getChildAt(i);
|
|
@@ -49152,9 +49671,15 @@ RETURNS obj for chaining
|
|
|
49152
49671
|
if (obj.stage) obj.stage.frame.off("mouseupplus", obj.zmu);
|
|
49153
49672
|
else WW.zdf.off("mouseupplus", obj.zmu);
|
|
49154
49673
|
}
|
|
49155
|
-
if (zim.Ticker) {
|
|
49156
|
-
if (obj.zimDragSlide) zim.Ticker.remove(obj.zimDragSlide);
|
|
49157
|
-
if (obj.zimDragTicker)
|
|
49674
|
+
if (zim.Ticker) {
|
|
49675
|
+
if (obj.zimDragSlide) zim.Ticker.remove(obj.zimDragSlide);
|
|
49676
|
+
if (obj.zimDragTicker) {
|
|
49677
|
+
zim.Ticker.remove(obj.zimDragTicker);
|
|
49678
|
+
if (snapBack) {
|
|
49679
|
+
var f = obj.zimCheckBounds(obj, obj.x, obj.y);
|
|
49680
|
+
obj.animate({x:f.x, y:f.y}, .3);
|
|
49681
|
+
}
|
|
49682
|
+
}
|
|
49158
49683
|
}
|
|
49159
49684
|
obj.zimDragMoving=obj.zimAdded=obj.zimRemoved=obj.zimDown=obj.zimMove=obj.zimUp=obj.zimBoundary=obj.zimDragSlide=null;
|
|
49160
49685
|
obj.slideStartX = obj.slideStartY = obj.zimDragImmediate = null;
|
|
@@ -51843,7 +52368,8 @@ addPhysics
|
|
|
51843
52368
|
zim DisplayObject method
|
|
51844
52369
|
|
|
51845
52370
|
DESCRIPTION
|
|
51846
|
-
Add Physics to a DisplayObject. DisplayObject should
|
|
52371
|
+
Add Physics to a DisplayObject. DisplayObject should have its registration point centered reg(CENTER) or centerReg()
|
|
52372
|
+
and be on the stage (or in non-transformed Container at 0,0 on stage)
|
|
51847
52373
|
The Physics world can be set up with the ZIM Physics() class in the Controls module.
|
|
51848
52374
|
Box2D and ZIM physics JavaScript helper module need to be imported.
|
|
51849
52375
|
If no physics world has been created, the addPhysics() method will create a default world.
|
|
@@ -52680,7 +53206,7 @@ var circle = new Circle(50, red)
|
|
|
52680
53206
|
from:true
|
|
52681
53207
|
});
|
|
52682
53208
|
// toggle pause the circle when stage is pressed
|
|
52683
|
-
S.on("stagemousedown",
|
|
53209
|
+
S.on("stagemousedown", ()=>{
|
|
52684
53210
|
circle.pauseAnimate(!circle.paused);
|
|
52685
53211
|
});
|
|
52686
53212
|
END EXAMPLE
|
|
@@ -52734,7 +53260,6 @@ const rect = new Rectangle({color:pink})
|
|
|
52734
53260
|
.sca(0); // hiding it to start
|
|
52735
53261
|
|
|
52736
53262
|
const circle = new Circle({color:purple}) // chaining the rest
|
|
52737
|
-
.addTo(stage)
|
|
52738
53263
|
.pos(400,300)
|
|
52739
53264
|
.animate({ // circle will be the default object for the inner animations
|
|
52740
53265
|
props:[
|
|
@@ -52755,7 +53280,7 @@ const circle = new Circle({color:purple}) // chaining the rest
|
|
|
52755
53280
|
});
|
|
52756
53281
|
|
|
52757
53282
|
var paused = false;
|
|
52758
|
-
S.on("stagemousedown", ()
|
|
53283
|
+
S.on("stagemousedown", ()=>{
|
|
52759
53284
|
paused = !paused;
|
|
52760
53285
|
pauseAnimate(paused, "square");
|
|
52761
53286
|
});
|
|
@@ -52763,7 +53288,7 @@ END EXAMPLE
|
|
|
52763
53288
|
|
|
52764
53289
|
EXAMPLE
|
|
52765
53290
|
// sequence example to pulse two circles
|
|
52766
|
-
const circles = new Container(W, H).addTo(
|
|
53291
|
+
const circles = new Container(W, H).addTo();
|
|
52767
53292
|
const circle1 = new Circle(50, red).center(circles);
|
|
52768
53293
|
const circle2 = new Circle(50, blue).center(circles).mov(70);
|
|
52769
53294
|
circles.animate({
|
|
@@ -52940,6 +53465,7 @@ props - the object literal holding properties and values to animate
|
|
|
52940
53465
|
time - |ZIM VEE| (default 1) the time for the tween in seconds (also see ZIM TIME constant)
|
|
52941
53466
|
see also the rate parameter and property to dynamically change the time the animation takes (its speed)
|
|
52942
53467
|
ease - |ZIM VEE| (default "quadInOut") the equation type for easing ("bounceOut", "elasticIn", "backInOut", "linear", etc)
|
|
53468
|
+
no ease is "linear" or "none"- this is often good for constantly falling or rotating objects
|
|
52943
53469
|
also ZIM preset eases: "snapIn", "snapOut", "snapInOut", "ballisticIn", "ballisticOut", "ballisticInOut", "slowmoIn", "slowmoOut", "slowmoInOut"
|
|
52944
53470
|
** CUSTOM EASE: see https://zimjs.com/ease for custom ease which can be passed in here as a value like so:
|
|
52945
53471
|
ease:zimEase([.2,.4,.6,.8]) // would be linear
|
|
@@ -53082,7 +53608,7 @@ easeAmount - |ZIM VEE| (default null) set to change the tween effect
|
|
|
53082
53608
|
quint (default 5) - exponent
|
|
53083
53609
|
back (default 1.7) - strength
|
|
53084
53610
|
elastic (default 1) - amplitude - also see easeFrequency
|
|
53085
|
-
linear, bounce, circ, sin - no affect
|
|
53611
|
+
linear/none, bounce, circ, sin - no affect
|
|
53086
53612
|
Note: used mostly with back and elastic (backIn, backOut, backInOut, etc.)
|
|
53087
53613
|
as setting the tween to quadInOut and then easeAmount to 5
|
|
53088
53614
|
would be the same as a quintInOut.
|
|
@@ -53236,6 +53762,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
|
|
|
53236
53762
|
if (zikTypes.indexOf(prop) >= 0) cjsProps[prop] = zim.Pick.choose(cjsProps[prop]);
|
|
53237
53763
|
}
|
|
53238
53764
|
}
|
|
53765
|
+
if (ease == "none") ease = "linear";
|
|
53239
53766
|
|
|
53240
53767
|
// CJSPROPS
|
|
53241
53768
|
// convert loop and rewind properties into the legacy cjs props object
|
|
@@ -56427,7 +56954,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
|
|
|
56427
56954
|
}
|
|
56428
56955
|
length = type=="number"?obj:obj.length;
|
|
56429
56956
|
total = getTotal(length-1);
|
|
56430
|
-
if (total == 0) return;
|
|
56957
|
+
if (total == 0) return true;
|
|
56431
56958
|
if (reverse) {
|
|
56432
56959
|
if (interval === 0) {
|
|
56433
56960
|
for(i=start; i>=end; i-=step) {
|
|
@@ -56513,7 +57040,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
|
|
|
56513
57040
|
props.push(i);
|
|
56514
57041
|
}
|
|
56515
57042
|
total = getTotal(length-1);
|
|
56516
|
-
if (total == 0) return;
|
|
57043
|
+
if (total == 0) return true;
|
|
56517
57044
|
if (reverse) {
|
|
56518
57045
|
if (interval === 0) {
|
|
56519
57046
|
for(i=start; i>=end; i-=step) {
|
|
@@ -56842,7 +57369,7 @@ zim DisplayObject method
|
|
|
56842
57369
|
DESCRIPTION
|
|
56843
57370
|
Returns a createjs Rectangle of the bounds of object projected onto the stage.
|
|
56844
57371
|
Handles scaling and rotation.
|
|
56845
|
-
If a
|
|
57372
|
+
If a ZIM Boundary object (or CreateJS Rectangle) is passed in then it converts this rectangle
|
|
56846
57373
|
from within the frame of the obj to a global rectangle.
|
|
56847
57374
|
If flip (default false) is set to true it goes from global to local rect.
|
|
56848
57375
|
Used by drag() and hitTestBounds() above - probably you will not use this directly.
|
|
@@ -56852,7 +57379,7 @@ zog(circle.boundsToGlobal().x); // global x of circle
|
|
|
56852
57379
|
END EXAMPLE
|
|
56853
57380
|
|
|
56854
57381
|
PARAMETERS
|
|
56855
|
-
rect - (default null) a
|
|
57382
|
+
rect - (default null) a ZIM Boundary() object or CreateJS Rectangle inside an object which you would like mapped to global
|
|
56856
57383
|
flip - (default false) make a global rect ported to local values
|
|
56857
57384
|
inside - (default false) [NOT WORKING YET] make a rectangle from smallest projection rather than largest
|
|
56858
57385
|
globalObj - (default stage) project rectangle into a Container other than the stage
|
|
@@ -73314,7 +73841,10 @@ ALSO See the CreateJS Easel Docs for Filter methods, such as: getBounds()
|
|
|
73314
73841
|
|
|
73315
73842
|
this.alphaMask = mask;
|
|
73316
73843
|
var that = this;
|
|
73317
|
-
if (dynamic)
|
|
73844
|
+
if (dynamic) {
|
|
73845
|
+
if (!that.alphaMask.cacheCanvas) that.alphaMask.cache();
|
|
73846
|
+
this.ticker = zim.Ticker.add(function(){that.alphaMask.updateCache()});
|
|
73847
|
+
}
|
|
73318
73848
|
|
|
73319
73849
|
// VEE
|
|
73320
73850
|
var oa = remember(mask);
|
|
@@ -73835,7 +74365,7 @@ paused - read-only boolean whether the parallax is paused - see pause() and star
|
|
|
73835
74365
|
var factor = (zot(layer.factor)) ? 1 : layer.factor;
|
|
73836
74366
|
var integer = (zot(layer.integer)) ? false : layer.integer;
|
|
73837
74367
|
|
|
73838
|
-
// baseMin, baseMax, targetMin, targetMax, damp, factor, targetRound, clamp
|
|
74368
|
+
// baseMin, baseMax, targetMin, targetMax, damp, factor, targetRound, clamp, clampMin, clampMax
|
|
73839
74369
|
obj["p_"+obj.prop] = new zim.ProportionDamp(inMin, inMax, 0, obj[obj.prop], _damp, factor, integer, clamp);
|
|
73840
74370
|
if (obj.prop == "scale") {
|
|
73841
74371
|
obj["s_"+obj.prop] = obj.obj.scaleX; // helper to allow scale to be property
|
|
@@ -82373,7 +82903,6 @@ zil - reference to zil events that stop canvas from shifting or scrolling - also
|
|
|
82373
82903
|
can set allowDefault property to false then allow specific defaults by removing zil events - see zil global function
|
|
82374
82904
|
example: window.removeEventListener("keydown", F.zil[0]); removes keydown preventions (for page up, page down, home, end, etc)
|
|
82375
82905
|
allowDefault - set to true to remove zil or false to set zil (see above) also affects body overflow
|
|
82376
|
-
colors: orange, green, pink, blue, brown, yellow, red, purple, silver, tin, grey, lighter, moon, light, dark, darker, white, black, clear (0 alpha), faint (.01 alpha)
|
|
82377
82906
|
followBoundary - update with a ZIM Boundary for follow() if "full" mode Frame "resize" event happens, etc.
|
|
82378
82907
|
altKey - true if the alt key is being pressed otherwise false
|
|
82379
82908
|
ctrlKey - true if the ctrl key is being pressed otherwise false
|
|
@@ -83199,6 +83728,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
83199
83728
|
|
|
83200
83729
|
// ASSETS
|
|
83201
83730
|
this.loadAssets = function(assets, path, progress, xhr, time, loadTimeout, outputAudioSprite, crossOrigin, fileType, queueOnly, maxConnections, maxNum) {
|
|
83731
|
+
|
|
83202
83732
|
if (zot(assets)) return endEarly();
|
|
83203
83733
|
if (zot(assets.src)) { // might be sending single parameter of asset object or audiosprite
|
|
83204
83734
|
var sig = "assets, path, progress, xhr, time, loadTimeout, outputAudioSprite, crossOrigin, fileType, queueOnly, maxConnections, maxNum";
|
|
@@ -86525,9 +87055,9 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
86525
87055
|
zim.extend(zim.PermissionAsk, zim.Pane, null, "zimPane", false);//-83.01
|
|
86526
87056
|
|
|
86527
87057
|
/*--
|
|
86528
|
-
Colors - orange, green, pink, blue, brown, yellow, purple,
|
|
87058
|
+
Colors - red, salmon, orange, green, pink, blue, brown, yellow, purple, interstellar, black, darker, licorice, dark, charcoal, grey, gray, granite, tin, pewter, silver, fog, mist, light, moon, lighter, white, faint, clear
|
|
86529
87059
|
|
|
86530
|
-
Colors - orange, green, pink, blue, brown, yellow, purple,
|
|
87060
|
+
Colors - red, salmon, orange, green, pink, blue, brown, yellow, purple, interstellar, black, darker, licorice, dark, charcoal, grey, gray, granite, tin, pewter, silver, fog, mist, light, moon, lighter, wh¡te, faint, clear
|
|
86531
87061
|
zim constants (lowercase)
|
|
86532
87062
|
|
|
86533
87063
|
DESCRIPTION
|
|
@@ -86586,12 +87116,13 @@ new Circle(100, blue.darken(.5)).center();
|
|
|
86586
87116
|
new Circle(100, blue.toColor(red, .2)).center();
|
|
86587
87117
|
END EXAMPLE
|
|
86588
87118
|
--*///+83.55
|
|
86589
|
-
zim.colorsHex = ["#fb4758","#f58e25","#ebcb35","#acd241","#50c4b7","#993399","#e472c4","#d1a170","#112233","#000000","#111111","#222222","#333333","#444444","#555555","#555555","#666666","#777777","#888888","#999999","#aaaaaa","#bbbbbb","#cccccc","#dddddd","#eeeeee","#ffffff","rgba(0,0,0,.01)","rgba(0,0,0,0)"];
|
|
86590
|
-
zim.colors = ["red","orange","yellow","green","blue","purple","pink","brown","interstellar","black","darker","licorice","dark","charcoal","grey","gray","granite","tin","pewter","silver","fog","mist","light","moon","lighter","white","faint","clear"];
|
|
87119
|
+
zim.colorsHex = ["#fb4758","#fa8072","#f58e25","#ebcb35","#acd241","#50c4b7","#993399","#e472c4","#d1a170","#112233","#000000","#111111","#222222","#333333","#444444","#555555","#555555","#666666","#777777","#888888","#999999","#aaaaaa","#bbbbbb","#cccccc","#dddddd","#eeeeee","#ffffff","rgba(0,0,0,.01)","rgba(0,0,0,0)"];
|
|
87120
|
+
zim.colors = ["red","salmon","orange","yellow","green","blue","purple","pink","brown","interstellar","black","darker","licorice","dark","charcoal","grey","gray","granite","tin","pewter","silver","fog","mist","light","moon","lighter","white","faint","clear"];
|
|
86591
87121
|
for (z_i=0; z_i<zim.colors.length; z_i++) {
|
|
86592
87122
|
zim[zim.colors[z_i]] = zim.colorsHex[z_i];
|
|
86593
87123
|
}
|
|
86594
87124
|
// zim.red = "#fb4758"; // red dedicated to Alexa
|
|
87125
|
+
// zim.salmon = "#FFE5B4";
|
|
86595
87126
|
// zim.orange = "#f58e25";
|
|
86596
87127
|
// zim.yellow = "#ebcb35";
|
|
86597
87128
|
// zim.green = "#acd241";
|
|
@@ -89283,6 +89814,8 @@ riveevent - dispatched when a Rive Event gets reported
|
|
|
89283
89814
|
|
|
89284
89815
|
this.canvas = riveCanvas;
|
|
89285
89816
|
riveCanvas.style.visibility = "hidden";
|
|
89817
|
+
riveCanvas.style.position = "absolute";
|
|
89818
|
+
riveCanvas.style.top = "0px";
|
|
89286
89819
|
var riveObj = {canvas:riveCanvas, src:src, buffer:buffer, file:file, artboard:artboard, animations:animations, stateMachines:stateMachines, layout:layout, autoplay:autoplay, useOffscreenRenderer:useOffscreenRenderer, enableRiveAssetCDN:enableRiveAssetCDN, shouldDisableRiveListeners:shouldDisableRiveListeners, isTouchScrollEnabled:isTouchScrollEnabled, automaticallyHandleEvents:automaticallyHandleEvents, onLoad:null, onLoadError:onLoadError, onPlay:onPlay, onPause:onPause, onStop:onStop, onLoop:onLoop, onStateChange:onStateChange, onAdvance:onAdvance, assetLoader:assetLoader};
|
|
89287
89820
|
this.super_constructor(riveObj);
|
|
89288
89821
|
this.type = "Rive";
|
|
@@ -89414,6 +89947,8 @@ pointerup - dispatches a pointerup event when pointer is up
|
|
|
89414
89947
|
|
|
89415
89948
|
this.canvas = riveCanvas;
|
|
89416
89949
|
riveCanvas.style.visibility = "hidden";
|
|
89950
|
+
riveCanvas.style.position = "absolute";
|
|
89951
|
+
riveCanvas.style.top = "0px";
|
|
89417
89952
|
this.type = "RiveListener";
|
|
89418
89953
|
|
|
89419
89954
|
|