zimjs 19.0.9 → 19.1.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 +198 -67
package/package.json
CHANGED
package/src/zim.js
CHANGED
|
@@ -75,7 +75,6 @@ var z_i; // iterator i in global namespace
|
|
|
75
75
|
//////////////// ZIM WRAP //////////////
|
|
76
76
|
// Zim Wrap creates global wrapper functions for less typing
|
|
77
77
|
|
|
78
|
-
|
|
79
78
|
/*--
|
|
80
79
|
zog(item1, item2, etc.) ~ log
|
|
81
80
|
|
|
@@ -12155,7 +12154,6 @@ group - (default null) set to String (or comma delimited String) so STYLE can se
|
|
|
12155
12154
|
inherit - (default null) used internally but can receive an {} of styles directly
|
|
12156
12155
|
|
|
12157
12156
|
METHODS
|
|
12158
|
-
run(time, label, call, params, wait, waitedCall, waitedParams, loop, loopCount, loopWait, loopCall, loopParams, loopWaitCall, loopWaitParams, loopPick, rewind, rewindWait, rewindCall, rewindParams, rewindWaitCall, rewindWaitParams, rewindTime, rewindEase, startFrame, endFrame, frame, tweek, id, globalControl)
|
|
12159
12157
|
The run() method animates the Sprite over an amount of time
|
|
12160
12158
|
Would recommend this method over the CreateJS play() and gotoAndPlay()
|
|
12161
12159
|
methods because the framerate for these get overwritten by other S.update() calls
|
|
@@ -14944,11 +14942,12 @@ EXAMPLE
|
|
|
14944
14942
|
new Frame(FILL, 1024, 768, clear, clear, ready);
|
|
14945
14943
|
function ready() {
|
|
14946
14944
|
const fragment = `
|
|
14945
|
+
out vec4 fragColor;
|
|
14947
14946
|
void main() {
|
|
14948
14947
|
vec2 uv = gl_FragCoord.xy / iResolution.xy;
|
|
14949
14948
|
vec3 color = 0.5 + 0.5 * cos(iTime + uv.xyx + vec3(0,2,4));
|
|
14950
|
-
|
|
14951
|
-
}
|
|
14949
|
+
fragColor = vec4(vec3(color), 1.0);
|
|
14950
|
+
}
|
|
14952
14951
|
`;
|
|
14953
14952
|
const shader = new zim.ShaderOverlay(W, H, fragment).center();
|
|
14954
14953
|
shader.tag.style.zIndex = -50; // put shader beneath stage
|
|
@@ -24686,7 +24685,8 @@ zim.LabelOnArc = function(label, size, font, color, radius, flip, spacing, lette
|
|
|
24686
24685
|
var rev = label.text.split("").reverse().join("");
|
|
24687
24686
|
label.text = rev;
|
|
24688
24687
|
}
|
|
24689
|
-
|
|
24688
|
+
zog(that.width, that.height)
|
|
24689
|
+
letters = that.letters = new zim.Container(100,100).center(that);
|
|
24690
24690
|
|
|
24691
24691
|
that.numLetters = label.text.length;
|
|
24692
24692
|
that.letterHeight = label.height;
|
|
@@ -24756,7 +24756,8 @@ zim.LabelOnArc = function(label, size, font, color, radius, flip, spacing, lette
|
|
|
24756
24756
|
var letter = letters.getChildAt(i);
|
|
24757
24757
|
// var amount = angles[i];
|
|
24758
24758
|
lastAngle = letter.rotation = lastAngle + angles[i];
|
|
24759
|
-
}
|
|
24759
|
+
}
|
|
24760
|
+
letters.setBounds(null);
|
|
24760
24761
|
}
|
|
24761
24762
|
|
|
24762
24763
|
this.setProps = function(props) {
|
|
@@ -24799,6 +24800,9 @@ zim.LabelOnArc = function(label, size, font, color, radius, flip, spacing, lette
|
|
|
24799
24800
|
}
|
|
24800
24801
|
});
|
|
24801
24802
|
|
|
24803
|
+
// TODO - in ZIM 020 - add this line
|
|
24804
|
+
// that.setBounds(null);
|
|
24805
|
+
|
|
24802
24806
|
if (style!==false) zim.styleTransforms(this, DS);
|
|
24803
24807
|
this.clone = function() {
|
|
24804
24808
|
return that.cloneProps(new zim.LabelOnArc(label, size, font, color, radius, flip, spacing, letterSpacing, angles, showCircle, arcColor, arcBorderColor, arcBorderWidth, radiusSpread, rtl, style, this.group, inherit));
|
|
@@ -29216,10 +29220,9 @@ content - gives access to the content provided as a parameter to the Panel()
|
|
|
29216
29220
|
buttons - an array of the Button objects if provided
|
|
29217
29221
|
config - the original content config object {}
|
|
29218
29222
|
panelHeight - get and set the height of the panel without scaling it as height does (for width, remake the Panel object)
|
|
29219
|
-
titleBar - access to the titleBar container
|
|
29223
|
+
titleBar - access to the titleBar container - which also has a backing property
|
|
29220
29224
|
titleBarlabel - access to the label of the current panel
|
|
29221
29225
|
text - access to the text of the current panel
|
|
29222
|
-
titleBar - gives access to the titleBar Container - which also has a background property
|
|
29223
29226
|
titleBarLabel - gives access to the titleBar label
|
|
29224
29227
|
closeIcon - access to the close button
|
|
29225
29228
|
collapseIcon - access to the ZIM Shape if there is a collapse triangle
|
|
@@ -34109,9 +34112,11 @@ dropHeight - (default null) set a height when dropped - overrides scale
|
|
|
34109
34112
|
*** Drop parameters that work only when dropping on a dropTarget that is NOT a List
|
|
34110
34113
|
dropHitTest - (default "bounds") can also be "reg", "circles", "circle", "rect" - see ZIM HitTests
|
|
34111
34114
|
dropFull - (default true) do not drop on a full target
|
|
34112
|
-
|
|
34115
|
+
note - if the object is removed from the target then a drop can occur again on that target
|
|
34116
|
+
also see the dropFull property on a target
|
|
34113
34117
|
dropSnap - (default true) snap to the target object
|
|
34114
34118
|
dropEnd - (default true) once dropped on a target a noMouse() is set on the object
|
|
34119
|
+
dropEnd should not be false if dropBack is true - when dropping from a list
|
|
34115
34120
|
*** End drop parameters that work only when dropping on a target that is NOT a List
|
|
34116
34121
|
selectedIndex - same as index, kept in for backwards compatibility in ZIM DUO
|
|
34117
34122
|
style - (default true) set to false to ignore styles set with the STYLE - will receive original parameter defaults
|
|
@@ -34254,8 +34259,8 @@ enabled - default is true - set to false to disable
|
|
|
34254
34259
|
DROP ITEM PROPERTIES
|
|
34255
34260
|
dropTarget - is the target dropped on
|
|
34256
34261
|
dropList - is list item came from
|
|
34257
|
-
|
|
34258
|
-
|
|
34262
|
+
dropFull - the target that is dropped on gets a dropFull property
|
|
34263
|
+
set this to false if programatically removing a dropped object such as for a garbage can
|
|
34259
34264
|
|
|
34260
34265
|
ALSO: see all Window properties - like titleBar, titleBarLabel, resizeHandle, etc.
|
|
34261
34266
|
|
|
@@ -35183,6 +35188,21 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
35183
35188
|
ghost.dropStartY = downItem.dropStartY;
|
|
35184
35189
|
ghost.dropStartS = downItem.dropStartS;
|
|
35185
35190
|
|
|
35191
|
+
// ZIM 019 patch
|
|
35192
|
+
// pass through original x,y,scale for objects
|
|
35193
|
+
// that had them and were added to the list
|
|
35194
|
+
if (downItem.dropOriginalX != null) {
|
|
35195
|
+
ghost.dropOriginalX = downItem.dropOriginalX;
|
|
35196
|
+
ghost.dropOriginalY = downItem.dropOriginalY;
|
|
35197
|
+
ghost.dropOriginalS = downItem.dropOriginalS;
|
|
35198
|
+
ghost.dropStartX = ghost.x;
|
|
35199
|
+
ghost.dropStartY = ghost.y;
|
|
35200
|
+
ghost.dropStartS = ghost.scale;
|
|
35201
|
+
} else {
|
|
35202
|
+
// flag drag() to not add dropOriginalX, etc.
|
|
35203
|
+
ghost.dropOriginalList = true;
|
|
35204
|
+
}
|
|
35205
|
+
|
|
35186
35206
|
that.dropItem = ghost;
|
|
35187
35207
|
that.dropTarget = target;
|
|
35188
35208
|
ghost = null;
|
|
@@ -35198,7 +35218,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
35198
35218
|
target.dropReticle.removeFrom();
|
|
35199
35219
|
if (!dropCopy) that.removeAt(1,itemIndex);
|
|
35200
35220
|
|
|
35201
|
-
if (itemIndex < target.dropReticleIndex && that == target) target.dropReticleIndex--;
|
|
35221
|
+
if (itemIndex < target.dropReticleIndex && that == target && !dropCopy) target.dropReticleIndex--;
|
|
35202
35222
|
|
|
35203
35223
|
if (dropCopy) {
|
|
35204
35224
|
target.addAt(ghost, target.dropReticleIndex);
|
|
@@ -37016,6 +37036,7 @@ barLength - (default 300) the length of the bar (the slider slides along its len
|
|
|
37016
37036
|
barWidth - (default 3) the width of the bar (how fat the bar is)
|
|
37017
37037
|
barColor - (default granite) the color of the bar (any CSS color)
|
|
37018
37038
|
vertical - (default false) set to true to make slider vertical
|
|
37039
|
+
vertical will have a default value of max
|
|
37019
37040
|
useTicks - (default false) set to true to show small ticks for each step (step > 0)
|
|
37020
37041
|
tickColor - (default barColor) set the tick color if ticks are set
|
|
37021
37042
|
tickStep - (default step - or 1 if no step and useTicks is true) set to adjust tick amount
|
|
@@ -37043,7 +37064,7 @@ keyArrowsV - (default true) use up and down arrows when keyArrows is true
|
|
|
37043
37064
|
damp - (default null) set to value such as .1 to damp the slider value
|
|
37044
37065
|
use with Ticker rather than "change" event - eg:
|
|
37045
37066
|
Ticker.add(()=>{circle.x = slider.value;});
|
|
37046
|
-
value - |ZIM VEE| (default min) a starting value for the slider
|
|
37067
|
+
value - |ZIM VEE| (default min for horizontal or max for vertical) a starting value for the slider
|
|
37047
37068
|
expand - (default null or 10 for mobile) set to value to expand the interactive area of the slider button
|
|
37048
37069
|
expandVertical - (default expand) set to value to expand the vertical interactive area of the slider button
|
|
37049
37070
|
expandBar - (default 20 or 0 for horizontal) set to value to expand the interactive area of the slider bar
|
|
@@ -37210,7 +37231,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
37210
37231
|
.sca(0,1).rot(vertical?-90:0).mov(vertical?-accentOffset-accentSize-barWidth/2:0, vertical?barLength:accentOffset+barWidth/2)
|
|
37211
37232
|
.addTo(this);
|
|
37212
37233
|
}
|
|
37213
|
-
function drawAccent() {
|
|
37234
|
+
function drawAccent() {
|
|
37214
37235
|
accent.sca((that.value-that.min)/Math.abs(that.max-that.min), 1);
|
|
37215
37236
|
}
|
|
37216
37237
|
|
|
@@ -37331,7 +37352,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
37331
37352
|
}
|
|
37332
37353
|
}
|
|
37333
37354
|
|
|
37334
|
-
var myValue = min;
|
|
37355
|
+
var myValue = vertical?max:min; // ZIM 019 patch
|
|
37335
37356
|
var lastValue = 0; // does not include min so always starts at 0
|
|
37336
37357
|
this.button = button;
|
|
37337
37358
|
this.cur("pointer");
|
|
@@ -37678,6 +37699,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
37678
37699
|
|
|
37679
37700
|
|
|
37680
37701
|
if (!zot(value)) that.value = value;
|
|
37702
|
+
if (accent) drawAccent();
|
|
37681
37703
|
|
|
37682
37704
|
zim.setSwipe(this, false);
|
|
37683
37705
|
|
|
@@ -48722,7 +48744,7 @@ addChild(), removeChild(), addChildAt(), getChildAt(), contains(), removeAllChil
|
|
|
48722
48744
|
PROPERTIES
|
|
48723
48745
|
type - holds the class name as a String
|
|
48724
48746
|
index - get or set the index of the item
|
|
48725
|
-
|
|
48747
|
+
currentItem - the item at the front
|
|
48726
48748
|
each item has a content property if the item was added to a container by the carousel (only if item was not a container)
|
|
48727
48749
|
each item has a fader property which is a ZIM Rectangle - if the fade was not false or 0
|
|
48728
48750
|
items - the array of items
|
|
@@ -49224,7 +49246,7 @@ resize() - call the resize event if the scale or position of the Loader is chang
|
|
|
49224
49246
|
Note: if the Frame itself changes location in the HTML document, call a F.update()
|
|
49225
49247
|
this will then dispatch an update event to the Loader and it will resize()
|
|
49226
49248
|
this is not needed if resizing the window or scrolling - see Frame update() method docs
|
|
49227
|
-
save(content, filename, x, y, width, height, cached, cachedBounds, type, data, quality) - save a picture or text (supports ZIM DUO)
|
|
49249
|
+
save(content, filename, x, y, width, height, cached, cachedBounds, type, data, quality, remakeCache) - save a picture or text (supports ZIM DUO)
|
|
49228
49250
|
content - the Display object to be saved such as a Container, Bitmap, etc.
|
|
49229
49251
|
or text (or Label, TextInput, TextArea) or JSON or object for JSON
|
|
49230
49252
|
if text or json, then x, y, width, height, cached, cachedBounds, data, and quality are ignored
|
|
@@ -49239,6 +49261,11 @@ save(content, filename, x, y, width, height, cached, cachedBounds, type, data, q
|
|
|
49239
49261
|
otherwise save returns the object for chaining
|
|
49240
49262
|
quality - (default .92) a number between 0 an 1 representing the quality of the saved image (jpeg)
|
|
49241
49263
|
note, this parameter may be moved to before data in the next version of ZIM
|
|
49264
|
+
remakeCache - (default true) set to false if cached and do not want to recache due to using updateCache with blendmode
|
|
49265
|
+
BUT - probably want a backing color for blit art
|
|
49266
|
+
so recommend making a new Page(W,H,black) then add the art container to the backing and save the backing
|
|
49267
|
+
then add the art container back to the stage
|
|
49268
|
+
then do not set the remakeCache so it stays true and caches the page
|
|
49242
49269
|
|
|
49243
49270
|
Button methods:
|
|
49244
49271
|
setBacking(type, newBacking) - dynamically set any type of backing for button (if null removes backing for that type)
|
|
@@ -49569,11 +49596,12 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
49569
49596
|
uploadTag.addEventListener("drop", uploadEvent);
|
|
49570
49597
|
}
|
|
49571
49598
|
|
|
49572
|
-
this.save = function(content, filename, x, y, width, height, cached, cachedBounds, type, data, quality) {
|
|
49599
|
+
this.save = function(content, filename, x, y, width, height, cached, cachedBounds, type, data, quality, remakeCache) {
|
|
49573
49600
|
|
|
49574
|
-
var sig = "content, filename, x, y, width, height, cached, cachedBounds, type, data, quality";
|
|
49601
|
+
var sig = "content, filename, x, y, width, height, cached, cachedBounds, type, data, quality, remakeCache";
|
|
49575
49602
|
var duo; if (duo = zob(that.save, arguments, sig)) return duo;
|
|
49576
49603
|
if (zot(content)) content = frame.stage;
|
|
49604
|
+
if (zot(remakeCache)) remakeCache = true;
|
|
49577
49605
|
|
|
49578
49606
|
if (type=="text") type = "txt";
|
|
49579
49607
|
if (zot(type)) type = "png";
|
|
@@ -49615,15 +49643,16 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
49615
49643
|
if (zot(height)) height = (content.getBounds && content.getBounds()) ? content.getBounds().height : frame.height;
|
|
49616
49644
|
var cacheO = content.cacheCanvas;
|
|
49617
49645
|
|
|
49618
|
-
content.cache(x, y, width, height);
|
|
49619
|
-
|
|
49646
|
+
if (remakeCache) content.cache(x, y, width, height);
|
|
49620
49647
|
|
|
49621
49648
|
if (data) {
|
|
49622
49649
|
var image = content.cacheCanvas.toDataURL('image/' + type, quality);
|
|
49623
|
-
if (
|
|
49624
|
-
if (
|
|
49625
|
-
|
|
49626
|
-
|
|
49650
|
+
if (remakeCache) {
|
|
49651
|
+
if (cached) {
|
|
49652
|
+
if (cachedBounds) content.cache(cachedBounds.x, cachedBounds.y, cachedBounds.width, cachedBounds.height);
|
|
49653
|
+
} else {
|
|
49654
|
+
content.uncache();
|
|
49655
|
+
}
|
|
49627
49656
|
}
|
|
49628
49657
|
return image;
|
|
49629
49658
|
}
|
|
@@ -49674,10 +49703,12 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
49674
49703
|
// win.document.close();
|
|
49675
49704
|
|
|
49676
49705
|
// }
|
|
49677
|
-
if (
|
|
49678
|
-
if (
|
|
49679
|
-
|
|
49680
|
-
|
|
49706
|
+
if (remakeCache) {
|
|
49707
|
+
if (cached || cacheO) {
|
|
49708
|
+
if (cachedBounds) content.cache(cachedBounds.x, cachedBounds.y, cachedBounds.width, cachedBounds.height);
|
|
49709
|
+
} else {
|
|
49710
|
+
content.uncache();
|
|
49711
|
+
}
|
|
49681
49712
|
}
|
|
49682
49713
|
|
|
49683
49714
|
return that;
|
|
@@ -53082,7 +53113,7 @@ RETURNS obj for chaining
|
|
|
53082
53113
|
};//-47.95
|
|
53083
53114
|
|
|
53084
53115
|
/*--
|
|
53085
|
-
obj.drag = function(boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight)
|
|
53116
|
+
obj.drag = function(boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight, dropOriginal, style, group)
|
|
53086
53117
|
|
|
53087
53118
|
drag
|
|
53088
53119
|
zim DisplayObject method
|
|
@@ -53228,18 +53259,25 @@ singleTouch - (default false) set to true to let only one touch operate the drag
|
|
|
53228
53259
|
dropTargets - an object or an array of objects that can receive a drop
|
|
53229
53260
|
this can be a List or a Container or a single object
|
|
53230
53261
|
if it is a list see the dropListProps as well to set reticle properties and scroll speed
|
|
53262
|
+
recommend reg(CENTER) on objects and targets
|
|
53263
|
+
then use dropHitTest:"reg"
|
|
53231
53264
|
dropCopy - (default false) make a copy of the object as it is being dragged
|
|
53232
53265
|
dropSnap - (default true) snap to the target object
|
|
53233
|
-
dropBack - (default true) go back to
|
|
53266
|
+
dropBack - (default true) go back to last position if not dropped on a target
|
|
53267
|
+
or back to start if not dropped on a target and the dropOriginal is true
|
|
53234
53268
|
dropEnd - (default true) once dropped on a target a noMouse() is set on the object
|
|
53235
53269
|
dropFull - (default true) do not drop on a full target
|
|
53236
53270
|
note - if the object is removed from the target then a drop can occur again on that target
|
|
53237
53271
|
dropHitTest - (default "bounds") can also be "reg", "circles", "circle", "rect" - see ZIM HitTests
|
|
53238
53272
|
dropScale - set a scale for the dropped object
|
|
53273
|
+
if the object does not get dropped on a target, it will go back to its starting scale
|
|
53274
|
+
but not necessarily its starting position unless dropBack is set
|
|
53239
53275
|
dropWidth - set a width for the dropped object - overrides scale
|
|
53240
53276
|
height will keep aspect ratio unless dropHeight is provided
|
|
53241
53277
|
dropHeight - set a height for the dropped object - overrides scale
|
|
53242
53278
|
width will keep aspect ratio unless dropWidth is provided
|
|
53279
|
+
dropOriginal - if dropBack is true, will go to original location and scale if obj is not dropped on a target
|
|
53280
|
+
if dropped on a full target and dropFull is true then will go back to last position
|
|
53243
53281
|
style - (default true) set to false to ignore styles set with the STYLE - will receive original parameter defaults
|
|
53244
53282
|
group - (default null) set to String (or comma delimited String) so STYLE can set default styles to the group(s) (like a CSS class)
|
|
53245
53283
|
|
|
@@ -53252,6 +53290,8 @@ adds a dragPaused property to get or set the pause of the drag - which allows se
|
|
|
53252
53290
|
*** if dropTargets is set then drag() adds the following properties to the dragged object:
|
|
53253
53291
|
dropTarget - on pressup, what target the object is dropped on (or null)
|
|
53254
53292
|
dropList - which List if any a dropped object has
|
|
53293
|
+
dropFull - the target that is dropped on gets a dropFull property
|
|
53294
|
+
set this to false if programatically removing a dropped object such as for a garbage can
|
|
53255
53295
|
dropListProps - to be used if planning on dropping object into a List
|
|
53256
53296
|
The dropListProps have the following default values
|
|
53257
53297
|
{
|
|
@@ -53269,8 +53309,8 @@ Adds a "slidestop" event to the drag object that is dispatched when the object c
|
|
|
53269
53309
|
|
|
53270
53310
|
RETURNS obj for chaining
|
|
53271
53311
|
--*///+31
|
|
53272
|
-
zim.drag = function(obj, boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight, style, group) {
|
|
53273
|
-
var sig = "obj, boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight, style, group";
|
|
53312
|
+
zim.drag = function(obj, boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight, dropOriginal, style, group) {
|
|
53313
|
+
var sig = "obj, boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight, dropOriginal, style, group";
|
|
53274
53314
|
var duo; if (duo = zob(zim.drag, arguments, sig)) return duo;
|
|
53275
53315
|
if (obj.type=="AC"&&WW.zdf) {WW.zdf.ac("drag", arguments); return obj;}
|
|
53276
53316
|
z_d("31");
|
|
@@ -53345,6 +53385,7 @@ RETURNS obj for chaining
|
|
|
53345
53385
|
if (zot(dropScale)) dropScale = DS.dropScale!=null?DS.dropScale:null;
|
|
53346
53386
|
if (zot(dropWidth)) dropWidth = DS.dropWidth!=null?DS.dropWidth:null;
|
|
53347
53387
|
if (zot(dropHeight)) dropHeight = DS.dropHeight!=null?DS.dropHeight:null;
|
|
53388
|
+
if (zot(dropOriginal)) dropOriginal = DS.dropOriginal!=null?DS.dropOriginal:null; // ZIM 019 patch
|
|
53348
53389
|
|
|
53349
53390
|
if (dropTargets) {
|
|
53350
53391
|
slide = false;
|
|
@@ -53603,7 +53644,12 @@ RETURNS obj for chaining
|
|
|
53603
53644
|
}
|
|
53604
53645
|
|
|
53605
53646
|
// DROP - added ZIM 017 Patch
|
|
53606
|
-
if (zot(dragObject.dropStartS)) {
|
|
53647
|
+
if (zot(dragObject.dropStartS)) {
|
|
53648
|
+
if (!dragObject.dropOriginalList) {
|
|
53649
|
+
dragObject.dropOriginalX = dragObject.x;
|
|
53650
|
+
dragObject.dropOriginalY = dragObject.y;
|
|
53651
|
+
dragObject.dropOriginalS = dragObject.scale;
|
|
53652
|
+
}
|
|
53607
53653
|
dragObject.dropStartX = dragObject.x;
|
|
53608
53654
|
dragObject.dropStartY = dragObject.y;
|
|
53609
53655
|
dragObject.dropStartS = dragObject.scale;
|
|
@@ -53612,9 +53658,14 @@ RETURNS obj for chaining
|
|
|
53612
53658
|
if (dragObject.clone) {
|
|
53613
53659
|
dragObject.dropCopy = dragObject.clone(true).addTo(dragObject.parent, dragObject.parent.getChildIndex(dragObject));
|
|
53614
53660
|
dragObject.dropCopy.dropClone = true;
|
|
53661
|
+
if (!dragObject.dropOriginalList) {
|
|
53662
|
+
dragObject.dropCopy.dropOriginalX = dragObject.dropOriginalX;
|
|
53663
|
+
dragObject.dropCopy.dropOriginalY = dragObject.dropOriginalY;
|
|
53664
|
+
dragObject.dropCopy.dropOriginalS = dragObject.dropOriginalS;
|
|
53665
|
+
}
|
|
53615
53666
|
dragObject.dropCopy.dropStartX = dragObject.dropStartX;
|
|
53616
53667
|
dragObject.dropCopy.dropStartY = dragObject.dropStartY;
|
|
53617
|
-
dragObject.dropCopy.dropStartS = dragObject.dropStartS;
|
|
53668
|
+
dragObject.dropCopy.dropStartS = dragObject.dropStartS;
|
|
53618
53669
|
dragObject.dropCopy.noMouse();
|
|
53619
53670
|
}
|
|
53620
53671
|
}
|
|
@@ -53851,11 +53902,17 @@ RETURNS obj for chaining
|
|
|
53851
53902
|
|
|
53852
53903
|
if (obj.dropTargets) {
|
|
53853
53904
|
if (!Array.isArray(obj.dropTargets)) obj.dropTargets = [obj.dropTargets];
|
|
53854
|
-
//
|
|
53855
|
-
if
|
|
53856
|
-
|
|
53857
|
-
|
|
53858
|
-
|
|
53905
|
+
// // ZIM 019 patch - removed this and moved dropFull = false
|
|
53906
|
+
// // to if moved to different place
|
|
53907
|
+
// // the droppedTarget will be overwritten if succesful
|
|
53908
|
+
// // but if not then we want it to be the same as it was
|
|
53909
|
+
// if (dragObject.droppedTarget) {
|
|
53910
|
+
// dragObject.droppedTarget.dropFull = false;
|
|
53911
|
+
// dragObject.droppedTarget = null;
|
|
53912
|
+
// }
|
|
53913
|
+
|
|
53914
|
+
var wasFull = false; // ZIM 019 patch
|
|
53915
|
+
|
|
53859
53916
|
var miss = zim.loop(obj.dropTargets, function(target) {
|
|
53860
53917
|
|
|
53861
53918
|
if (target.type == "List") {
|
|
@@ -53875,10 +53932,15 @@ RETURNS obj for chaining
|
|
|
53875
53932
|
if (dropWidth || dropHeight) placeObject.siz(dropWidth, dropHeight);
|
|
53876
53933
|
if (dropEnd) placeObject.noMouse();
|
|
53877
53934
|
else placeObject.mouse();
|
|
53935
|
+
|
|
53936
|
+
// added in ZIM 019 patch
|
|
53937
|
+
// set last dropTarget dropFull to false
|
|
53938
|
+
if (placeObject.droppedTarget) placeObject.droppedTarget.dropFull = false;
|
|
53939
|
+
|
|
53878
53940
|
placeObject.droppedTarget = target;
|
|
53879
|
-
target.addAt(placeObject, target.dropReticleIndex);
|
|
53880
|
-
|
|
53941
|
+
target.addAt(placeObject, target.dropReticleIndex);
|
|
53881
53942
|
target.dropItem = dragObject;
|
|
53943
|
+
|
|
53882
53944
|
dragObject.droppedTarget = target;
|
|
53883
53945
|
dragObject.dropTarget = target;
|
|
53884
53946
|
target.dropList = target;
|
|
@@ -53890,6 +53952,9 @@ RETURNS obj for chaining
|
|
|
53890
53952
|
}
|
|
53891
53953
|
|
|
53892
53954
|
if (dragObject["hitTest"+String(dropHitTest).charAt(0).toUpperCase() + String(dropHitTest).slice(1)](target)) {
|
|
53955
|
+
|
|
53956
|
+
wasFull = target.dropFull; // ZIM 019 patch
|
|
53957
|
+
|
|
53893
53958
|
if (!dropFull || !target.dropFull) {
|
|
53894
53959
|
var placeObject = dragObject;
|
|
53895
53960
|
if (dropCopy && dragObject.dropCopy) {
|
|
@@ -53902,17 +53967,43 @@ RETURNS obj for chaining
|
|
|
53902
53967
|
if (dropScale) placeObject.sca(dropScale);
|
|
53903
53968
|
if (dropWidth || dropHeight) placeObject.siz(dropWidth, dropHeight);
|
|
53904
53969
|
if (dropEnd) placeObject.noMouse();
|
|
53905
|
-
else placeObject.mouse();
|
|
53970
|
+
else placeObject.mouse();
|
|
53971
|
+
|
|
53972
|
+
// added these in ZIM 019 patch
|
|
53973
|
+
placeObject.dropStartX = placeObject.x;
|
|
53974
|
+
placeObject.dropStartY = placeObject.y;
|
|
53975
|
+
placeObject.dropStartS = placeObject.scale;
|
|
53976
|
+
// set last dropTarget dropFull to false
|
|
53977
|
+
if (placeObject.droppedTarget) dragObject.droppedTarget.dropFull = false;
|
|
53978
|
+
// end ZIM 019 patch
|
|
53979
|
+
|
|
53906
53980
|
if (dropFull) target.dropFull = true;
|
|
53981
|
+
|
|
53907
53982
|
placeObject.droppedTarget = target;
|
|
53908
|
-
placeObject.dropTarget = target;
|
|
53983
|
+
placeObject.dropTarget = target;
|
|
53984
|
+
|
|
53909
53985
|
return false;
|
|
53910
53986
|
}
|
|
53911
53987
|
}
|
|
53912
53988
|
});
|
|
53989
|
+
|
|
53990
|
+
// dropOriginal
|
|
53991
|
+
// if set to false then once in a system always snaps back to within system
|
|
53992
|
+
// if set to true if dropped not on target then goes back to original x,y,scale
|
|
53993
|
+
// otherwise if full then still snaps back inside system
|
|
53913
53994
|
if (miss) {
|
|
53914
|
-
dragObject.dropTarget = dragObject.droppedTarget = null;
|
|
53995
|
+
// dragObject.dropTarget = dragObject.droppedTarget = null; // going back to last spot - removed this in ZIM 019 patch
|
|
53915
53996
|
if (dropBack) {
|
|
53997
|
+
|
|
53998
|
+
// ZIM 019 Patch to handle dropOrigin
|
|
53999
|
+
// dropOriginalList means it came originally from a List and will not have a dropOriginalX, etc.
|
|
54000
|
+
if ((!dropFull || !wasFull) && dropOriginal && !dragObject.dropOriginalList) {
|
|
54001
|
+
dragObject.dropStartX = dragObject.dropOriginalX;
|
|
54002
|
+
dragObject.dropStartY = dragObject.dropOriginalY;
|
|
54003
|
+
dragObject.dropStartS = dragObject.dropOriginalS;
|
|
54004
|
+
if (dragObject.droppedTarget) dragObject.droppedTarget.dropFull = false;
|
|
54005
|
+
dragObject.dropTarget = dragObject.droppedTarget = null;
|
|
54006
|
+
}
|
|
53916
54007
|
dragObject.animate({
|
|
53917
54008
|
props:{x:dragObject.dropStartX, y:dragObject.dropStartY, scale:dragObject.dropStartS},
|
|
53918
54009
|
time:.2,
|
|
@@ -53925,7 +54016,13 @@ RETURNS obj for chaining
|
|
|
53925
54016
|
}
|
|
53926
54017
|
});
|
|
53927
54018
|
} else {
|
|
53928
|
-
|
|
54019
|
+
|
|
54020
|
+
// added these in ZIM 019 patch
|
|
54021
|
+
if (dragObject.droppedTarget) dragObject.droppedTarget.dropFull = false;
|
|
54022
|
+
dragObject.droppedTarget = null;
|
|
54023
|
+
// end ZIM 019 patch
|
|
54024
|
+
|
|
54025
|
+
dragObject.sca(dragObject.dropOriginalS);
|
|
53929
54026
|
if (dropCopy && dragObject.dropCopy) {
|
|
53930
54027
|
swapProperties("x", dragObject, dragObject.dropCopy);
|
|
53931
54028
|
swapProperties("y", dragObject, dragObject.dropCopy);
|
|
@@ -58270,10 +58367,11 @@ sequence - (default 0) the delay time in seconds to run on children of a contain
|
|
|
58270
58367
|
Note: for a sequence animate() give the animate() an id and pauseAnimate() or stopAnimate() that id.
|
|
58271
58368
|
sequenceCall - (default null) the function that will be called for each sequence animation
|
|
58272
58369
|
Note: the value of the sequenceCall parameter will be the object that just ended animation unless there is a sequenceParams value
|
|
58370
|
+
To get the object about to animate use the startCall parameter
|
|
58273
58371
|
sequenceParams - (default null) a parameter sent to the sequenceCall function
|
|
58274
58372
|
sequenceReverse - |ZIM VEE| (default false) set to true to sequence through container or array backwards
|
|
58275
58373
|
sequenceRatio - (default null) set to a value to adjust the rate based on item ratio property
|
|
58276
|
-
|
|
58374
|
+
see https://zimjs.com/016/normalize.html
|
|
58277
58375
|
see Container() ratio property and normalize() method which give a ratio property.
|
|
58278
58376
|
This will automatically set sequence to 0 so that each item in the container (or tile) is animated individually
|
|
58279
58377
|
the sequenceRate value will be multiplied by the item's ratio and then added to the rate (see rate parameter)
|
|
@@ -69706,7 +69804,6 @@ Beads
|
|
|
69706
69804
|
zim class - extends a zim.Container which extends a createjs.Container
|
|
69707
69805
|
|
|
69708
69806
|
DESCRIPTION
|
|
69709
|
-
|
|
69710
69807
|
Beads adds objects around a Squiggle or Blob path.
|
|
69711
69808
|
Different objects can be specified with ZIM VEE (Pick) values
|
|
69712
69809
|
to put random or sequenced objects around path.
|
|
@@ -71747,6 +71844,7 @@ const camera = three.camera;
|
|
|
71747
71844
|
|
|
71748
71845
|
const controls = new OrbitControls(camera, three.canvas);
|
|
71749
71846
|
|
|
71847
|
+
Note: put TextureActives above applying any TextureActive textures to three.js objects
|
|
71750
71848
|
const textureActives = new TextureActives([panel, backing], THREE, three, renderer, scene, camera, controls, 1, 0, 1500);
|
|
71751
71849
|
|
|
71752
71850
|
// can capture raydown, raymove, rayup, rayover and rayout
|
|
@@ -72001,6 +72099,8 @@ XR
|
|
|
72001
72099
|
TextureActive will detect if XR (AR/VR) is being used and will use the suitable Raycaster
|
|
72002
72100
|
Additional classes are provided with the ZIM Three helper library for controllers, movement and teleport
|
|
72003
72101
|
|
|
72102
|
+
NOTE: put the TextureActives object before applying any TextureActive textures to three.js objects
|
|
72103
|
+
|
|
72004
72104
|
NOTE: for XR, a layer must be set so the controllers do not get in the way of interactivity
|
|
72005
72105
|
so in the TextureActives() set layer:1 and when adding meshes use addMesh(mesh, 1)
|
|
72006
72106
|
|
|
@@ -72047,6 +72147,7 @@ const camera = three.camera;
|
|
|
72047
72147
|
|
|
72048
72148
|
const controls = new OrbitControls(camera, three.canvas);
|
|
72049
72149
|
|
|
72150
|
+
Note: put TextureActives above applying any TextureActive textures to three.js objects
|
|
72050
72151
|
const textureActives = new TextureActives([panel, backing], THREE, three, renderer, scene, camera, controls, 1, 0, 1500);
|
|
72051
72152
|
|
|
72052
72153
|
// can capture raydown, raymove, rayup, rayover and rayout
|
|
@@ -76126,7 +76227,13 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
|
|
|
76126
76227
|
pp.y < con.y || pp.y > con.y+con.height
|
|
76127
76228
|
) return;
|
|
76128
76229
|
}
|
|
76129
|
-
if (type == "mousedown") {
|
|
76230
|
+
if (type == "mousedown") {
|
|
76231
|
+
|
|
76232
|
+
// added ZIM 019 patch to not include objects outside container if provided unless in mousedownIncludes
|
|
76233
|
+
if (that.mouseDownIncludes || container) under = stage.getObjectUnderPoint(e.stageX, e.stageY, 1);
|
|
76234
|
+
if (container && under && under!=target && !container.contains(under)) {
|
|
76235
|
+
if (mousedownIncludes && mousedownIncludes.indexOf(under) == -1) return;
|
|
76236
|
+
}
|
|
76130
76237
|
if (!Array.isArray(that.mousedownIncludes)) that.mousedownIncludes = [that.mousedownIncludes];
|
|
76131
76238
|
if (that.mousedownIncludes.indexOf(container)<0) {
|
|
76132
76239
|
for (i=0; i<container.numChildren; i++) {
|
|
@@ -76173,9 +76280,13 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
|
|
|
76173
76280
|
if (type == "pressdrag" && !target.hitTestPoint(e.stageX/zim.scaX, e.stageY/zim.scaY)) return;
|
|
76174
76281
|
moveCheck = false;
|
|
76175
76282
|
if (!Array.isArray(that.mousedownIncludes)) that.mousedownIncludes = [that.mousedownIncludes];
|
|
76176
|
-
var inCheck = false;
|
|
76177
|
-
|
|
76178
|
-
|
|
76283
|
+
var inCheck = false;
|
|
76284
|
+
|
|
76285
|
+
// added ZIM 019 patch to not include objects outside container if provided unless in mousedownIncludes
|
|
76286
|
+
if (that.mouseDownIncludes || container) under = stage.getObjectUnderPoint(e.stageX, e.stageY, 1);
|
|
76287
|
+
if (container && under && under!=target && !container.contains(under)) {
|
|
76288
|
+
if (mousedownIncludes && mousedownIncludes.indexOf(under) == -1) return;
|
|
76289
|
+
}
|
|
76179
76290
|
|
|
76180
76291
|
for (i=0; i<that.mousedownIncludes.length; i++) {
|
|
76181
76292
|
if (under && that.mousedownIncludes[i].hitTestPoint && that.mousedownIncludes[i].hitTestPoint(e.stageX/zim.scaX, e.stageY/zim.scaY) && that.mousedownIncludes[i].contains(under)) {
|
|
@@ -76186,7 +76297,7 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
|
|
|
76186
76297
|
for (i=0; i<container.numChildren; i++) {
|
|
76187
76298
|
var child = container.getChildAt(i);
|
|
76188
76299
|
// returning on first container?
|
|
76189
|
-
if (that.mousedownIncludes.indexOf(child)==-1 && child.mouseEnabled && child.hitTestPoint && child.hitTestPoint(e.stageX/zim.scaX, e.stageY/zim.scaY)) return;
|
|
76300
|
+
if (that.mousedownIncludes.indexOf(child)==-1 && child.mouseEnabled && child.hitTestPoint && child.hitTestPoint(e.stageX/zim.scaX, e.stageY/zim.scaY)) return;
|
|
76190
76301
|
}
|
|
76191
76302
|
}
|
|
76192
76303
|
var p = container.globalToLocal(mouseMoveOutside?e.rawX/zim.scaX:e.stageX/zim.scaX, mouseMoveOutside?e.rawY/zim.scaY:e.stageY/zim.scaY);
|
|
@@ -85545,7 +85656,7 @@ END EXAMPLE
|
|
|
85545
85656
|
EXAMPLE
|
|
85546
85657
|
// using ZIM VEE series to adjust stroke color and width
|
|
85547
85658
|
const g = new Generator({draw:gen, maxCount:360/2, strokeColor:green});
|
|
85548
|
-
const s = series({min:1, max:4
|
|
85659
|
+
const s = series({min:1, max:4, step:.1}).bounce(); // stroke sizes
|
|
85549
85660
|
const c = series(blue,pink,green).every(12); // color change
|
|
85550
85661
|
function gen(count, total, g) {
|
|
85551
85662
|
g
|
|
@@ -88019,25 +88130,45 @@ dispatches a "ready" event when the sound source is connected and the calculate(
|
|
|
88019
88130
|
} else if (input.type == "SynthSound") {
|
|
88020
88131
|
connectSource(input.gain);
|
|
88021
88132
|
} else {
|
|
88022
|
-
if (input.type && input.type == "sound") {zogy("ZIM SoundWave: pass in the result of
|
|
88133
|
+
if (input.type && input.type == "sound") {zogy("ZIM SoundWave: pass in the result of an Aud('somesound').play() for the input"); return;}
|
|
88023
88134
|
var audio,source;
|
|
88024
88135
|
if (input.playbackResource) {
|
|
88025
|
-
audio = input.playbackResource; // a playing
|
|
88026
|
-
|
|
88027
|
-
|
|
88028
|
-
|
|
88029
|
-
|
|
88030
|
-
|
|
88136
|
+
audio = input.playbackResource; // a playing Aud("somesound").play()
|
|
88137
|
+
|
|
88138
|
+
// ZIM 019 Patch - thanks Vishwas Gagrani for the report
|
|
88139
|
+
// if audio finishes cannot properly remove the source - bug in HTML 5 Audio
|
|
88140
|
+
// which caused errors if trying to do another SoundWave on the audio
|
|
88141
|
+
// so remember if already had a Soundwave
|
|
88142
|
+
// and need to use that audioContext and analyser
|
|
88143
|
+
if (audio.firstSource) {
|
|
88144
|
+
source = audio.firstSource;
|
|
88145
|
+
audioContext = audio.audioContext;
|
|
88146
|
+
analyser = audio.analyser;
|
|
88147
|
+
} else {
|
|
88148
|
+
if (audio.mediaSourceNode) {
|
|
88149
|
+
source = audio.mediaSourceNode;
|
|
88150
|
+
} else {
|
|
88151
|
+
source = audioContext.createMediaElementSource(audio);
|
|
88152
|
+
}
|
|
88153
|
+
}
|
|
88031
88154
|
} else {
|
|
88032
88155
|
audio = input; // a playing <audio> tag zid("soundTagID").play()
|
|
88033
|
-
|
|
88034
|
-
|
|
88156
|
+
if (audio.firstSource) {
|
|
88157
|
+
source = audio.firstSource;
|
|
88158
|
+
audioContext = audio.audioContext;
|
|
88159
|
+
analyser = audio.analyser;
|
|
88160
|
+
} else {
|
|
88161
|
+
source = audioContext.createMediaElementSource(audio);
|
|
88162
|
+
}
|
|
88163
|
+
}
|
|
88164
|
+
audio.firstSource = source;
|
|
88165
|
+
audio.audioContext = audioContext;
|
|
88166
|
+
audio.analyser = analyser;
|
|
88035
88167
|
connectSource(source);
|
|
88036
88168
|
}
|
|
88037
88169
|
};
|
|
88038
88170
|
this.setInput(input);
|
|
88039
88171
|
|
|
88040
|
-
|
|
88041
88172
|
var steps;
|
|
88042
88173
|
var lastSource;
|
|
88043
88174
|
|
|
@@ -88124,6 +88255,7 @@ dispatches a "ready" event when the sound source is connected and the calculate(
|
|
|
88124
88255
|
setTimeout(function(){that.dispatchEvent("ready");}, 50);
|
|
88125
88256
|
}
|
|
88126
88257
|
this.dispose = function(context) {
|
|
88258
|
+
// if (lastSource) lastSource.disconnect();
|
|
88127
88259
|
if (lastSource && analyser) lastSource.disconnect(analyser);
|
|
88128
88260
|
if (context && audioContext) audioContext.close();
|
|
88129
88261
|
if (analyser) analyser.disconnect();
|
|
@@ -91678,7 +91810,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
91678
91810
|
var duo; if (duo = zob(that.loadAssets, arguments, sig)) return duo;
|
|
91679
91811
|
}
|
|
91680
91812
|
|
|
91681
|
-
if (!zot(path)) {
|
|
91813
|
+
if (!zot(path) && path.replace) {
|
|
91682
91814
|
path = path.replace(/\/$/,"");
|
|
91683
91815
|
path = path + "/";
|
|
91684
91816
|
WW.PATH = path;
|
|
@@ -92184,7 +92316,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
92184
92316
|
// now check auto load assets or broken if second
|
|
92185
92317
|
|
|
92186
92318
|
if (WW.PATH!=null) zim.PATH = WW.PATH;
|
|
92187
|
-
if (zim.PATH!=null) {
|
|
92319
|
+
if (zim.PATH!=null && zim.PATH.replace) {
|
|
92188
92320
|
zim.PATH = zim.PATH.replace(/\/$/,"");
|
|
92189
92321
|
zim.PATH = zim.PATH + "/";
|
|
92190
92322
|
}
|
|
@@ -103196,4 +103328,3 @@ export let Style = zim.Style;
|
|
|
103196
103328
|
export let assets = zim.assets;
|
|
103197
103329
|
export let assetIDs = zim.assetIDs;
|
|
103198
103330
|
export let ZIMON = zim.ZIMON;
|
|
103199
|
-
|