zimjs 16.4.0 → 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 +114 -71
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
|
|
@@ -26909,8 +26922,8 @@ list.items[1].label.text = "Some very long but important option!";
|
|
|
26909
26922
|
|
|
26910
26923
|
list.on("resize", ()=>{
|
|
26911
26924
|
const point = list.resizeHandle.localToGlobal(0,0);
|
|
26912
|
-
|
|
26913
|
-
|
|
26925
|
+
win.resize(list.x+listWidth+windowWidth-point.x);
|
|
26926
|
+
win.x = point.x;
|
|
26914
26927
|
});
|
|
26915
26928
|
|
|
26916
26929
|
const win = new Window({
|
|
@@ -33121,7 +33134,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
33121
33134
|
//-61
|
|
33122
33135
|
|
|
33123
33136
|
/*--
|
|
33124
|
-
zim.Slider = function(min, max, step, button, barLength, barWidth, barColor, vertical, useTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, inside, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, damp, currentValue, expand, expandVertical, expandBar, expandBarVertical, useLabels, labelMargin, labelColor, range, rangeColor, rangeWidth, rangeMin, rangeMax, rangeAve, style, group, inherit)
|
|
33137
|
+
zim.Slider = function(min, max, step, button, barLength, barWidth, barColor, vertical, useTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, inside, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, damp, currentValue, expand, expandVertical, expandBar, expandBarVertical, useLabels, labelMargin, labelColor, range, rangeColor, rangeWidth, rangeMin, rangeMax, rangeAve, addZero, style, group, inherit)
|
|
33125
33138
|
|
|
33126
33139
|
Slider
|
|
33127
33140
|
zim class - extends a zim.Container which extends a createjs.Container
|
|
@@ -33201,6 +33214,7 @@ rangeWidth - (default 3 pixels wider than the barWidth on both sides) set the th
|
|
|
33201
33214
|
rangeMin - (default min) set the minimum value of the range
|
|
33202
33215
|
rangeMax - (default (max-min)/2) set the maximum value of the range
|
|
33203
33216
|
rangeAve - (default null) set the range average value - this may relocate rangeMin and rangeMax settings
|
|
33217
|
+
addZero - (default false) add zero on end of decimals for useLabels true
|
|
33204
33218
|
style - (default true) set to false to ignore styles set with the STYLE - will receive original parameter defaults
|
|
33205
33219
|
group - (default null) set to String (or comma delimited String) so STYLE can set default styles to the group(s) (like a CSS class)
|
|
33206
33220
|
inherit - (default null) used internally but can receive an {} of styles directly
|
|
@@ -33266,8 +33280,8 @@ dispatches a "change" event when button is slid on slider (but not when setting
|
|
|
33266
33280
|
ALSO: see the CreateJS Easel Docs for Container events such as:
|
|
33267
33281
|
added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmove, pressup, removed, rollout, rollover
|
|
33268
33282
|
--*///+62
|
|
33269
|
-
zim.Slider = function(min, max, step, button, barLength, barWidth, barColor, vertical, useTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, inside, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, damp, currentValue, expand, expandVertical, expandBar, expandBarVertical, useLabels, labelMargin, labelColor, range, rangeColor, rangeWidth, rangeMin, rangeMax, rangeAve, style, group, inherit) {
|
|
33270
|
-
var sig = "min, max, step, button, barLength, barWidth, barColor, vertical, useTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, inside, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, damp, currentValue, expand, expandVertical, expandBar, expandBarVertical, useLabels, labelMargin, labelColor, range, rangeColor, rangeWidth, rangeMin, rangeMax, rangeAve, style, group, inherit";
|
|
33283
|
+
zim.Slider = function(min, max, step, button, barLength, barWidth, barColor, vertical, useTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, inside, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, damp, currentValue, expand, expandVertical, expandBar, expandBarVertical, useLabels, labelMargin, labelColor, range, rangeColor, rangeWidth, rangeMin, rangeMax, rangeAve, addZero, style, group, inherit) {
|
|
33284
|
+
var sig = "min, max, step, button, barLength, barWidth, barColor, vertical, useTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, inside, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, damp, currentValue, expand, expandVertical, expandBar, expandBarVertical, useLabels, labelMargin, labelColor, range, rangeColor, rangeWidth, rangeMin, rangeMax, rangeAve, addZero, style, group, inherit";
|
|
33271
33285
|
var duo; if (duo = zob(zim.Slider, arguments, sig, this)) return duo;
|
|
33272
33286
|
z_d("62");
|
|
33273
33287
|
this.zimContainer_constructor(null,null,null,null,false);
|
|
@@ -33317,6 +33331,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
33317
33331
|
if (zot(rangeMin)) rangeMin = DS.rangeMin!=null?DS.rangeMin:currentValue;
|
|
33318
33332
|
if (zot(rangeMax)) rangeMax = DS.rangeMax!=null?DS.rangeMax:(max-min)/2;
|
|
33319
33333
|
if (zot(rangeAve)) rangeAve = DS.rangeAve!=null?DS.rangeAve:null;
|
|
33334
|
+
if (zot(addZero)) addZero = DS.addZero!=null?DS.addZero:false;
|
|
33320
33335
|
var stage;
|
|
33321
33336
|
var that = this;
|
|
33322
33337
|
this.update = function() {};
|
|
@@ -33514,9 +33529,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
33514
33529
|
y = start+spacing*i;
|
|
33515
33530
|
g.mt(0, y).lt(x, y);
|
|
33516
33531
|
if (useLabels && ((semiTicks && tickLarge) || !semiTicks)) {
|
|
33517
|
-
dd = Math.max(zim.countDecimals(step0), zim.countDecimals(min), zim.countDecimals(max));
|
|
33532
|
+
dd = Math.max(zim.countDecimals(step0), zim.countDecimals(min), zim.countDecimals(max));
|
|
33518
33533
|
new zim.Label({
|
|
33519
|
-
text:zim.decimals(max-(max-min)/Math.abs(stepsTotal)*i,dd+1),
|
|
33534
|
+
text:zim.decimals(max-(max-min)/Math.abs(stepsTotal)*i,dd+1,addZero),
|
|
33520
33535
|
size:DS.size?DS.size:10,
|
|
33521
33536
|
color:labelColor,
|
|
33522
33537
|
align:"left",
|
|
@@ -33550,7 +33565,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
33550
33565
|
if (useLabels && ((semiTicks && tickLarge) || !semiTicks)) {
|
|
33551
33566
|
dd = Math.max(zim.countDecimals(step0), zim.countDecimals(min), zim.countDecimals(max));
|
|
33552
33567
|
new zim.Label({
|
|
33553
|
-
text:zim.decimals(min+(max-min)/Math.abs(stepsTotal)*i,dd+1),
|
|
33568
|
+
text:zim.decimals(min+(max-min)/Math.abs(stepsTotal)*i,dd+1,addZero),
|
|
33554
33569
|
size:DS.size?DS.size:10,
|
|
33555
33570
|
color:labelColor,
|
|
33556
33571
|
align:"center",
|
|
@@ -33808,7 +33823,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
33808
33823
|
|
|
33809
33824
|
|
|
33810
33825
|
this.clone = function(exact) {
|
|
33811
|
-
return that.cloneProps(new zim.Slider((exact||!zim.isPick(oa[0]))?that.min:oa[0], (exact||!zim.isPick(oa[1]))?that.max:oa[1], (exact||!zim.isPick(oa[2]))?that.step:oa[2], button.clone(), barLength, barWidth, barColor, vertical, useTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, inside, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, damp, (exact||!zim.isPick(oa[3]))?that.currentValue:oa[3], expand, expandVertical, expandBar, expandBarVertical, useLabels, labelMargin, labelColor, range, rangeColor, rangeWidth, rangeMin, rangeMax, rangeAve, style, this.group, inherit));
|
|
33826
|
+
return that.cloneProps(new zim.Slider((exact||!zim.isPick(oa[0]))?that.min:oa[0], (exact||!zim.isPick(oa[1]))?that.max:oa[1], (exact||!zim.isPick(oa[2]))?that.step:oa[2], button.clone(), barLength, barWidth, barColor, vertical, useTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, inside, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, damp, (exact||!zim.isPick(oa[3]))?that.currentValue:oa[3], expand, expandVertical, expandBar, expandBarVertical, useLabels, labelMargin, labelColor, range, rangeColor, rangeWidth, rangeMin, rangeMax, rangeAve, addZero, style, this.group, inherit));
|
|
33812
33827
|
};
|
|
33813
33828
|
|
|
33814
33829
|
if (range) {
|
|
@@ -34397,7 +34412,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
34397
34412
|
//-62.5
|
|
34398
34413
|
|
|
34399
34414
|
/*--
|
|
34400
|
-
zim.Dial = function(min, max, step, width, backgroundColor, indicatorColor, indicatorScale, indicatorType, useTicks, innerTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, innerCircle, innerScale, innerColor, inner2Color, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, linear, gap, limit, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, continuous, continuousMin, continuousMax, damp, currentValue, useLabels, labelMargin, style, group, inherit);
|
|
34415
|
+
zim.Dial = function(min, max, step, width, backgroundColor, indicatorColor, indicatorScale, indicatorType, useTicks, innerTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, innerCircle, innerScale, innerColor, inner2Color, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, linear, gap, limit, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, continuous, continuousMin, continuousMax, damp, currentValue, useLabels, labelMargin, addZero, style, group, inherit);
|
|
34401
34416
|
|
|
34402
34417
|
Dial
|
|
34403
34418
|
zim class - extends a zim.Container which extends a createjs.Container
|
|
@@ -34473,6 +34488,7 @@ damp - (default null) set to value such as .1 to damp the slider currentValue
|
|
|
34473
34488
|
currentValue - |ZIM VEE| (default min value) - set the currentValue at start
|
|
34474
34489
|
useLabels - (default false) - add Labels to ticks if useTicks is true - can apply STYLE
|
|
34475
34490
|
labelMargin - (default 10) - distance from ticks to Label if useLabels is true
|
|
34491
|
+
addZero - (default false) add zero on end of decimals for useLabels true
|
|
34476
34492
|
style - (default true) set to false to ignore styles set with the STYLE - will receive original parameter defaults
|
|
34477
34493
|
group - (default null) set to String (or comma delimited String) so STYLE can set default styles to the group(s) (like a CSS class)
|
|
34478
34494
|
inherit - (default null) used internally but can receive an {} of styles directly
|
|
@@ -34533,8 +34549,8 @@ dispatches a "change" event when dial changes value (but not when setting curren
|
|
|
34533
34549
|
ALSO: see the CreateJS Easel Docs for Container events such as:
|
|
34534
34550
|
added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmove, pressup, removed, rollout, rollover
|
|
34535
34551
|
--*///+63
|
|
34536
|
-
zim.Dial = function(min, max, step, width, backgroundColor, indicatorColor, indicatorScale, indicatorType, useTicks, innerTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, innerCircle, innerScale, innerColor, inner2Color, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, linear, gap, limit, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, continuous, continuousMin, continuousMax, damp, currentValue, useLabels, labelMargin, style, group, inherit) {
|
|
34537
|
-
var sig = "min, max, step, width, backgroundColor, indicatorColor, indicatorScale, indicatorType, useTicks, innerTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, innerCircle, innerScale, innerColor, inner2Color, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, linear, gap, limit, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, continuous, continuousMin, continuousMax, damp, currentValue, useLabels, labelMargin, style, group, inherit";
|
|
34552
|
+
zim.Dial = function(min, max, step, width, backgroundColor, indicatorColor, indicatorScale, indicatorType, useTicks, innerTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, innerCircle, innerScale, innerColor, inner2Color, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, linear, gap, limit, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, continuous, continuousMin, continuousMax, damp, currentValue, useLabels, labelMargin, addZero, style, group, inherit) {
|
|
34553
|
+
var sig = "min, max, step, width, backgroundColor, indicatorColor, indicatorScale, indicatorType, useTicks, innerTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, innerCircle, innerScale, innerColor, inner2Color, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, linear, gap, limit, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, continuous, continuousMin, continuousMax, damp, currentValue, useLabels, labelMargin, addZero, style, group, inherit";
|
|
34538
34554
|
var duo; if (duo = zob(zim.Dial, arguments, sig, this)) return duo;
|
|
34539
34555
|
z_d("63");
|
|
34540
34556
|
this.zimContainer_constructor(null,null,null,null,false);
|
|
@@ -34582,6 +34598,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
34582
34598
|
if (zot(currentValue)) currentValue = DS.currentValue!=null?DS.currentValue:null;
|
|
34583
34599
|
if (zot(useLabels)) useLabels = DS.useLabels!=null?DS.useLabels:false;
|
|
34584
34600
|
if (zot(labelMargin)) labelMargin = DS.labelMargin!=null?DS.labelMargin:10;
|
|
34601
|
+
if (zot(addZero)) addZero = DS.addZero!=null?DS.addZero:false;
|
|
34585
34602
|
if (limit == false) damp = null;
|
|
34586
34603
|
|
|
34587
34604
|
var that = this;
|
|
@@ -34657,10 +34674,11 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
34657
34674
|
tick.regX = .5;
|
|
34658
34675
|
tick.rotation = (360-360*gap)/(ticksTotal-(gap?1:0)) * i + 360*gap/2;
|
|
34659
34676
|
ticks.addChild(tick);
|
|
34677
|
+
|
|
34660
34678
|
if (useLabels && ((semiTicks && tickLarge) || !semiTicks)) {
|
|
34661
|
-
var dd = Math.max(zim.countDecimals(step0), zim.countDecimals(min), zim.countDecimals(max));
|
|
34679
|
+
var dd = Math.max(zim.countDecimals(step0), zim.countDecimals(min), zim.countDecimals(max));
|
|
34662
34680
|
new zim.Label({
|
|
34663
|
-
text:zim.decimals(min+(max-min)/Math.abs(stepsTotal||ticksTotal)*i,dd+1,
|
|
34681
|
+
text:zim.decimals(min+(max-min)/Math.abs(stepsTotal||ticksTotal)*i,dd+1,addZero),
|
|
34664
34682
|
size:DS.size?DS.size:10,
|
|
34665
34683
|
align:"center",
|
|
34666
34684
|
valign:"center"
|
|
@@ -35077,7 +35095,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
35077
35095
|
|
|
35078
35096
|
if (style!==false) zim.styleTransforms(this, DS);
|
|
35079
35097
|
this.clone = function(exact) {
|
|
35080
|
-
return that.cloneProps(new zim.Dial((exact||!zim.isPick(oa[0]))?that.min:oa[0], (exact||!zim.isPick(oa[1]))?that.max:oa[1], (exact||!zim.isPick(oa[2]))?that.step:oa[2], width, backgroundColor, indicatorColor, indicatorScale, indicatorType, useTicks, innerTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, innerCircle, innerScale, innerColor, inner2Color, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, linear, gap, limit, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, continuous, continuousMin, continuousMax, damp, (exact||!zim.isPick(oa[3]))?that.currentValue:oa[3], useLabels, labelMargin, style, this.group, inherit));
|
|
35098
|
+
return that.cloneProps(new zim.Dial((exact||!zim.isPick(oa[0]))?that.min:oa[0], (exact||!zim.isPick(oa[1]))?that.max:oa[1], (exact||!zim.isPick(oa[2]))?that.step:oa[2], width, backgroundColor, indicatorColor, indicatorScale, indicatorType, useTicks, innerTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, innerCircle, innerScale, innerColor, inner2Color, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, linear, gap, limit, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, continuous, continuousMin, continuousMax, damp, (exact||!zim.isPick(oa[3]))?that.currentValue:oa[3], useLabels, labelMargin, addZero, style, this.group, inherit));
|
|
35081
35099
|
};
|
|
35082
35100
|
|
|
35083
35101
|
this.dispose = function(a,b,disposing) {
|
|
@@ -41387,12 +41405,12 @@ dropArray - (defult null) with "on" or "single" dropType and NOT linear - specif
|
|
|
41387
41405
|
if "single" is set then only one line can be drawn
|
|
41388
41406
|
also see dropIndex and dropArray for each node and the targetNode property
|
|
41389
41407
|
each time a connection is made, a new node is created - these will inherit the dropIndex and dropArray from a targetNode
|
|
41390
|
-
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
|
|
41391
41409
|
continuous - (default false) set to true to force nodes to only be made from the last node
|
|
41392
41410
|
all other nodes will have their noMouse() set - also see startIndex - also see linear for doing points in order
|
|
41393
41411
|
startIndex - (default null) set to a point index to force connectors to start at that node
|
|
41394
41412
|
all other nodes will have there noMouse() set - also see continous
|
|
41395
|
-
|
|
41413
|
+
duplicateLine - (default true) set to false to not allow multiple lines between the same connectors
|
|
41396
41414
|
deleteNode - (default true) set to false to not allow nodes to be deleted by holding or doubleclicking and delete key
|
|
41397
41415
|
dblclick - (default true) set to false to not allow nodes to be selected by doubleclicking
|
|
41398
41416
|
selected nodes can be moved together
|
|
@@ -41482,11 +41500,11 @@ node - the DisplayObject used to make the connector nodes
|
|
|
41482
41500
|
dropArray - get or set the array of dropIndexes that this node can connect to
|
|
41483
41501
|
this will get transfered from a targerNode
|
|
41484
41502
|
and if the dropArray and the lineArray are the same
|
|
41485
|
-
and the
|
|
41503
|
+
and the duplicateLine is false then a "blocked" event is dispatched
|
|
41486
41504
|
lineArray - get an array of indexes to other node connections
|
|
41487
41505
|
this will get transfered to a targetNode
|
|
41488
41506
|
and if the lineArray and dropArray are the same
|
|
41489
|
-
and the
|
|
41507
|
+
and the duplicateLine is false then a "blocked" event is dispatched
|
|
41490
41508
|
line - the Line object used to make the connector lines
|
|
41491
41509
|
the line objects also have these added properties:
|
|
41492
41510
|
node - a reference to the node at the start of the line
|
|
@@ -41524,7 +41542,7 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
41524
41542
|
EVENTS
|
|
41525
41543
|
dispatches a "connection" event if a new node is made and lastNode property is set to the new node
|
|
41526
41544
|
dispatches a "noconnection" event if the connector is dropped and no new node is made
|
|
41527
|
-
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
|
|
41528
41546
|
this will happen if the latestNode's dropArray is the same as its linesArray (the order in the array does not matter)
|
|
41529
41547
|
dispatches a "complete" event in linear mode when the connections are complete
|
|
41530
41548
|
|
|
@@ -41866,13 +41884,15 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
41866
41884
|
var downIndex;
|
|
41867
41885
|
function downNode(e, stepping, moving, ctrl) {
|
|
41868
41886
|
var child = e.target;
|
|
41869
|
-
if (zot(child)) return;
|
|
41887
|
+
if (zot(child)) return;
|
|
41888
|
+
// if (child.selected) return;
|
|
41870
41889
|
|
|
41871
41890
|
if (moving) {
|
|
41872
41891
|
child.selected = true;
|
|
41873
41892
|
selectedList = [];
|
|
41874
41893
|
that.selectNode(child, !ctrl);
|
|
41875
41894
|
}
|
|
41895
|
+
|
|
41876
41896
|
|
|
41877
41897
|
downIndex = child.nodeNum; // used in record()
|
|
41878
41898
|
if (!linear && (!rootLock || child.creator) && dblclick && !stepping) {
|
|
@@ -41988,6 +42008,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
41988
42008
|
parent.creations.push(child);
|
|
41989
42009
|
that.latestNode = child;
|
|
41990
42010
|
|
|
42011
|
+
if (rootLock) checkRootLock(child);
|
|
42012
|
+
|
|
42013
|
+
|
|
41991
42014
|
}
|
|
41992
42015
|
|
|
41993
42016
|
function moveNode(e, stepping, moving, ctrl) {
|
|
@@ -51990,7 +52013,7 @@ animateCall - (default null) calls function every animation
|
|
|
51990
52013
|
animateParams - (default target) parameters to send animateCall function
|
|
51991
52014
|
sequence - (default 0) the delay time in seconds to run on children of a container or an array of target animations
|
|
51992
52015
|
with the addition of ZIM VEE object to the target, you must noPick the array
|
|
51993
|
-
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
|
|
51994
52017
|
would run the animation on the first child and then 1 second later, run the animation on the second child, etc.
|
|
51995
52018
|
or in the case of the array, on element a and then 1 second later, element b, etc.
|
|
51996
52019
|
If the loop prop is true then sequenceCall below would activate for each loop
|
|
@@ -58084,7 +58107,7 @@ const page1 = new Page(W, H, green);
|
|
|
58084
58107
|
const page2 = new Page(W, H, purple, pink);
|
|
58085
58108
|
const page3 = new Page(W, H, yellow);
|
|
58086
58109
|
|
|
58087
|
-
const pages = new Pages([page1, page2, page3], "
|
|
58110
|
+
const pages = new Pages([page1, page2, page3], "bubbleZIM", 1).addTo();
|
|
58088
58111
|
new Arrow({pages:pages, direction:LEFT})
|
|
58089
58112
|
.rot(180)
|
|
58090
58113
|
.pos(50,50,LEFT,BOTTOM);
|
|
@@ -60377,6 +60400,8 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60377
60400
|
return that;
|
|
60378
60401
|
};
|
|
60379
60402
|
|
|
60403
|
+
var fl;
|
|
60404
|
+
|
|
60380
60405
|
|
|
60381
60406
|
this.resize = function(w, h) {
|
|
60382
60407
|
|
|
@@ -60414,9 +60439,12 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60414
60439
|
var colCount = 0;
|
|
60415
60440
|
var point,newX;
|
|
60416
60441
|
|
|
60442
|
+
if (flip.type == "series") flip.index = 0;
|
|
60443
|
+
fl = zim.Pick.choose(flip);
|
|
60444
|
+
|
|
60417
60445
|
zim.loop(this, function(o, i) {
|
|
60418
|
-
if (bottomFull ||
|
|
60419
|
-
o.pos(totalX+(o.marginRight?o.marginRight:0), totalY+(o.marginTop?o.marginTop:0), zim.RIGHT,
|
|
60446
|
+
if (bottomFull || fl) {
|
|
60447
|
+
o.pos(totalX+(o.marginRight?o.marginRight:0), totalY+(o.marginTop?o.marginTop:0), zim.RIGHT, fl?zim.TOP:zim.BOTTOM);
|
|
60420
60448
|
} else {
|
|
60421
60449
|
o.pos(totalX+(o.marginLeft?o.marginLeft:0), totalY+(o.marginTop?o.marginTop:0));
|
|
60422
60450
|
}
|
|
@@ -60424,7 +60452,7 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60424
60452
|
b = o.boundsToGlobal();
|
|
60425
60453
|
var pointTL = that.globalToLocal(b.x, b.y);
|
|
60426
60454
|
var pointBR = that.globalToLocal(b.x+b.width, b.y+b.height);
|
|
60427
|
-
if (bottomFull ||
|
|
60455
|
+
if (bottomFull || fl) {
|
|
60428
60456
|
point = that.globalToLocal(b.x, b.y);
|
|
60429
60457
|
// o.wrapHeight = buildHeight-totalY-point.y;
|
|
60430
60458
|
} else {
|
|
@@ -60445,7 +60473,7 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60445
60473
|
if (co) {
|
|
60446
60474
|
newX = co*colCount;
|
|
60447
60475
|
} else {
|
|
60448
|
-
if (bottomFull ||
|
|
60476
|
+
if (bottomFull || fl) {
|
|
60449
60477
|
newX = widthVoid - point.x + (o.marginLeft?o.marginLeft:0) + spacingH;
|
|
60450
60478
|
} else {
|
|
60451
60479
|
newX = point.x + (o.marginRight?o.marginRight:0) + spacingH;
|
|
@@ -60463,6 +60491,7 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60463
60491
|
ro = zim.Pick.choose(rowSize);
|
|
60464
60492
|
pv = zim.Pick.choose(percentVoidH);
|
|
60465
60493
|
ov = zim.Pick.choose(offsetVoidH);
|
|
60494
|
+
|
|
60466
60495
|
colCount = 0;
|
|
60467
60496
|
//if (i<t-1) {
|
|
60468
60497
|
that.items2D.push(zim.copy(currentCols));
|
|
@@ -60470,9 +60499,9 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60470
60499
|
heights.push(totalY);
|
|
60471
60500
|
//}
|
|
60472
60501
|
currentCols = [];
|
|
60473
|
-
|
|
60474
|
-
if (bottomFull ||
|
|
60475
|
-
o.pos(totalX+(o.marginRight?o.marginRight:0), totalY+(o.marginTop?o.marginTop:0), zim.RIGHT,
|
|
60502
|
+
|
|
60503
|
+
if (bottomFull || fl) {
|
|
60504
|
+
o.pos(totalX+(o.marginRight?o.marginRight:0), totalY+(o.marginTop?o.marginTop:0), zim.RIGHT, fl?zim.TOP:zim.BOTTOM);
|
|
60476
60505
|
} else {
|
|
60477
60506
|
o.pos(totalX+(o.marginLeft?o.marginLeft:0), totalY+(o.marginTop?o.marginTop:0));
|
|
60478
60507
|
}
|
|
@@ -60490,7 +60519,7 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60490
60519
|
newX = 0;
|
|
60491
60520
|
} else {
|
|
60492
60521
|
newX = (o.marginLeft?o.marginLeft:0) + o.wrapWidth + (o.marginRight?o.marginRight:0) + zim.Pick.choose(spacingH);
|
|
60493
|
-
if (bottomFull ||
|
|
60522
|
+
if (bottomFull || fl) {
|
|
60494
60523
|
point.x = widthVoid - ((o.marginRight?o.marginRight:0) + o.wrapWidth);
|
|
60495
60524
|
} else {
|
|
60496
60525
|
point.x = (o.marginLeft?o.marginLeft:0) + o.wrapWidth;
|
|
@@ -60585,7 +60614,6 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60585
60614
|
var al = zim.Pick.choose(align);
|
|
60586
60615
|
var sp = zim.Pick.choose(spread);
|
|
60587
60616
|
var st = zim.Pick.choose(stretch);
|
|
60588
|
-
var fl = zim.Pick.choose(flip);
|
|
60589
60617
|
var ai = zim.Pick.choose(alignInner);
|
|
60590
60618
|
var vi = zim.Pick.choose(valignInner);
|
|
60591
60619
|
|
|
@@ -60601,8 +60629,8 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60601
60629
|
var alignCheck = false;
|
|
60602
60630
|
var lastX,diffX;
|
|
60603
60631
|
|
|
60604
|
-
if (co) { // columns
|
|
60605
|
-
if (bottomFull ||
|
|
60632
|
+
if (co) { // columns
|
|
60633
|
+
if (bottomFull || fl) objects.reverse();
|
|
60606
60634
|
var gap = widthVoid%co;
|
|
60607
60635
|
var voidLoc = widthVoid/2+ov/100*widthVoid;
|
|
60608
60636
|
var added = 0;
|
|
@@ -60649,7 +60677,7 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60649
60677
|
}
|
|
60650
60678
|
}
|
|
60651
60679
|
|
|
60652
|
-
} else if (sp || st) { // spread or stretch
|
|
60680
|
+
} else if (sp || st) { // spread or stretch
|
|
60653
60681
|
// equal space between
|
|
60654
60682
|
var spacing, extra;
|
|
60655
60683
|
if (sp) spacing = objects.length?((widthVoid-lineObjectWidths)/(objects.length+1)):0;
|
|
@@ -60665,7 +60693,7 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60665
60693
|
lastSpacing = spacing;
|
|
60666
60694
|
|
|
60667
60695
|
var widthTotal = 0;
|
|
60668
|
-
if (bottomFull ||
|
|
60696
|
+
if (bottomFull || fl) objects.reverse();
|
|
60669
60697
|
zim.loop(objects, function (obj, i) {
|
|
60670
60698
|
am = 0;
|
|
60671
60699
|
lastX = obj.x;
|
|
@@ -60707,8 +60735,8 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60707
60735
|
} else {
|
|
60708
60736
|
// shifts for normal wrapping
|
|
60709
60737
|
if (al=="center") {
|
|
60710
|
-
zim.loop(objects, function (obj) {
|
|
60711
|
-
am = ((bottomFull||
|
|
60738
|
+
zim.loop(objects, function (obj) {
|
|
60739
|
+
am = ((bottomFull||fl?0:width)-lastPoint.x)/2;
|
|
60712
60740
|
if (sp || st) {
|
|
60713
60741
|
if (obj.marginLeft) am+=obj.marginLeft;
|
|
60714
60742
|
if (obj.marginRight) am-=obj.marginRight;
|
|
@@ -60716,7 +60744,7 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60716
60744
|
obj.mov(am);
|
|
60717
60745
|
obj.centerX+=am;
|
|
60718
60746
|
});
|
|
60719
|
-
} else if ((bottomFull||
|
|
60747
|
+
} else if ((bottomFull||fl) && al=="left") {
|
|
60720
60748
|
extra = objects[objects.length-1].marginLeft;
|
|
60721
60749
|
zim.loop(objects, function (obj) {
|
|
60722
60750
|
am = -lastPoint.x+(extra?extra:0);
|
|
@@ -60726,7 +60754,7 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60726
60754
|
obj.mov(am);
|
|
60727
60755
|
obj.centerX+=am;
|
|
60728
60756
|
});
|
|
60729
|
-
} else if (!(bottomFull||
|
|
60757
|
+
} else if (!(bottomFull||fl) && al=="right") {
|
|
60730
60758
|
extra = objects[objects.length-1].marginRight;
|
|
60731
60759
|
zim.loop(objects, function (obj) {
|
|
60732
60760
|
am = width-lastPoint.x-(extra?extra:0);
|
|
@@ -60763,15 +60791,15 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60763
60791
|
} else {
|
|
60764
60792
|
if (obj.centerX > voidThresh) obj.mov(voidMove);
|
|
60765
60793
|
}
|
|
60766
|
-
} else if (!(bottomFull||
|
|
60794
|
+
} else if (!(bottomFull||fl) && al=="right") {
|
|
60767
60795
|
if (obj.centerX < width-voidThresh) obj.mov(-voidMove);
|
|
60768
|
-
} else if (!(bottomFull||
|
|
60796
|
+
} else if (!(bottomFull||fl) && al=="center") {
|
|
60769
60797
|
// might want to center each side on their side...
|
|
60770
60798
|
if (obj.centerX > width/2+ov/100*widthVoid) obj.mov(voidMove/2);
|
|
60771
60799
|
else obj.mov(-voidMove/2);
|
|
60772
|
-
} else if ((bottomFull||
|
|
60800
|
+
} else if ((bottomFull||fl) && al=="right") {
|
|
60773
60801
|
if (obj.centerX > widthVoid-voidThresh) obj.mov(voidMove);
|
|
60774
|
-
} else if ((bottomFull||
|
|
60802
|
+
} else if ((bottomFull||fl) && al=="center") {
|
|
60775
60803
|
if (obj.centerX > widthVoid/2+ov/100*widthVoid) obj.mov(voidMove);
|
|
60776
60804
|
} else { // lefts
|
|
60777
60805
|
if (obj.centerX > voidThresh) obj.mov(voidMove);
|
|
@@ -60798,6 +60826,9 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
60798
60826
|
obj.mov(0, -(maxY-obj.wrapHeight)+(obj.marginTop?obj.marginTop:0));
|
|
60799
60827
|
});
|
|
60800
60828
|
}
|
|
60829
|
+
|
|
60830
|
+
fl = zim.Pick.choose(flip);
|
|
60831
|
+
|
|
60801
60832
|
} // end alignObjects
|
|
60802
60833
|
|
|
60803
60834
|
|
|
@@ -68858,11 +68889,10 @@ mousedownIncludes - (default null) a single object or array of objects (aside fr
|
|
|
68858
68889
|
The controller assumes everything in the container will not activate the mousedown
|
|
68859
68890
|
This lets you activate interface elements without moving to them ;-)
|
|
68860
68891
|
If for instance, a backing is used other than the stage, just pass in the backing to this parameter
|
|
68861
|
-
See also the mousedownIncludes property
|
|
68892
|
+
See also the mousedownIncludes property
|
|
68862
68893
|
The boundary is automatically added to mousedownIncludes
|
|
68863
68894
|
If the container is provided and it has a backing property, this is added automatically to the mouseDownIncludes at the start
|
|
68864
68895
|
The backing can be removed from the mousedownIncludes property with mc.mousedownIncludes.splice(mc.mousedownIncludes.indexOf(mc.container.backing, 1));
|
|
68865
|
-
mousedownExcludes - (default null) an array of objects that the mousedown will not work on - overrides mousedownIncludes
|
|
68866
68896
|
minPercentSpeed - (default 0) if target is an Accelerator, the percentSpeed at the left or top of the stage (depending on axis)
|
|
68867
68897
|
minPercentSpeed - (default 100) if target is an Accelerator, the percentSpeed at the right or bottom of the stage (depending on axis)
|
|
68868
68898
|
dampKeyup - (default .3) damping applied to slow down Accelerator with keydown
|
|
@@ -70104,7 +70134,7 @@ EXAMPLE
|
|
|
70104
70134
|
// this is like a mousejoint similar to drag() but attached to an object rather than the mouse
|
|
70105
70135
|
// so a physics object can follow a ZIM drag() or animate() or wiggle(), etc.
|
|
70106
70136
|
// the original distance between the objects is maintained like a distance joint
|
|
70107
|
-
// see https://zimjs.com/valentines/
|
|
70137
|
+
// see https://zimjs.com/valentines/puppets.html
|
|
70108
70138
|
// see https://zimjs.com/valentines/puppets2.html
|
|
70109
70139
|
const physics = new Physics(0);
|
|
70110
70140
|
const control = new Triangle().center().mov(0,-100).drag(); // or animate() or wiggle()
|
|
@@ -74024,7 +74054,6 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
74024
74054
|
call:done,
|
|
74025
74055
|
params:e
|
|
74026
74056
|
});
|
|
74027
|
-
|
|
74028
74057
|
}
|
|
74029
74058
|
function done(e) {
|
|
74030
74059
|
if (!that.complete && that.test()) {
|
|
@@ -74039,7 +74068,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
74039
74068
|
that.mySownCheck = dCheck = false;
|
|
74040
74069
|
onOthers();
|
|
74041
74070
|
// e.target.mouseEnabled = true;
|
|
74042
|
-
e.target.dragPaused = false;
|
|
74071
|
+
e.target.dragPaused = false;
|
|
74043
74072
|
}
|
|
74044
74073
|
if (!swap) {
|
|
74045
74074
|
if (that.moveEvent) tile.off("pressmove", that.moveEvent);
|
|
@@ -74168,6 +74197,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
74168
74197
|
|
|
74169
74198
|
this.inactive = false;
|
|
74170
74199
|
this.scramble = function(time, wait, num) {
|
|
74200
|
+
|
|
74201
|
+
that.myDownCheck = false;
|
|
74202
|
+
|
|
74171
74203
|
if (zot(wait)) wait = 0;
|
|
74172
74204
|
if (zot(time)) time = 0;
|
|
74173
74205
|
if (zot(num) || time==0) num = 1;
|
|
@@ -82406,7 +82438,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
82406
82438
|
}
|
|
82407
82439
|
}
|
|
82408
82440
|
|
|
82409
|
-
function svgDone(bitmap, params) {
|
|
82441
|
+
function svgDone(bitmap, params) {
|
|
82410
82442
|
queue.loadAssetsCount--;
|
|
82411
82443
|
var item = params.item;
|
|
82412
82444
|
var asset = zim.assets[item.id] = bitmap;
|
|
@@ -82440,8 +82472,9 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
82440
82472
|
preload.on("error", function(e) {queue.dispatchEvent(e); if (!queueOnly) that.dispatchEvent(e);});
|
|
82441
82473
|
preload.on("fileload", function(e) {
|
|
82442
82474
|
// for some reason, errors are not working on IMG and SVG from PreloadJS
|
|
82443
|
-
// so check for rawResult - should really fix this in CreateJS
|
|
82444
|
-
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")
|
|
82445
82478
|
var ev = new createjs.Event("error");
|
|
82446
82479
|
ev = new createjs.Event("error");
|
|
82447
82480
|
ev.item = e.item; // createjs preload item
|
|
@@ -82450,7 +82483,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
82450
82483
|
ev = new createjs.Event("error");
|
|
82451
82484
|
ev.item = e.item;
|
|
82452
82485
|
that.dispatchEvent(ev);
|
|
82453
|
-
} else {
|
|
82486
|
+
} else {
|
|
82454
82487
|
var item = e.item;
|
|
82455
82488
|
var type = e.item.type;
|
|
82456
82489
|
var ext = item.id.match(re);
|
|
@@ -82514,7 +82547,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
82514
82547
|
}
|
|
82515
82548
|
} else if (type == "svg") {
|
|
82516
82549
|
queue.loadAssetsCount++;
|
|
82517
|
-
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});
|
|
82518
82551
|
return;
|
|
82519
82552
|
} else {
|
|
82520
82553
|
asset = zim.assets[item.id] = e.result;
|
|
@@ -82665,7 +82698,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
82665
82698
|
assetHolder.type = "Sound";
|
|
82666
82699
|
assetHolder.src = loaded.src;
|
|
82667
82700
|
assetHolder.item = loaded.item;
|
|
82668
|
-
if (assetHolder.playParams) {
|
|
82701
|
+
if (assetHolder.playParams) {
|
|
82669
82702
|
assetHolder.sound = assetHolder.play.apply(null, assetHolder.playParams);
|
|
82670
82703
|
if (assetHolder.volume != null) assetHolder.sound.volume = assetHolder.volume;
|
|
82671
82704
|
if (assetHolder.pan != null) assetHolder.sound.pan = assetHolder.pan;
|
|
@@ -84048,7 +84081,7 @@ loop - dispatched when the sound loops (but not at end of last loop - that is co
|
|
|
84048
84081
|
file = that.file = zim.Pick.choose(file);
|
|
84049
84082
|
|
|
84050
84083
|
var sound = that.sound = zim.asset(file, null, null, maxNum);
|
|
84051
|
-
if (sound.type == "AC") {
|
|
84084
|
+
if (sound.type == "AC") {
|
|
84052
84085
|
sound.on("complete", function () {
|
|
84053
84086
|
that.src = sound.src;
|
|
84054
84087
|
that.item = sound.item;
|
|
@@ -84559,7 +84592,7 @@ new SVG(zid("svgTagID")).center().drag();
|
|
|
84559
84592
|
END EXAMPLE
|
|
84560
84593
|
|
|
84561
84594
|
EXAMPLE
|
|
84562
|
-
Find the SVG in an assets/ folder
|
|
84595
|
+
// Find the SVG in an assets/ folder
|
|
84563
84596
|
PATH = "assets/"
|
|
84564
84597
|
// Tile a lazy-loaded SVG with dimensions - otherwise Tile would give a console warning
|
|
84565
84598
|
new Tile(new SVG("file.svg", 100, 100), 4, 4)).center();
|
|
@@ -84582,7 +84615,7 @@ EXAMPLE
|
|
|
84582
84615
|
// see the Docs under SVGContainer for more complex examples and added information
|
|
84583
84616
|
// note the h t t p : should be edited to not have spaces - just avoiding Doc auto linking
|
|
84584
84617
|
const svg = `<svg width="150" height="200" xmlns="h t t p ://www.w3.org/2000/svg">
|
|
84585
|
-
<path id="lineAB" d="M 0 0 l 150 200" stroke=red stroke-width="3" fill="none" />
|
|
84618
|
+
<path id="lineAB" d="M 0 0 l 150 200" stroke="red" stroke-width="3" fill="none" />
|
|
84586
84619
|
</svg>`;
|
|
84587
84620
|
new SVG(svg, null, null, false).center();
|
|
84588
84621
|
END EXAMPLE
|
|
@@ -85950,7 +85983,7 @@ RETURNS - null
|
|
|
85950
85983
|
--*///+83.27
|
|
85951
85984
|
zim.svgToBitmap = function(svg, callback, width, height, params) {
|
|
85952
85985
|
z_d("83.27");
|
|
85953
|
-
|
|
85986
|
+
|
|
85954
85987
|
if (!zot(svg.draggable)) {
|
|
85955
85988
|
// CreateJS seems to wrap up an SVG with loadAssets as an SVG object
|
|
85956
85989
|
var parser = new DOMParser();
|
|
@@ -85961,8 +85994,10 @@ RETURNS - null
|
|
|
85961
85994
|
}
|
|
85962
85995
|
|
|
85963
85996
|
if (!XMLSerializer) {if (zon) {zogy("ZIM svgToBitmap() - sorry, not supported in Browser"); return;}}
|
|
85964
|
-
var svgString = (typeof svg == "string") ? svg : new XMLSerializer().serializeToString(svg);
|
|
85997
|
+
var svgString = (typeof svg == "string") ? svg : new XMLSerializer().serializeToString(svg);
|
|
85965
85998
|
if (svgString) {
|
|
85999
|
+
// https does not work
|
|
86000
|
+
svgString = svgString.replace(/https:\/\/www.w3/i, "http://www.w3");
|
|
85966
86001
|
// seem to need width and height parameters in svg tag
|
|
85967
86002
|
var first = svgString.split(">")[0];
|
|
85968
86003
|
if (first.length>1) {
|
|
@@ -85985,19 +86020,27 @@ RETURNS - null
|
|
|
85985
86020
|
svgString = svgString.replace(/svg /i, "svg width=\""+w+"\" height=\""+h+"\" ");
|
|
85986
86021
|
}
|
|
85987
86022
|
}
|
|
85988
|
-
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' ");
|
|
85989
86024
|
}
|
|
85990
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);
|
|
85991
86031
|
var img = new Image();
|
|
85992
86032
|
img.onload = function() {
|
|
86033
|
+
clearTimeout(inte);
|
|
85993
86034
|
var bitmap = new zim.Bitmap(img, width, height);
|
|
85994
86035
|
callback(bitmap, params);
|
|
85995
86036
|
DOMURL.revokeObjectURL(obu);
|
|
85996
|
-
};
|
|
86037
|
+
};
|
|
85997
86038
|
var obu;
|
|
85998
|
-
if (document && document.Blob)
|
|
85999
|
-
|
|
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"}));
|
|
86000
86042
|
img.src = obu;
|
|
86043
|
+
|
|
86001
86044
|
};//-83.27
|
|
86002
86045
|
|
|
86003
86046
|
/*--
|