zimjs 17.2.9 → 17.3.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 +105 -51
- package/ts-src/typings/zim/index.d.ts +4 -3
package/package.json
CHANGED
package/src/zim.js
CHANGED
|
@@ -11226,9 +11226,19 @@ with various features like playing a labelled animation,
|
|
|
11226
11226
|
playing animation series, wait, loop, rewind and call functions.
|
|
11227
11227
|
This actually runs a ZIM animation and animates the frames.
|
|
11228
11228
|
|
|
11229
|
+
Sprites can also be used a Texture Atlas
|
|
11230
|
+
which is one image that holds many pictures.
|
|
11231
|
+
The sprite can be told to go to a frame and show the picture.
|
|
11232
|
+
This is how most games are made with a SpriteSheet of treasures, trees, etc.
|
|
11233
|
+
It is faster as it makes one GPU call.
|
|
11234
|
+
If the Sprite is not run, it will show a random frame (as if ZIM 017).
|
|
11235
|
+
If you want a specific frame then use the frame property or the run({frame:num}).
|
|
11236
|
+
|
|
11229
11237
|
SEE:
|
|
11230
11238
|
https://zimjs.com/interactiveanimation.html
|
|
11231
11239
|
https://zimjs.com/interactiveanimation/
|
|
11240
|
+
|
|
11241
|
+
older:
|
|
11232
11242
|
https://zimjs.com/spritesheet/
|
|
11233
11243
|
https://zimjs.com/spritesheet/skateboard.html
|
|
11234
11244
|
https://codepen.io/danzen/pen/yEKbbR
|
|
@@ -11301,11 +11311,23 @@ function ready() {
|
|
|
11301
11311
|
}
|
|
11302
11312
|
END EXAMPLE
|
|
11303
11313
|
|
|
11314
|
+
EXAMPLE
|
|
11315
|
+
// using Sprite as a texture atlas - or spritesheet of different images
|
|
11316
|
+
// load in assets and path
|
|
11317
|
+
new Frame({ready, assets:"ai_trees02.png", path:"https://zimjs.org/assets/"});
|
|
11318
|
+
function ready() {
|
|
11319
|
+
new Sprite("ai_trees02.png", 5, 4).center(); // will show a random tree
|
|
11320
|
+
new Sprite("ai_trees02.png", 5, 4).loc(200,200).run({frame:2}); // will show the third tree
|
|
11321
|
+
const tree = new Sprite("ai_trees02.png", 5, 4).loc(500,500);
|
|
11322
|
+
tree.frame = 5; // will show the 6th tree
|
|
11323
|
+
}
|
|
11324
|
+
END EXAMPLE
|
|
11325
|
+
|
|
11304
11326
|
EXAMPLE
|
|
11305
11327
|
// using Sprite as a texture atlas - or spritesheet of different images
|
|
11306
11328
|
// see: https://zimjs.com/zapp/Z_FDJXA
|
|
11307
11329
|
// load in assets and path
|
|
11308
|
-
new Frame({ready, assets:["fruit.png", "fruit.json"], path:"assets/"});
|
|
11330
|
+
new Frame({ready, assets:["fruit.png", "fruit.json"], path:"https://zimjs.org/assets/"});
|
|
11309
11331
|
function ready() {
|
|
11310
11332
|
new Sprite({json:"fruit.json", label:"apple"}).center();
|
|
11311
11333
|
}
|
|
@@ -11378,6 +11400,7 @@ globalControl - (default true) pauseRun and stopRun will control other animation
|
|
|
11378
11400
|
spriteSheet - (default null) pass in a CreateJS SpriteSheet to build a Sprite from that
|
|
11379
11401
|
label - (default null) pass in a label to stop on initially - to play from a label use the run({label:val}) method
|
|
11380
11402
|
frame - (default zimDefaultFrame) specify a Frame other than the default frame
|
|
11403
|
+
note - this is not the frame number of the Sprite - for that use the frame property or run({frame:num})
|
|
11381
11404
|
style - (default true) set to false to ignore styles set with the STYLE - will receive original parameter defaults
|
|
11382
11405
|
group - (default null) set to String (or comma delimited String) so STYLE can set default styles to the group(s) (like a CSS class)
|
|
11383
11406
|
inherit - (default null) used internally but can receive an {} of styles directly
|
|
@@ -11425,6 +11448,7 @@ run(time, label, call, params, wait, waitedCall, waitedParams, loop, loopCount,
|
|
|
11425
11448
|
endFrame - (default null - or totalFrames) the frame to end on - will be overridden by a label with frames
|
|
11426
11449
|
frame - (default null) set the single frame to run - will override startFrame and endFrame
|
|
11427
11450
|
this is good for a TextureAtlas where you show one frame of the sprite as a picture
|
|
11451
|
+
also see frame property - this just goes to the frame and does not use ZIM animate() in the background
|
|
11428
11452
|
tweek - (default 1) a factor for extra time on rewind and loops if needed
|
|
11429
11453
|
id - (default randomly assigned) an id you can use in other animations - available as sprite.id
|
|
11430
11454
|
use this id in other animations for pauseRun and stopRun to act on these as well
|
|
@@ -11458,6 +11482,7 @@ PROPERTIES
|
|
|
11458
11482
|
type - holds the class name as a String
|
|
11459
11483
|
id - an id that you can use in other animations to also be controlled by pauseRun() and stopRun()
|
|
11460
11484
|
frame - get and set the current frame of the Sprite
|
|
11485
|
+
As of ZIM 017, if the sprite is not run() then it will show a random frame
|
|
11461
11486
|
normalizedFrame - if animations have CreateJS speeds applied, zim handles these by making extra frames
|
|
11462
11487
|
for example, if a speed is given of .5 then two frames are made (min resulution is .1)
|
|
11463
11488
|
normalizedFrames - an array of total frames after being normalized - really for internal usage
|
|
@@ -11718,7 +11743,12 @@ animationend, change, added, click, dblclick, mousedown, mouseout, mouseover, pr
|
|
|
11718
11743
|
if (zot(tweek)) tweek = 1;
|
|
11719
11744
|
if (!zot(id)) that.id = id;
|
|
11720
11745
|
if (!zot(globalControl)) that.globalControl = globalControl;
|
|
11721
|
-
if (!zot(frame))
|
|
11746
|
+
if (!zot(frame)) {
|
|
11747
|
+
startFrame = endFrame = frame;
|
|
11748
|
+
that.frame = frame;
|
|
11749
|
+
that.randFrame = false;
|
|
11750
|
+
return that; // just go to the frame ZIM 017
|
|
11751
|
+
}
|
|
11722
11752
|
|
|
11723
11753
|
var extraTime;
|
|
11724
11754
|
if (Array.isArray(label)) {
|
|
@@ -11772,7 +11802,7 @@ animationend, change, added, click, dblclick, mousedown, mouseout, mouseover, pr
|
|
|
11772
11802
|
_normalizedFrame = 0;
|
|
11773
11803
|
that.gotoAndStop(_normalizedFrames[_normalizedFrame]);
|
|
11774
11804
|
startFrame = endFrame = null;
|
|
11775
|
-
obj = {normalizedFrame:_normalizedFrames.length-1};
|
|
11805
|
+
obj = {normalizedFrame:_normalizedFrames.length-1};
|
|
11776
11806
|
}
|
|
11777
11807
|
|
|
11778
11808
|
if (zot(time)) time = timeType=="s"?1:1000;
|
|
@@ -11843,6 +11873,7 @@ animationend, change, added, click, dblclick, mousedown, mouseout, mouseover, pr
|
|
|
11843
11873
|
}
|
|
11844
11874
|
return that;
|
|
11845
11875
|
};
|
|
11876
|
+
|
|
11846
11877
|
|
|
11847
11878
|
Object.defineProperty(this, 'frame', {
|
|
11848
11879
|
get: function() {
|
|
@@ -11850,6 +11881,7 @@ animationend, change, added, click, dblclick, mousedown, mouseout, mouseover, pr
|
|
|
11850
11881
|
},
|
|
11851
11882
|
set: function(value) {
|
|
11852
11883
|
value = Math.round(value);
|
|
11884
|
+
that.randFrame = false;
|
|
11853
11885
|
if (this.paused) {
|
|
11854
11886
|
this.gotoAndStop(value);
|
|
11855
11887
|
} else {
|
|
@@ -11887,11 +11919,11 @@ animationend, change, added, click, dblclick, mousedown, mouseout, mouseover, pr
|
|
|
11887
11919
|
});
|
|
11888
11920
|
|
|
11889
11921
|
if (style!==false) zim.styleTransforms(this, DS); // global function - would have put on DisplayObject if had access to it
|
|
11890
|
-
this.clone = function() {
|
|
11922
|
+
this.clone = function(exact) {
|
|
11891
11923
|
var s = this.cloneProps(new zim.Sprite(image, cols, rows, count, offsetX, offsetY, spacingX, spacingY, width, height, animations, json, null, globalControl, spriteSheet, label, frame, style, this.group, inherit));
|
|
11892
11924
|
|
|
11893
|
-
//
|
|
11894
|
-
if (that.
|
|
11925
|
+
// modified ZIM 017 late patch - for random frame sprite default with Tile, etc.
|
|
11926
|
+
if (exact || !that.randFrame) s.frame = that.frame;
|
|
11895
11927
|
|
|
11896
11928
|
return s;
|
|
11897
11929
|
};
|
|
@@ -11950,6 +11982,12 @@ animationend, change, added, click, dblclick, mousedown, mouseout, mouseover, pr
|
|
|
11950
11982
|
}
|
|
11951
11983
|
return that.cjsSprite_getBounds();
|
|
11952
11984
|
};
|
|
11985
|
+
|
|
11986
|
+
if (!label) {
|
|
11987
|
+
that.gotoAndStop(zim.rand(that.totalFrames-1));
|
|
11988
|
+
that.randFrame = true;
|
|
11989
|
+
}
|
|
11990
|
+
|
|
11953
11991
|
this.dispose = function() {
|
|
11954
11992
|
zim.gD(this); // globalDispose function for common elements
|
|
11955
11993
|
this.dispatchEvent("removed");
|
|
@@ -17316,7 +17354,7 @@ Note the points property has been split into points and pointObjects (and there
|
|
|
17316
17354
|
});
|
|
17317
17355
|
|
|
17318
17356
|
if (that.selectPoints) {
|
|
17319
|
-
sets.tap(function (e) {
|
|
17357
|
+
sets.tap({call:function (e) {
|
|
17320
17358
|
if (e.target.rect1) { // then mousedown on ball - which has a rect1
|
|
17321
17359
|
var ball = e.target;
|
|
17322
17360
|
that.selectedBalls.toggle(ball.parent.num);
|
|
@@ -17335,7 +17373,7 @@ Note the points property has been split into points and pointObjects (and there
|
|
|
17335
17373
|
po[3].color = that.selectedRect2s.isSelected(i)?selectColor:getBackgroundColor(po[4]);
|
|
17336
17374
|
}
|
|
17337
17375
|
stage.update();
|
|
17338
|
-
});
|
|
17376
|
+
}, mobileUp:true});
|
|
17339
17377
|
}
|
|
17340
17378
|
|
|
17341
17379
|
sets.on("pressmove", function(e) {
|
|
@@ -19567,7 +19605,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
19567
19605
|
});
|
|
19568
19606
|
|
|
19569
19607
|
if (that.selectPoints) {
|
|
19570
|
-
sets.tap(function (e) {
|
|
19608
|
+
sets.tap({call:function (e) {
|
|
19571
19609
|
var ball;
|
|
19572
19610
|
if (e.target.rect1) { // then mousedown on ball - which has a rect1
|
|
19573
19611
|
ball = e.target;
|
|
@@ -19587,7 +19625,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
19587
19625
|
po[3].color = that.selectedRect2s.isSelected(i)?selectColor:getBackgroundColor(po[4]);
|
|
19588
19626
|
}
|
|
19589
19627
|
e.target.stage.update();
|
|
19590
|
-
});
|
|
19628
|
+
}, mobileUp:true});
|
|
19591
19629
|
}
|
|
19592
19630
|
|
|
19593
19631
|
sets.on("pressmove", function(e) {
|
|
@@ -24942,6 +24980,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
24942
24980
|
var originalText = label.text;
|
|
24943
24981
|
var originalColor = label.color;
|
|
24944
24982
|
var originalRollColor = label.rollColor;
|
|
24983
|
+
var originalDownColor = label.rollColor;
|
|
24945
24984
|
this.on(toggleEvent, function() {
|
|
24946
24985
|
that.toggled = !that.toggled;
|
|
24947
24986
|
setToggled();
|
|
@@ -25334,7 +25373,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
25334
25373
|
downColor = value;
|
|
25335
25374
|
if (originalDownColor) originalDownColor = downColor;
|
|
25336
25375
|
if (that.label) {
|
|
25337
|
-
that.label.
|
|
25376
|
+
that.label.colorOnly = downColor;
|
|
25338
25377
|
}
|
|
25339
25378
|
}
|
|
25340
25379
|
});
|
|
@@ -27769,7 +27808,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
27769
27808
|
}
|
|
27770
27809
|
that.titleBar.tap(function () {
|
|
27771
27810
|
that.collapsed = !that.collapsed;
|
|
27772
|
-
}, null, null, null, true, null, null, null, null, false);
|
|
27811
|
+
}, null, null, null, true, null, null, null, null, false, true);
|
|
27773
27812
|
// that.collapseEvent = that.titleBar.on("dblclick", function () {
|
|
27774
27813
|
// that.collapsed = !that.collapsed;
|
|
27775
27814
|
// });
|
|
@@ -29264,7 +29303,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
29264
29303
|
if (that.titleBar) {
|
|
29265
29304
|
that.titleBar.tap(function () {
|
|
29266
29305
|
that.collapsed = !that.collapsed;
|
|
29267
|
-
}, null, null, null, true, null, null, null, null, false);
|
|
29306
|
+
}, null, null, null, true, null, null, null, null, false, true);
|
|
29268
29307
|
// that.collapseEvent = that.titleBar.on("dblclick", function () {
|
|
29269
29308
|
// that.collapsed = !that.collapsed;
|
|
29270
29309
|
// });
|
|
@@ -30723,7 +30762,7 @@ END EXAMPLE
|
|
|
30723
30762
|
PARAMETERS
|
|
30724
30763
|
** supports DUO - parameters or single object with properties below
|
|
30725
30764
|
** supports OCT - parameter defaults can be set with STYLE control (like CSS)
|
|
30726
|
-
width - (default
|
|
30765
|
+
width - (default 300) width of indicator
|
|
30727
30766
|
height - (default 50) height of indicator
|
|
30728
30767
|
num - (default 6) the number of lights
|
|
30729
30768
|
foregroundColor - (default "orange") color of the light(s) turned on
|
|
@@ -31792,6 +31831,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
|
|
|
31792
31831
|
this.hiddenInput.addEventListener("paste", function() {
|
|
31793
31832
|
setTimeout(function() {
|
|
31794
31833
|
that.hiddenInput.setSelectionRange(that.hiddenInput.selectionStart, that.hiddenInput.selectionEnd, rtl?"forward":"backward");
|
|
31834
|
+
// setTimeout(function() {that.positionBlinkerAndSelection()}, 50);
|
|
31795
31835
|
}, 50);
|
|
31796
31836
|
});
|
|
31797
31837
|
this.positionBlinkerAndSelection = function() {
|
|
@@ -32148,7 +32188,7 @@ const list = new List({
|
|
|
32148
32188
|
.tap(()=>{
|
|
32149
32189
|
const currentID = list.accordionIndex;
|
|
32150
32190
|
const currentText = list.value;
|
|
32151
|
-
const parentID = list.tree.getParent(currentID);
|
|
32191
|
+
const parentID = list.tree.getParent("id"+currentID);
|
|
32152
32192
|
let parentText;
|
|
32153
32193
|
if (parentID) parentText = list.tree.getData(parentID).obj;
|
|
32154
32194
|
zog(currentID, currentText, parentID, parentText);
|
|
@@ -32178,7 +32218,7 @@ list - (default Options 1-30) an array of strings, numbers or zim Label objects
|
|
|
32178
32218
|
expander - (default "plus") set to "arrow" or "none" to change the expander icon - thanks Christopher Browne and Ofweird Top for the suggestions
|
|
32179
32219
|
subStyles - (default null) an array of style objects for each sublevel - with all the color and background color properties
|
|
32180
32220
|
See: https://zimjs.com/ten/accordion.html
|
|
32181
|
-
note: the Accordion List is currently incompatible with the Organizer,
|
|
32221
|
+
note: the Accordion List is currently incompatible with the Organizer, addAt() and removeAt()
|
|
32182
32222
|
viewNum - (default 5) how many items to show in the width and height provided
|
|
32183
32223
|
adjusting this number will also change the overall scale of custom items for horizontal lists
|
|
32184
32224
|
(this does not affect vertical lists due to the way vertical tabs are optimized)
|
|
@@ -32186,7 +32226,7 @@ viewNum - (default 5) how many items to show in the width and height provided
|
|
|
32186
32226
|
if no items are provided to start but rather added with addAt() then choose a viewNum that roughly matches how many items will fit in the view
|
|
32187
32227
|
Note - the items will not be scaled larger by a viewNum setting... only scaled smaller.
|
|
32188
32228
|
vertical - (default true) set to false to make a horizontal list
|
|
32189
|
-
currentSelected - (default false) set to true to show the
|
|
32229
|
+
currentSelected - (default false) set to true to show the curret selection as highlighted
|
|
32190
32230
|
align - (default CENTER) horizontal align
|
|
32191
32231
|
set to START to align LEFT for ZIM DIR constant is "ltr" or RIGHT when DIR="rtl" - END is the opposite
|
|
32192
32232
|
valign - (default CENTER) vertical align
|
|
@@ -33073,7 +33113,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
33073
33113
|
}
|
|
33074
33114
|
});
|
|
33075
33115
|
|
|
33076
|
-
that.tap(function(e) {
|
|
33116
|
+
that.tap({call:function(e) {
|
|
33077
33117
|
if (!that.selected || !that.selected.expander) return;
|
|
33078
33118
|
var data = tree.getData(that.selected.listZID);
|
|
33079
33119
|
if (!data.open && closeOthers) { // close
|
|
@@ -33082,19 +33122,19 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
33082
33122
|
return;
|
|
33083
33123
|
}
|
|
33084
33124
|
tapList(e);
|
|
33085
|
-
});
|
|
33125
|
+
}, mobileUp:true});
|
|
33086
33126
|
}
|
|
33087
33127
|
|
|
33088
33128
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
33089
33129
|
|
|
33090
33130
|
var _index;
|
|
33091
|
-
tabs.tap(function (e) {
|
|
33131
|
+
tabs.tap({call:function (e) {
|
|
33092
33132
|
if (e.target.index == that.index) return;
|
|
33093
33133
|
that.index = tabs.index;
|
|
33094
33134
|
that.dispatchEvent("change");
|
|
33095
33135
|
if (pulldownToggle) that.index = 0; // will cause pulldown to collapse
|
|
33096
33136
|
e.preventDefault();
|
|
33097
|
-
});
|
|
33137
|
+
}, mobileUp:true});
|
|
33098
33138
|
tabs.on("keychange", function (e) {
|
|
33099
33139
|
if (e.target.index == that.index) return;
|
|
33100
33140
|
that.index = tabs.index;
|
|
@@ -34142,10 +34182,10 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
34142
34182
|
c.backing = new zim.Rectangle(width-spacing*2, c.checkBox.height+paddingV*2, backgroundColor).addTo(c);
|
|
34143
34183
|
c.checkBox.center(c);
|
|
34144
34184
|
if (align != "center" && align != "middle") c.checkBox.pos(paddingH,null,align=="right");
|
|
34145
|
-
c.backing.tap(function () {
|
|
34185
|
+
c.backing.tap({call:function () {
|
|
34146
34186
|
c.checkBox.toggle();
|
|
34147
34187
|
c.zimOut(); // could do over() but like out()
|
|
34148
|
-
});
|
|
34188
|
+
}, mobileUp:true});
|
|
34149
34189
|
c.checkBox.change(function () {
|
|
34150
34190
|
c.zimOut();
|
|
34151
34191
|
});
|
|
@@ -38588,7 +38628,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
38588
38628
|
button.on("mousedown", function(e) {
|
|
38589
38629
|
that.buttonDown = e.currentTarget;
|
|
38590
38630
|
});
|
|
38591
|
-
button.on("pressup", function(e) {
|
|
38631
|
+
button.on("pressup", function(e) {
|
|
38592
38632
|
that.buttonDown = null;
|
|
38593
38633
|
var num = e.currentTarget.znum;
|
|
38594
38634
|
if (useTap || zim.ACTIONEVENT=="click") setTimeout(function(){changeBack(num);},50)
|
|
@@ -41339,7 +41379,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
41339
41379
|
that.titleBar.tap(function () {
|
|
41340
41380
|
if (that.collapsed) that.collapse(false);
|
|
41341
41381
|
else that.collapse(true);
|
|
41342
|
-
}, null, null, null, true, null, null, null, null, false);
|
|
41382
|
+
}, null, null, null, true, null, null, null, null, false, true);
|
|
41343
41383
|
// that.collapseEvent = dragger.on("dblclick", function () {
|
|
41344
41384
|
// if (that.collapsed) that.collapse(false);
|
|
41345
41385
|
// else that.collapse(true);
|
|
@@ -50152,16 +50192,16 @@ RETURNS obj for chaining
|
|
|
50152
50192
|
};//-47.76
|
|
50153
50193
|
|
|
50154
50194
|
/*--
|
|
50155
|
-
obj.tap = function(call, distance, time, once, dbl, dblTime, call2, call3, call4)
|
|
50195
|
+
obj.tap = function(call, distance, time, once, dbl, dblTime, call2, call3, call4, cursor, mobileUp)
|
|
50156
50196
|
|
|
50157
50197
|
tap
|
|
50158
50198
|
zim DisplayObject method
|
|
50159
50199
|
|
|
50160
50200
|
DESCRIPTION
|
|
50161
50201
|
Chainable convenience method that adds a mousedown and mouseup event to the object
|
|
50162
|
-
that requires the to move less than distance parameter
|
|
50202
|
+
that requires the mouse to move less than distance parameter
|
|
50163
50203
|
This is more like a proper click - down up without dragging.
|
|
50164
|
-
This method works on desktop or mobile, etc.
|
|
50204
|
+
This method works on desktop or mobile, etc. but on mobile, the default tap is mousedown
|
|
50165
50205
|
An optional time parameter is provided if a minimum time is desired.
|
|
50166
50206
|
Note that a click event also works on mobile as a "tap"
|
|
50167
50207
|
but click also allows dragging between down and up presses - so really is a mouseup.
|
|
@@ -50223,11 +50263,12 @@ call2 - (default null) a function to call on pressup if a tap is not made
|
|
|
50223
50263
|
call3 - (default null) with dbl set to true, a function to call on single tap regardless of a double tap or not
|
|
50224
50264
|
call4 - (default null) with dbl set to true, a function to call on single tap only if double tap fails
|
|
50225
50265
|
cursor - (default pointer) set to a CSS cursor or false if not wanting to set cursor on tap
|
|
50266
|
+
mobileUp - (default false) set to true to make tap() work on pressup on mobile - by default tap on mobile works on mousedown
|
|
50226
50267
|
|
|
50227
50268
|
RETURNS obj for chaining
|
|
50228
50269
|
--*///+47.8
|
|
50229
|
-
zim.tap = function(obj, call, distance, time, once, dbl, dblTime, call2, call3, call4, cursor) {
|
|
50230
|
-
var sig = "obj, call, distance, time, once, dbl, dblTime, call2, call3, call4, cursor";
|
|
50270
|
+
zim.tap = function(obj, call, distance, time, once, dbl, dblTime, call2, call3, call4, cursor, mobileUp) {
|
|
50271
|
+
var sig = "obj, call, distance, time, once, dbl, dblTime, call2, call3, call4, cursor, mobileUp";
|
|
50231
50272
|
var duo; if (duo = zob(zim.tap, arguments, sig)) return duo;
|
|
50232
50273
|
z_d("47.8");
|
|
50233
50274
|
if (zot(obj) || zot(call) || typeof call != "function") return;
|
|
@@ -50305,23 +50346,33 @@ RETURNS obj for chaining
|
|
|
50305
50346
|
var local = e.currentTarget.globalToLocal(e.stageX / zim.scaX, e.stageY / zim.scaY);
|
|
50306
50347
|
if (local.y <= 0) return; // avoid titleBar and organizer
|
|
50307
50348
|
}
|
|
50308
|
-
|
|
50309
|
-
|
|
50310
|
-
|
|
50311
|
-
|
|
50312
|
-
|
|
50313
|
-
|
|
50314
|
-
|
|
50315
|
-
|
|
50316
|
-
|
|
50317
|
-
|
|
50318
|
-
|
|
50319
|
-
|
|
50320
|
-
|
|
50321
|
-
|
|
50322
|
-
|
|
50323
|
-
|
|
50324
|
-
|
|
50349
|
+
if (M && !mobileUp && e.currentTarget.type != "List") {
|
|
50350
|
+
if (obj.excludeTap) return;
|
|
50351
|
+
call(e);
|
|
50352
|
+
if (once) {
|
|
50353
|
+
obj.off("mousedown", obj.zimClickDownEvent);
|
|
50354
|
+
obj.zimClickDownEvent = null;
|
|
50355
|
+
if (obj.cursor) obj.cur("default");
|
|
50356
|
+
}
|
|
50357
|
+
} else {
|
|
50358
|
+
var lastX = e.stageX / zim.scaX;
|
|
50359
|
+
var lastY = e.stageY / zim.scaY;
|
|
50360
|
+
var startTime = Date.now();
|
|
50361
|
+
obj.zimClickUpEvent = obj.on("pressup", function (e) {
|
|
50362
|
+
// commented does not work on 45 degree - hahaha - was still activating tap on 45 degree sliding list
|
|
50363
|
+
// if (Math.abs(lastX + lastY - e.stageX / zim.scaX - e.stageY / zim.scaY) < distance && Date.now() - startTime < (timeType=="s"?time*1000:time)) {
|
|
50364
|
+
if (Math.abs(lastX - e.stageX / zim.scaX) < distance && Math.abs(lastY - e.stageY / zim.scaY) < distance && Date.now() - startTime < (timeType=="s"?time*1000:time)) {
|
|
50365
|
+
if (obj.excludeTap) return;
|
|
50366
|
+
call(e);
|
|
50367
|
+
if (once) {
|
|
50368
|
+
obj.off("mousedown", obj.zimClickDownEvent);
|
|
50369
|
+
obj.zimClickDownEvent = null;
|
|
50370
|
+
if (obj.cursor) obj.cur("default");
|
|
50371
|
+
}
|
|
50372
|
+
} else if (call2) call2(e);
|
|
50373
|
+
e.remove();
|
|
50374
|
+
});
|
|
50375
|
+
}
|
|
50325
50376
|
});
|
|
50326
50377
|
}
|
|
50327
50378
|
|
|
@@ -59625,6 +59676,7 @@ RETURNS obj for chaining
|
|
|
59625
59676
|
zim.expand = function(obj, padding, paddingV, paddingRight, paddingBottom) {
|
|
59626
59677
|
var sig = "obj, padding, paddingV, paddingRight, paddingBottom";
|
|
59627
59678
|
var duo; if (duo = zob(zim.expand, arguments, sig)) return duo;
|
|
59679
|
+
if (obj.type=="AC"&&WW.zdf) {WW.zdf.ac("expand", arguments); return obj;}
|
|
59628
59680
|
z_d("50");
|
|
59629
59681
|
if (zot(obj) || !obj.getBounds || !obj.getBounds()) {zogy("zim methods - expand(): please provide object with bounds set"); return obj;}
|
|
59630
59682
|
if (zot(padding)) padding = 20;
|
|
@@ -64892,6 +64944,7 @@ note: the item is not the event object target - as that is the tile
|
|
|
64892
64944
|
if (zot(backdropPaddingH)) backdropPaddingH = DS.backdropPaddingH!=null?DS.backdropPaddingH:!zot(backdropColor)?backdropPadding:0;
|
|
64893
64945
|
if (zot(backdropPaddingV)) backdropPaddingV = DS.backdropPaddingV!=null?DS.backdropPaddingV:!zot(backdropColor)?backdropPadding:0;
|
|
64894
64946
|
if (backdropPaddingV || backdropPaddingH) backdropPadding = true; // numbers only used from H and V values
|
|
64947
|
+
if (zot(exact)) exact = DS.exact!=null?DS.exact:null;
|
|
64895
64948
|
if (zot(mat)) mat = DS.mat!=null?DS.mat:false;
|
|
64896
64949
|
|
|
64897
64950
|
var that = this;
|
|
@@ -78376,6 +78429,7 @@ dispatches a "pause" event when the Dynamo is paused - could be delayed
|
|
|
78376
78429
|
var frames = this.frames = sprite.parseFrames(label, startFrame, endFrame, true); // last true is fromDynamo
|
|
78377
78430
|
if (frames.length == 0) return;
|
|
78378
78431
|
this.totalFrames = frames.length;
|
|
78432
|
+
if (startFrame==null) sprite.frame = 0;
|
|
78379
78433
|
var _frame = 0; // frame for getter and setter methods
|
|
78380
78434
|
if (zot(speed)) speed = DS.speed!=null?DS.speed:30;
|
|
78381
78435
|
if (zot(reversible)) reversible = DS.reversible!=null?DS.reversible:true;
|
|
@@ -81073,7 +81127,7 @@ borderWidth - |ZIM VEE| (default depends on penType) the thickness of a line dow
|
|
|
81073
81127
|
end - (default "butt") the cap type as a String "butt", "square", "round" - from CreateJS
|
|
81074
81128
|
paper - (default null) a ZIM Container to hold the drawing - or Pen will make a Container to use
|
|
81075
81129
|
see also the paper property to change containers - for layers in a drawing for instance
|
|
81076
|
-
nib - (default null) an optional DisplayObject that will be used as the pen - would suggest
|
|
81130
|
+
nib - (default null) an optional DisplayObject that will be used as the pen - would suggest reg(CENTER) for this
|
|
81077
81131
|
cache - (default true) caches drawing in a Bitmap (improves performance) - set to false to not cache - the paper property points to the Bitmap or the Shape depending
|
|
81078
81132
|
ctrlKey - (default true) turns off drawing when CTRL key is being pressed. Set to false to not turn off drawing when the CTRL key is pressed
|
|
81079
81133
|
cropScale - (default 1) number times stage dimensions image will be cropped
|
|
@@ -89287,7 +89341,7 @@ END EXAMPLE
|
|
|
89287
89341
|
zim[zim.colors[z_i]] = zim.colorsHex[z_i];
|
|
89288
89342
|
}
|
|
89289
89343
|
// zim.red = "#fb4758"; // red dedicated to Alexa
|
|
89290
|
-
// zim.salmon = "#
|
|
89344
|
+
// zim.salmon = "#fa8072";
|
|
89291
89345
|
// zim.orange = "#f58e25";
|
|
89292
89346
|
// zim.yellow = "#ebcb35";
|
|
89293
89347
|
// zim.green = "#acd241";
|
|
@@ -90293,9 +90347,9 @@ function zimify(obj, a, b, c, d, list) {
|
|
|
90293
90347
|
noMovement:function() {
|
|
90294
90348
|
return zim.noMovement(this);
|
|
90295
90349
|
},
|
|
90296
|
-
tap:function(call, distance, time, once, dbl, dblTime, call2, call3, call4, cursor) {
|
|
90350
|
+
tap:function(call, distance, time, once, dbl, dblTime, call2, call3, call4, cursor, mobileUp) {
|
|
90297
90351
|
if (isDUO(arguments)) {arguments[0].obj = this; return zim.tap(arguments[0]);}
|
|
90298
|
-
else {return zim.tap(this, call, distance, time, once, dbl, dblTime, call2, call3, call4, cursor);}
|
|
90352
|
+
else {return zim.tap(this, call, distance, time, once, dbl, dblTime, call2, call3, call4, cursor, mobileUp);}
|
|
90299
90353
|
},
|
|
90300
90354
|
noTap:function() {
|
|
90301
90355
|
return zim.noTap(this);
|
|
@@ -2470,8 +2470,8 @@ declare namespace zim {
|
|
|
2470
2470
|
scrollEnabled: boolean
|
|
2471
2471
|
}
|
|
2472
2472
|
export class Stepper extends Container implements zimComponent {
|
|
2473
|
-
constructor(config_or_list?: string[] | number[], width?: number, backgroundColor?: color, borderColor?: color, borderWidth?: number, label?: Label, color?: color, vertical?: boolean, arrows?: number, corner?: number | any[], shadowColor?: color, shadowBlur?: number,
|
|
2474
|
-
constructor(config: { list?: string[] | number[], width?: number, backgroundColor?: color, borderColor?: color, borderWidth?: number, label?: Label, color?: color, vertical?: boolean, arrows?: number, corner?: number | any[], shadowColor?: color, shadowBlur?: number,
|
|
2473
|
+
constructor(config_or_list?: string[] | number[], width?: number, backgroundColor?: color, borderColor?: color, borderWidth?: number, label?: Label, color?: color, vertical?: boolean, arrows?: number, corner?: number | any[], shadowColor?: color, shadowBlur?: number, continuous?: boolean, display?: boolean, press?: boolean, hold?: boolean, holdDelay?: number, holdSpeed?: number, draggable?: boolean, dragSensitivity?: number, dragRange?: number, stepperType?: string, min?: number, max?: number, step?: number, step2?: number, arrows2?: boolean, arrows2Scale?: number, keyEnabled?: boolean, keyArrows?: number, rightForward?: boolean, downForward?: boolean, index?: number, value?: string | number, arrowColor?: color, arrowScale?: number, selectedIndex?: number, currentValue?: string | number, style?: boolean, group?: string, inherit?: {})
|
|
2474
|
+
constructor(config: { list?: string[] | number[], width?: number, backgroundColor?: color, borderColor?: color, borderWidth?: number, label?: Label, color?: color, vertical?: boolean, arrows?: number, corner?: number | any[], shadowColor?: color, shadowBlur?: number, continuous?: boolean, display?: boolean, press?: boolean, hold?: boolean, holdDelay?: number, holdSpeed?: number, draggable?: boolean, dragSensitivity?: number, dragRange?: number, stepperType?: string, min?: number, max?: number, step?: number, step2?: number, arrows2?: boolean, arrows2Scale?: number, keyEnabled?: boolean, keyArrows?: number, rightForward?: boolean, downForward?: boolean, index?: number, value?: string | number, arrowColor?: color, arrowScale?: number, selectedIndex?: number, currentValue?: string | number, style?: boolean, group?: string, inherit?: {} })
|
|
2475
2475
|
// ZIM Component Interface
|
|
2476
2476
|
// dispose():boolean // now added to Container, etc.
|
|
2477
2477
|
enabled: boolean
|
|
@@ -2482,7 +2482,7 @@ declare namespace zim {
|
|
|
2482
2482
|
selectedIndex: number
|
|
2483
2483
|
value: string | number
|
|
2484
2484
|
currentValue: string | number
|
|
2485
|
-
|
|
2485
|
+
valueEvent: string | number
|
|
2486
2486
|
stepperArray: string[] | number[]
|
|
2487
2487
|
containerPrev: Container
|
|
2488
2488
|
containerNext: Container
|
|
@@ -2496,6 +2496,7 @@ declare namespace zim {
|
|
|
2496
2496
|
max: number
|
|
2497
2497
|
label: Label
|
|
2498
2498
|
textBox: Shape
|
|
2499
|
+
continuous: boolean
|
|
2499
2500
|
keyFocus: boolean
|
|
2500
2501
|
}
|
|
2501
2502
|
export class Slider extends Container implements zimComponent {
|