zimjs 16.4.1 → 16.4.2
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 +56 -29
package/package.json
CHANGED
package/src/zim.js
CHANGED
|
@@ -2178,6 +2178,8 @@ If more data is required, use an AJAX library
|
|
|
2178
2178
|
NOTE: async uses an r CGI key to send a random number to defeat cache.
|
|
2179
2179
|
Do not send an r property
|
|
2180
2180
|
|
|
2181
|
+
SEE: https://codepen.io/danzen/pen/gNKQYY for a full example
|
|
2182
|
+
|
|
2181
2183
|
NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
|
|
2182
2184
|
|
|
2183
2185
|
EXAMPLE
|
|
@@ -2197,8 +2199,7 @@ async("https://zimjs.org/cdn/jsonp.php?api="+api+"&callback=async.getData", getD
|
|
|
2197
2199
|
function getData(data) {
|
|
2198
2200
|
zog(data); // data will be the JSON parsed object
|
|
2199
2201
|
}
|
|
2200
|
-
|
|
2201
|
-
Here is the jsonp.php code if you would like to host:
|
|
2202
|
+
// Here is the jsonp.php code if you would like to host:
|
|
2202
2203
|
|
|
2203
2204
|
<?php
|
|
2204
2205
|
$api = $_GET["api"];
|
|
@@ -14740,8 +14741,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
14740
14741
|
|
|
14741
14742
|
var poly = this.shape = new createjs.Shape();
|
|
14742
14743
|
this.addChild(poly);
|
|
14743
|
-
|
|
14744
|
-
|
|
14744
|
+
|
|
14745
14745
|
var g = poly.graphics;
|
|
14746
14746
|
that.drawShape = function() {
|
|
14747
14747
|
g.c();
|
|
@@ -14757,7 +14757,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
14757
14757
|
if (that._dashed) that.borderDashedCommand = g.sd(Array.isArray(that._dashed)?that._dashed:[10, 10], that._dashedOffset).command;
|
|
14758
14758
|
}
|
|
14759
14759
|
}
|
|
14760
|
-
g.dp(0,0,that._radius, that._sides, that._pointSize);
|
|
14760
|
+
g.dp(0,0,that._radius, that._sides, that._pointSize, -90);
|
|
14761
14761
|
that.setBounds(-that._radius,-that._radius, that._radius*2, that._radius*2);
|
|
14762
14762
|
};
|
|
14763
14763
|
that.drawShape();
|
|
@@ -22482,6 +22482,17 @@ const letters = new LabelLetters("Label Letters", CENTER, "bottom", 5)
|
|
|
22482
22482
|
});
|
|
22483
22483
|
END EXAMPLE
|
|
22484
22484
|
|
|
22485
|
+
EXAMPLE
|
|
22486
|
+
new LabelLetters("and Radial(), LabelOnArc(), LabelLetters()")
|
|
22487
|
+
.center()
|
|
22488
|
+
.animate({
|
|
22489
|
+
from:true,
|
|
22490
|
+
props:{alpha:0},
|
|
22491
|
+
time:.01,
|
|
22492
|
+
sequence:.04
|
|
22493
|
+
});
|
|
22494
|
+
END EXAMPLE
|
|
22495
|
+
|
|
22485
22496
|
PARAMETERS
|
|
22486
22497
|
** supports DUO - parameters or single object with properties below
|
|
22487
22498
|
** supports OCT - parameter defaults can be set with STYLE control (like CSS)
|
|
@@ -22544,6 +22555,7 @@ addChild(), removeChild(), addChildAt(), getChildAt(), contains(), removeAllChil
|
|
|
22544
22555
|
PROPERTIES
|
|
22545
22556
|
type - the name of the class as a String
|
|
22546
22557
|
text - get the text of the original Label
|
|
22558
|
+
See: https://zimjs.com/zapp/Z_VSR9X for updating text
|
|
22547
22559
|
labels - an array of ZIM Label objects for the letters
|
|
22548
22560
|
numLetters - how many letters (same as numChildren)
|
|
22549
22561
|
|
|
@@ -25732,7 +25744,7 @@ EXAMPLE
|
|
|
25732
25744
|
// good for games that need keyboard if the game is in an iFrame like the Editor or CodePen
|
|
25733
25745
|
// NOTE: do not use the on("close", f) method as it will not receive an event
|
|
25734
25746
|
// with keyboardAccess the events on the canvas are turned off and captured in an any iFrame
|
|
25735
|
-
new Pane({content:"START", keyboardAccess:true}).show();
|
|
25747
|
+
new Pane({content:"START", keyboardAccess:true}).show(()=>{zog("Keys ready")});
|
|
25736
25748
|
END EXAMPLE
|
|
25737
25749
|
|
|
25738
25750
|
EXAMPLE
|
|
@@ -25783,7 +25795,7 @@ END EXAMPLE
|
|
|
25783
25795
|
|
|
25784
25796
|
EXAMPLE
|
|
25785
25797
|
// custom backing with ZIM Pizzazz import at top
|
|
25786
|
-
// import zim from https://zimjs.org/cdn/
|
|
25798
|
+
// import zim from "https://zimjs.org/cdn/016/zim_pizzazz"
|
|
25787
25799
|
new Pane({
|
|
25788
25800
|
content:new Label({color:white, text:"STOP", size:50}),
|
|
25789
25801
|
backing:makePattern({
|
|
@@ -25849,6 +25861,7 @@ keyboardAccess - (default false) set to true to adds a click through iframe to g
|
|
|
25849
25861
|
this sets an invisible Frame keyboardMessage() that will close the pane and give key access to iFrames
|
|
25850
25862
|
do not use if expecting interactive content in the Pane - it is for a start message only
|
|
25851
25863
|
do not use on("close", f) as it will not be captured with keyboardAccess true
|
|
25864
|
+
instead, use the callback in show() to call a function on close
|
|
25852
25865
|
style - (default true) set to false to ignore styles set with the STYLE - will receive original parameter defaults
|
|
25853
25866
|
group - (default null) set to String (or comma delimited String) so STYLE can set default styles to the group(s) (like a CSS class)
|
|
25854
25867
|
inherit - (default null) used internally but can receive an {} of styles directly
|
|
@@ -41392,12 +41405,12 @@ dropArray - (defult null) with "on" or "single" dropType and NOT linear - specif
|
|
|
41392
41405
|
if "single" is set then only one line can be drawn
|
|
41393
41406
|
also see dropIndex and dropArray for each node and the targetNode property
|
|
41394
41407
|
each time a connection is made, a new node is created - these will inherit the dropIndex and dropArray from a targetNode
|
|
41395
|
-
and if the latestNode's dropArray and its lineArray are the same and the
|
|
41408
|
+
and if the latestNode's dropArray and its lineArray are the same and the duplicateLine is false then a "blocked" event is dispatched
|
|
41396
41409
|
continuous - (default false) set to true to force nodes to only be made from the last node
|
|
41397
41410
|
all other nodes will have their noMouse() set - also see startIndex - also see linear for doing points in order
|
|
41398
41411
|
startIndex - (default null) set to a point index to force connectors to start at that node
|
|
41399
41412
|
all other nodes will have there noMouse() set - also see continous
|
|
41400
|
-
|
|
41413
|
+
duplicateLine - (default true) set to false to not allow multiple lines between the same connectors
|
|
41401
41414
|
deleteNode - (default true) set to false to not allow nodes to be deleted by holding or doubleclicking and delete key
|
|
41402
41415
|
dblclick - (default true) set to false to not allow nodes to be selected by doubleclicking
|
|
41403
41416
|
selected nodes can be moved together
|
|
@@ -41487,11 +41500,11 @@ node - the DisplayObject used to make the connector nodes
|
|
|
41487
41500
|
dropArray - get or set the array of dropIndexes that this node can connect to
|
|
41488
41501
|
this will get transfered from a targerNode
|
|
41489
41502
|
and if the dropArray and the lineArray are the same
|
|
41490
|
-
and the
|
|
41503
|
+
and the duplicateLine is false then a "blocked" event is dispatched
|
|
41491
41504
|
lineArray - get an array of indexes to other node connections
|
|
41492
41505
|
this will get transfered to a targetNode
|
|
41493
41506
|
and if the lineArray and dropArray are the same
|
|
41494
|
-
and the
|
|
41507
|
+
and the duplicateLine is false then a "blocked" event is dispatched
|
|
41495
41508
|
line - the Line object used to make the connector lines
|
|
41496
41509
|
the line objects also have these added properties:
|
|
41497
41510
|
node - a reference to the node at the start of the line
|
|
@@ -41529,7 +41542,7 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
41529
41542
|
EVENTS
|
|
41530
41543
|
dispatches a "connection" event if a new node is made and lastNode property is set to the new node
|
|
41531
41544
|
dispatches a "noconnection" event if the connector is dropped and no new node is made
|
|
41532
|
-
dispatches a "blocked" event of
|
|
41545
|
+
dispatches a "blocked" event of duplicateLine is false and continuous is true and there are no more connections available
|
|
41533
41546
|
this will happen if the latestNode's dropArray is the same as its linesArray (the order in the array does not matter)
|
|
41534
41547
|
dispatches a "complete" event in linear mode when the connections are complete
|
|
41535
41548
|
|
|
@@ -41871,13 +41884,15 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
41871
41884
|
var downIndex;
|
|
41872
41885
|
function downNode(e, stepping, moving, ctrl) {
|
|
41873
41886
|
var child = e.target;
|
|
41874
|
-
if (zot(child)) return;
|
|
41887
|
+
if (zot(child)) return;
|
|
41888
|
+
// if (child.selected) return;
|
|
41875
41889
|
|
|
41876
41890
|
if (moving) {
|
|
41877
41891
|
child.selected = true;
|
|
41878
41892
|
selectedList = [];
|
|
41879
41893
|
that.selectNode(child, !ctrl);
|
|
41880
41894
|
}
|
|
41895
|
+
|
|
41881
41896
|
|
|
41882
41897
|
downIndex = child.nodeNum; // used in record()
|
|
41883
41898
|
if (!linear && (!rootLock || child.creator) && dblclick && !stepping) {
|
|
@@ -41993,6 +42008,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
41993
42008
|
parent.creations.push(child);
|
|
41994
42009
|
that.latestNode = child;
|
|
41995
42010
|
|
|
42011
|
+
if (rootLock) checkRootLock(child);
|
|
42012
|
+
|
|
42013
|
+
|
|
41996
42014
|
}
|
|
41997
42015
|
|
|
41998
42016
|
function moveNode(e, stepping, moving, ctrl) {
|
|
@@ -51995,7 +52013,7 @@ animateCall - (default null) calls function every animation
|
|
|
51995
52013
|
animateParams - (default target) parameters to send animateCall function
|
|
51996
52014
|
sequence - (default 0) the delay time in seconds to run on children of a container or an array of target animations
|
|
51997
52015
|
with the addition of ZIM VEE object to the target, you must noPick the array
|
|
51998
|
-
for example, target = container or target = {noPick:[a,b,c]} and sequence =
|
|
52016
|
+
for example, target = container or target = {noPick:[a,b,c]} and sequence = 1
|
|
51999
52017
|
would run the animation on the first child and then 1 second later, run the animation on the second child, etc.
|
|
52000
52018
|
or in the case of the array, on element a and then 1 second later, element b, etc.
|
|
52001
52019
|
If the loop prop is true then sequenceCall below would activate for each loop
|
|
@@ -60481,7 +60499,6 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60481
60499
|
heights.push(totalY);
|
|
60482
60500
|
//}
|
|
60483
60501
|
currentCols = [];
|
|
60484
|
-
|
|
60485
60502
|
|
|
60486
60503
|
if (bottomFull || fl) {
|
|
60487
60504
|
o.pos(totalX+(o.marginRight?o.marginRight:0), totalY+(o.marginTop?o.marginTop:0), zim.RIGHT, fl?zim.TOP:zim.BOTTOM);
|
|
@@ -68872,11 +68889,10 @@ mousedownIncludes - (default null) a single object or array of objects (aside fr
|
|
|
68872
68889
|
The controller assumes everything in the container will not activate the mousedown
|
|
68873
68890
|
This lets you activate interface elements without moving to them ;-)
|
|
68874
68891
|
If for instance, a backing is used other than the stage, just pass in the backing to this parameter
|
|
68875
|
-
See also the mousedownIncludes property
|
|
68892
|
+
See also the mousedownIncludes property
|
|
68876
68893
|
The boundary is automatically added to mousedownIncludes
|
|
68877
68894
|
If the container is provided and it has a backing property, this is added automatically to the mouseDownIncludes at the start
|
|
68878
68895
|
The backing can be removed from the mousedownIncludes property with mc.mousedownIncludes.splice(mc.mousedownIncludes.indexOf(mc.container.backing, 1));
|
|
68879
|
-
mousedownExcludes - (default null) an array of objects that the mousedown will not work on - overrides mousedownIncludes
|
|
68880
68896
|
minPercentSpeed - (default 0) if target is an Accelerator, the percentSpeed at the left or top of the stage (depending on axis)
|
|
68881
68897
|
minPercentSpeed - (default 100) if target is an Accelerator, the percentSpeed at the right or bottom of the stage (depending on axis)
|
|
68882
68898
|
dampKeyup - (default .3) damping applied to slow down Accelerator with keydown
|
|
@@ -70118,7 +70134,7 @@ EXAMPLE
|
|
|
70118
70134
|
// this is like a mousejoint similar to drag() but attached to an object rather than the mouse
|
|
70119
70135
|
// so a physics object can follow a ZIM drag() or animate() or wiggle(), etc.
|
|
70120
70136
|
// the original distance between the objects is maintained like a distance joint
|
|
70121
|
-
// see https://zimjs.com/valentines/
|
|
70137
|
+
// see https://zimjs.com/valentines/puppets.html
|
|
70122
70138
|
// see https://zimjs.com/valentines/puppets2.html
|
|
70123
70139
|
const physics = new Physics(0);
|
|
70124
70140
|
const control = new Triangle().center().mov(0,-100).drag(); // or animate() or wiggle()
|
|
@@ -82422,7 +82438,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
82422
82438
|
}
|
|
82423
82439
|
}
|
|
82424
82440
|
|
|
82425
|
-
function svgDone(bitmap, params) {
|
|
82441
|
+
function svgDone(bitmap, params) {
|
|
82426
82442
|
queue.loadAssetsCount--;
|
|
82427
82443
|
var item = params.item;
|
|
82428
82444
|
var asset = zim.assets[item.id] = bitmap;
|
|
@@ -82456,8 +82472,9 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
82456
82472
|
preload.on("error", function(e) {queue.dispatchEvent(e); if (!queueOnly) that.dispatchEvent(e);});
|
|
82457
82473
|
preload.on("fileload", function(e) {
|
|
82458
82474
|
// for some reason, errors are not working on IMG and SVG from PreloadJS
|
|
82459
|
-
// so check for rawResult - should really fix this in CreateJS
|
|
82460
|
-
if (!e.result || ((e.result.nodeName=="IMG" || e.result.nodeName=="SVG") && !e.rawResult && xhr)) {
|
|
82475
|
+
// so check for rawResult - should really fix this in CreateJS
|
|
82476
|
+
if (!e.result || ((e.result.nodeName=="IMG" || e.result.nodeName=="SVG") && !e.rawResult && xhr)) {
|
|
82477
|
+
zog("here")
|
|
82461
82478
|
var ev = new createjs.Event("error");
|
|
82462
82479
|
ev = new createjs.Event("error");
|
|
82463
82480
|
ev.item = e.item; // createjs preload item
|
|
@@ -82466,7 +82483,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
82466
82483
|
ev = new createjs.Event("error");
|
|
82467
82484
|
ev.item = e.item;
|
|
82468
82485
|
that.dispatchEvent(ev);
|
|
82469
|
-
} else {
|
|
82486
|
+
} else {
|
|
82470
82487
|
var item = e.item;
|
|
82471
82488
|
var type = e.item.type;
|
|
82472
82489
|
var ext = item.id.match(re);
|
|
@@ -82530,7 +82547,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
82530
82547
|
}
|
|
82531
82548
|
} else if (type == "svg") {
|
|
82532
82549
|
queue.loadAssetsCount++;
|
|
82533
|
-
zim.svgToBitmap(e.result, svgDone, null, null, {svg:e.result, item:item, type:type, ext:ext});
|
|
82550
|
+
zim.svgToBitmap(e.result, svgDone, null, null, {svg:e.result, item:item, type:type, ext:ext});
|
|
82534
82551
|
return;
|
|
82535
82552
|
} else {
|
|
82536
82553
|
asset = zim.assets[item.id] = e.result;
|
|
@@ -85966,7 +85983,7 @@ RETURNS - null
|
|
|
85966
85983
|
--*///+83.27
|
|
85967
85984
|
zim.svgToBitmap = function(svg, callback, width, height, params) {
|
|
85968
85985
|
z_d("83.27");
|
|
85969
|
-
|
|
85986
|
+
|
|
85970
85987
|
if (!zot(svg.draggable)) {
|
|
85971
85988
|
// CreateJS seems to wrap up an SVG with loadAssets as an SVG object
|
|
85972
85989
|
var parser = new DOMParser();
|
|
@@ -85977,8 +85994,10 @@ RETURNS - null
|
|
|
85977
85994
|
}
|
|
85978
85995
|
|
|
85979
85996
|
if (!XMLSerializer) {if (zon) {zogy("ZIM svgToBitmap() - sorry, not supported in Browser"); return;}}
|
|
85980
|
-
var svgString = (typeof svg == "string") ? svg : new XMLSerializer().serializeToString(svg);
|
|
85997
|
+
var svgString = (typeof svg == "string") ? svg : new XMLSerializer().serializeToString(svg);
|
|
85981
85998
|
if (svgString) {
|
|
85999
|
+
// https does not work
|
|
86000
|
+
svgString = svgString.replace(/https:\/\/www.w3/i, "http://www.w3");
|
|
85982
86001
|
// seem to need width and height parameters in svg tag
|
|
85983
86002
|
var first = svgString.split(">")[0];
|
|
85984
86003
|
if (first.length>1) {
|
|
@@ -86001,19 +86020,27 @@ RETURNS - null
|
|
|
86001
86020
|
svgString = svgString.replace(/svg /i, "svg width=\""+w+"\" height=\""+h+"\" ");
|
|
86002
86021
|
}
|
|
86003
86022
|
}
|
|
86004
|
-
if (!svgString.match(/xmlns/i)) svgString = svgString.replace(/svg /i, "svg xmlns='
|
|
86023
|
+
if (!svgString.match(/xmlns/i)) svgString = svgString.replace(/svg /i, "svg xmlns='http://www.w3.org/2000/svg' ");
|
|
86005
86024
|
}
|
|
86006
86025
|
var DOMURL = self.URL || self.webkitURL || self;
|
|
86026
|
+
var inte = setTimeout(function() {
|
|
86027
|
+
zogy("ZIM SVG() could not be made");
|
|
86028
|
+
callback(new zim.Bitmap(), params);
|
|
86029
|
+
DOMURL.revokeObjectURL(obu);
|
|
86030
|
+
}, 100);
|
|
86007
86031
|
var img = new Image();
|
|
86008
86032
|
img.onload = function() {
|
|
86033
|
+
clearTimeout(inte);
|
|
86009
86034
|
var bitmap = new zim.Bitmap(img, width, height);
|
|
86010
86035
|
callback(bitmap, params);
|
|
86011
86036
|
DOMURL.revokeObjectURL(obu);
|
|
86012
|
-
};
|
|
86037
|
+
};
|
|
86013
86038
|
var obu;
|
|
86014
|
-
if (document && document.Blob)
|
|
86015
|
-
|
|
86039
|
+
if (document && document.Blob) {
|
|
86040
|
+
obu = DOMURL.createObjectURL(new document.Blob([svgString], {type: "image/svg+xml"}));
|
|
86041
|
+
} else obu = DOMURL.createObjectURL(new Blob([svgString], {type: "image/svg+xml"}));
|
|
86016
86042
|
img.src = obu;
|
|
86043
|
+
|
|
86017
86044
|
};//-83.27
|
|
86018
86045
|
|
|
86019
86046
|
/*--
|