zimjs 18.0.3 → 18.0.5
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 +42 -41
package/package.json
CHANGED
package/src/zim.js
CHANGED
|
@@ -15469,7 +15469,7 @@ zim.Circle = function(radius, color, borderColor, borderWidth, dashed, percent,
|
|
|
15469
15469
|
that.drawShape = function() {
|
|
15470
15470
|
g.c();
|
|
15471
15471
|
that.colorCommand = g.f(that._color).command;
|
|
15472
|
-
if (that._color && that._color.type) that.specialColor(that.colorCommand, that._color, that);
|
|
15472
|
+
// if (that._color && that._color.type) that.specialColor(that.colorCommand, that._color, that);
|
|
15473
15473
|
// border of 0 or a string value still draws a border in CreateJS
|
|
15474
15474
|
if (zot(that._borderWidth) || that._borderWidth > 0) { // no border specified or a border > 0
|
|
15475
15475
|
if (!zot(that._borderColor) || !zot(that._borderWidth)) { // either a border color or thickness
|
|
@@ -15508,9 +15508,10 @@ zim.Circle = function(radius, color, borderColor, borderWidth, dashed, percent,
|
|
|
15508
15508
|
g.dc(0,0,that._radius);
|
|
15509
15509
|
}
|
|
15510
15510
|
that.setBounds(-that._radius,-that._radius,that._radius*2,h);
|
|
15511
|
+
if (that._color.type) that.color = that._color;
|
|
15511
15512
|
};
|
|
15512
15513
|
that.drawShape();
|
|
15513
|
-
|
|
15514
|
+
|
|
15514
15515
|
|
|
15515
15516
|
Object.defineProperty(that, 'radius', {
|
|
15516
15517
|
get: function() {
|
|
@@ -15754,7 +15755,7 @@ zim.Rectangle = function(width, height, color, borderColor, borderWidth, corner,
|
|
|
15754
15755
|
that.drawShape = function() {
|
|
15755
15756
|
g.c();
|
|
15756
15757
|
that.colorCommand = g.f(that._color).command;
|
|
15757
|
-
if (
|
|
15758
|
+
// if (that._color && that._color.type) that.specialColor(that.colorCommand, that._color, that);
|
|
15758
15759
|
// border of 0 or a string value still draws a border in CreateJS
|
|
15759
15760
|
if (zot(that._borderWidth) || that._borderWidth > 0) { // no border specified or a border > 0
|
|
15760
15761
|
if (!zot(that._borderColor) || !zot(that._borderWidth)) { // either a border color or thickness
|
|
@@ -15796,7 +15797,7 @@ zim.Rectangle = function(width, height, color, borderColor, borderWidth, corner,
|
|
|
15796
15797
|
}
|
|
15797
15798
|
|
|
15798
15799
|
that.setBounds(0,0,width,height);
|
|
15799
|
-
if (
|
|
15800
|
+
if (that._color.type) that.color = that._color;
|
|
15800
15801
|
|
|
15801
15802
|
};
|
|
15802
15803
|
that.drawShape();
|
|
@@ -16028,7 +16029,7 @@ zim.Triangle = function(a, b, c, color, borderColor, borderWidth, corner, center
|
|
|
16028
16029
|
|
|
16029
16030
|
g.c();
|
|
16030
16031
|
that.colorCommand = g.f(that._color).command;
|
|
16031
|
-
if (that._color && that._color.type) that.specialColor(that.colorCommand, that._color, that);
|
|
16032
|
+
// if (that._color && that._color.type) that.specialColor(that.colorCommand, that._color, that);
|
|
16032
16033
|
// border of 0 or a string value still draws a border in CreateJS
|
|
16033
16034
|
if (zot(that._borderWidth) || that._borderWidth > 0) { // no border specified or a border > 0
|
|
16034
16035
|
if (!zot(that._borderColor) || !zot(that._borderWidth)) { // either a border color or thickness
|
|
@@ -16090,9 +16091,10 @@ zim.Triangle = function(a, b, c, color, borderColor, borderWidth, corner, center
|
|
|
16090
16091
|
if (adjust) {
|
|
16091
16092
|
that.shape.y+=adjust;
|
|
16092
16093
|
}
|
|
16094
|
+
if (that._color.type) that.color = that._color;
|
|
16093
16095
|
};
|
|
16094
16096
|
that.drawShape();
|
|
16095
|
-
|
|
16097
|
+
|
|
16096
16098
|
|
|
16097
16099
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
16098
16100
|
// NOTE: extends ZIM CustomShape for more properties and a few functions.
|
|
@@ -16275,7 +16277,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
16275
16277
|
that.drawShape = function() {
|
|
16276
16278
|
g.c();
|
|
16277
16279
|
that.colorCommand = g.f(that._color).command;
|
|
16278
|
-
if (that._color && that._color.type) that.specialColor(that.colorCommand, that._color, that);
|
|
16280
|
+
// if (that._color && that._color.type) that.specialColor(that.colorCommand, that._color, that);
|
|
16279
16281
|
// border of 0 or a string value still draws a border in CreateJS
|
|
16280
16282
|
if (zot(that._borderWidth) || that._borderWidth > 0) { // no border specified or a border > 0
|
|
16281
16283
|
if (!zot(that._borderColor) || !zot(that._borderWidth)) { // either a border color or thickness
|
|
@@ -16296,9 +16298,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
16296
16298
|
}
|
|
16297
16299
|
g.dp(0,0,that._radius, that._sides, that._pointSize, angle);
|
|
16298
16300
|
that.setBounds(-that._radius,-that._radius, that._radius*2, that._radius*2);
|
|
16301
|
+
if (that._color.type) that.color = that._color;
|
|
16299
16302
|
};
|
|
16300
|
-
that.drawShape();
|
|
16301
|
-
if (color.type) that.color = color;
|
|
16303
|
+
that.drawShape();
|
|
16302
16304
|
|
|
16303
16305
|
Object.defineProperty(that, 'radius', {
|
|
16304
16306
|
get: function() {
|
|
@@ -16595,7 +16597,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
16595
16597
|
that.drawShape = function(arrowAdjustStart, arrowAdjustEnd) {
|
|
16596
16598
|
g.c();
|
|
16597
16599
|
that.colorCommand = g.s(that._color).command;
|
|
16598
|
-
if (color && color.type) that.specialColor(that.colorCommand, color, that);
|
|
16600
|
+
// if (color && color.type) that.specialColor(that.colorCommand, color, that);
|
|
16599
16601
|
that.thicknessCommand = g.ss(that._thickness, strokeObj.caps, strokeObj.joints, strokeObj.miterLimit, strokeObj.ignoreScale).command;
|
|
16600
16602
|
if (that._dashed) {
|
|
16601
16603
|
that.dashedCommand = g.sd(Array.isArray(that._dashed)?that._dashed:[10, 10], that._dashedOffset).command;
|
|
@@ -16863,10 +16865,10 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
16863
16865
|
var endAngle = Math.atan2(endArrowGuide[3]-endArrowGuide[1], endArrowGuide[2]-endArrowGuide[0]) * 180 / Math.PI;
|
|
16864
16866
|
that._endHead.rotation = endAngle+that._endHead.startAngle;
|
|
16865
16867
|
}
|
|
16866
|
-
|
|
16868
|
+
if (that._color.type) that.color = that._color;
|
|
16867
16869
|
};
|
|
16868
16870
|
that.drawShape();
|
|
16869
|
-
|
|
16871
|
+
|
|
16870
16872
|
|
|
16871
16873
|
// ALSO ADJUST ZIM ZIM 02 - to localToLocal
|
|
16872
16874
|
this.setPoints = function(a, b, c, d, arrowAdjustStart, arrowAdjustEnd) {
|
|
@@ -17786,7 +17788,7 @@ Note the points property has been split into points and pointObjects (and there
|
|
|
17786
17788
|
|
|
17787
17789
|
if (!that.colorCommand) {
|
|
17788
17790
|
that.colorCommand = g.s(that._color).command;
|
|
17789
|
-
if (color && color.type) that.specialColor(that.colorCommand, color, that);
|
|
17791
|
+
// if (color && color.type) that.specialColor(that.colorCommand, color, that);
|
|
17790
17792
|
}
|
|
17791
17793
|
if (!that.thicknessCommand) that.thicknessCommand = g.ss(that._thickness, strokeObj.caps, strokeObj.joints, strokeObj.miterLimit, strokeObj.ignoreScale).command;
|
|
17792
17794
|
if (that._dashed) {
|
|
@@ -17840,9 +17842,9 @@ Note the points property has been split into points and pointObjects (and there
|
|
|
17840
17842
|
if (that._dashed) g.append(that.dashedCommand);
|
|
17841
17843
|
g.append(that.thicknessCommand);
|
|
17842
17844
|
g.append(that.colorCommand);
|
|
17845
|
+
if (that._color.type) that.color = that._color;
|
|
17843
17846
|
};
|
|
17844
17847
|
that.drawShape();
|
|
17845
|
-
if (color.type) that.color = color;
|
|
17846
17848
|
|
|
17847
17849
|
var startPosition;
|
|
17848
17850
|
var mDown = false;
|
|
@@ -20031,7 +20033,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
20031
20033
|
g.c();
|
|
20032
20034
|
if (!that.colorCommand) {
|
|
20033
20035
|
that.colorCommand = g.f(that._color).command;
|
|
20034
|
-
if (color && color.type) that.specialColor(that.colorCommand, color, that);
|
|
20036
|
+
// if (color && color.type) that.specialColor(that.colorCommand, color, that);
|
|
20035
20037
|
}
|
|
20036
20038
|
// border of 0 or a string value still draws a border in CreateJS
|
|
20037
20039
|
if (zot(that._borderWidth) || that._borderWidth > 0) { // no border specified or a border > 0
|
|
@@ -20091,9 +20093,10 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
20091
20093
|
if (that._dashed) g.append(that.borderDashedCommand);
|
|
20092
20094
|
if (that.borderWidthCommand) g.append(that.borderWidthCommand);
|
|
20093
20095
|
if (that.borderColorCommand) g.append(that.borderColorCommand);
|
|
20096
|
+
if (that._color.type) that.color = that._color;
|
|
20094
20097
|
};
|
|
20095
20098
|
that.drawShape();
|
|
20096
|
-
if (color.type) that.color = color;
|
|
20099
|
+
// if (color.type) that.color = color;
|
|
20097
20100
|
|
|
20098
20101
|
var startPosition;
|
|
20099
20102
|
var mDown;
|
|
@@ -49334,6 +49337,7 @@ Here are some types:
|
|
|
49334
49337
|
"click", "dblclick", "mousedown/pressdown", "pressmove", "pressup",
|
|
49335
49338
|
"mousemove", "stagemousemove", "mouseover", "mouseout"
|
|
49336
49339
|
"ready", "complete", "change", "keydown", "keyup"
|
|
49340
|
+
Note: would suggest using tap() with dbl:true instead of "dblclick" for proper performance on mobile
|
|
49337
49341
|
|
|
49338
49342
|
The events available for ZIM Objects are listed at the bottom of their Doc entry.
|
|
49339
49343
|
Events can also be turned off in a couple ways - see the examples.
|
|
@@ -49429,6 +49433,7 @@ type - the type of event as a string - this depends on the object on which the e
|
|
|
49429
49433
|
"click", "dblclick", "mousedown/pressdown", "pressmove", "pressup",
|
|
49430
49434
|
"mousemove", "stagemousemove", "mouseover", "mouseout"
|
|
49431
49435
|
"ready", "complete", "change", "keydown", "keyup"
|
|
49436
|
+
Note: would suggest using tap() with dbl:true instead of "dblclick" for proper performance on mobile
|
|
49432
49437
|
listener - the function to call when the event happens
|
|
49433
49438
|
this is often an arrow function or an anonymous function but can be a named function
|
|
49434
49439
|
the function will receive an event object as its parameter often collected as e
|
|
@@ -51547,14 +51552,14 @@ NOTE: set an object's noTap property to true to avoid activating a hold on an ob
|
|
|
51547
51552
|
SEE: noTap() as well
|
|
51548
51553
|
|
|
51549
51554
|
EXAMPLE
|
|
51550
|
-
new Circle(50, red).tap(e=>{
|
|
51555
|
+
new Circle(50, red).center().tap(e=>{
|
|
51551
51556
|
e.target.alpha = .5;
|
|
51552
51557
|
S.update();
|
|
51553
51558
|
});
|
|
51554
51559
|
END EXAMPLE
|
|
51555
51560
|
|
|
51556
51561
|
EXAMPLE
|
|
51557
|
-
new Button().tap(()=>{
|
|
51562
|
+
new Button().center().tap(()=>{
|
|
51558
51563
|
zgo("https://zimjs.com", "_blank"); // open ZIM site in new tab
|
|
51559
51564
|
});
|
|
51560
51565
|
END EXAMPLE
|
|
@@ -65349,7 +65354,7 @@ addChild(), removeChild(), addChildAt(), getChildAt(), contains(), removeAllChil
|
|
|
65349
65354
|
PROPERTIES
|
|
65350
65355
|
type - holds the class name as a String
|
|
65351
65356
|
items - an array of the wrapper items
|
|
65352
|
-
items2D - read only array of rows each containing an array of
|
|
65357
|
+
items2D - read only array of rows each containing an array of columns of items
|
|
65353
65358
|
** see the parameter for descriptions of the following
|
|
65354
65359
|
** setting each will resize the wrapper at the current width and height
|
|
65355
65360
|
** all these properties accept ZIM VEE (except spacingH) for instance: flip:series(false,true)
|
|
@@ -66322,12 +66327,12 @@ addChild(), removeChild(), addChildAt(), getChildAt(), contains(), removeAllChil
|
|
|
66322
66327
|
PROPERTIES
|
|
66323
66328
|
type - holds the class name as a String
|
|
66324
66329
|
items - read only array of the original tile items - or use tile.getChildAt() or tile.loop(function (item) {})
|
|
66325
|
-
items2D - read only array of rows each containing an array of
|
|
66330
|
+
items2D - read only array of rows each containing an array of columns of items
|
|
66326
66331
|
items2DCols - read only array of columns each containing array of rows of items
|
|
66327
66332
|
** the current properties work for equal column size and equal row size
|
|
66328
66333
|
** although the row and column size can be different
|
|
66329
66334
|
current ** - a read only array of the current order of tile items - if items have been scrambled
|
|
66330
|
-
current2D ** - read only array the current order of rows each containing an array of
|
|
66335
|
+
current2D ** - read only array the current order of rows each containing an array of columns of items
|
|
66331
66336
|
current2DCols ** - read only array the current order of columns each containing array of rows of items
|
|
66332
66337
|
tileNum - this property is added to each object in the tile to give its number in the tile
|
|
66333
66338
|
tileCol - this property is added to each object in the tile to give its column number in the tile
|
|
@@ -66392,24 +66397,6 @@ note: the item is not the event object target - as that is the tile
|
|
|
66392
66397
|
|
|
66393
66398
|
if (zot(spacingH)) spacingH = DS.spacingH!=null?DS.spacingH:null;
|
|
66394
66399
|
if (zot(spacingV)) spacingV = DS.spacingV!=null?DS.spacingV:null;
|
|
66395
|
-
|
|
66396
|
-
// Added ZIM 018
|
|
66397
|
-
var spacingHOList = [];
|
|
66398
|
-
var spacingVOList = [];
|
|
66399
|
-
var spacingHOTotal = 0;
|
|
66400
|
-
var spacingVOTotal = 0;
|
|
66401
|
-
for (i=0; i<cols-1; i++) {
|
|
66402
|
-
var s = zik(spacingH);
|
|
66403
|
-
spacingHOList.push(s);
|
|
66404
|
-
spacingHOTotal += s;
|
|
66405
|
-
}
|
|
66406
|
-
for (i=0; i<rows-1; i++) {
|
|
66407
|
-
var s = zik(spacingV);
|
|
66408
|
-
spacingVOList.push(s);
|
|
66409
|
-
spacingVOTotal += s;
|
|
66410
|
-
}
|
|
66411
|
-
var spacingHAve = cols-1>0?spacingHTotal/(cols-1):0
|
|
66412
|
-
var spacingVAve = rows-1>0?spacingVTotal/(rows-1):0
|
|
66413
66400
|
|
|
66414
66401
|
if (zot(spacingH) || !zot(colSize) || !zot(width)) spacingH = 0; // sizes override spacing
|
|
66415
66402
|
if (zot(spacingV) || !zot(rowSize) || !zot(height)) spacingV = 0;
|
|
@@ -66421,6 +66408,7 @@ note: the item is not the event object target - as that is the tile
|
|
|
66421
66408
|
if (count === 0) {count = null; if (zon) {zogy("ZIM Tile() - count parameter of 0 is ignored - see docs");}}
|
|
66422
66409
|
|
|
66423
66410
|
// Added ZIM 018
|
|
66411
|
+
|
|
66424
66412
|
var spacingHList = [];
|
|
66425
66413
|
var spacingVList = [];
|
|
66426
66414
|
var spacingHTotal = 0;
|
|
@@ -66438,6 +66426,15 @@ note: the item is not the event object target - as that is the tile
|
|
|
66438
66426
|
spacingVTotal += s;
|
|
66439
66427
|
}
|
|
66440
66428
|
|
|
66429
|
+
var spacingHOList = zim.copy(spacingHList);
|
|
66430
|
+
var spacingVOList = zim.copy(spacingVList);;
|
|
66431
|
+
var spacingHOTotal = spacingHTotal;
|
|
66432
|
+
var spacingVOTotal = spacingVTotal;
|
|
66433
|
+
var spacingHAve = cols-1>0?spacingHTotal/(cols-1):0
|
|
66434
|
+
var spacingVAve = rows-1>0?spacingVTotal/(rows-1):0
|
|
66435
|
+
|
|
66436
|
+
// end add 018
|
|
66437
|
+
|
|
66441
66438
|
if (zot(mirrorH)) mirrorH = DS.mirrorH!=null?DS.mirrorH:false;
|
|
66442
66439
|
if (zot(mirrorV)) mirrorV = DS.mirrorV!=null?DS.mirrorV:false;
|
|
66443
66440
|
if (zot(snapToPixel)) snapToPixel = DS.snapToPixel!=null?DS.snapToPixel:true;
|
|
@@ -75733,7 +75730,7 @@ puppet(o) - make object go to the x and y of the object passed into to the o par
|
|
|
75733
75730
|
and controlled with animate(), wiggle(), zim drag(), gesture(), transform(), etc.
|
|
75734
75731
|
note: it is the x and y property only, not rotation or scale.
|
|
75735
75732
|
see https://zimjs.com/018/puppet.html
|
|
75736
|
-
|
|
75733
|
+
noPuppet() - stop the object from being a puppet
|
|
75737
75734
|
|
|
75738
75735
|
PROPERTIES - FOR OBJECTS - see also BODY PROPERTIES below
|
|
75739
75736
|
dynamic - set to true for dynamic and false for static
|
|
@@ -75964,6 +75961,7 @@ b2ContactListener = Box2D.Dynamics.b2ContactListener;
|
|
|
75964
75961
|
return obj;
|
|
75965
75962
|
};
|
|
75966
75963
|
obj.noPuppet = function() {
|
|
75964
|
+
var physics = obj.physics;
|
|
75967
75965
|
physics.world.DestroyJoint(obj.puppetJoint);
|
|
75968
75966
|
obj.puppetJoint = null;
|
|
75969
75967
|
zim.Ticker.remove(obj.zimPuppetTicker);
|
|
@@ -89180,6 +89178,8 @@ so when dragging, for instance, the whole pic moves rather than the bitmap insid
|
|
|
89180
89178
|
To interact with objects inside, set pic.mouseChildren = true.
|
|
89181
89179
|
Generally, for clarity, avoid adding objects to Shapes or Pics unless you are used to the mouseChildren setting.
|
|
89182
89180
|
|
|
89181
|
+
NOTE: there is an outlineImage(pic, reverse) function that can be called to outline a DisplayObject - search docs for outlineImage
|
|
89182
|
+
|
|
89183
89183
|
NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
|
|
89184
89184
|
|
|
89185
89185
|
EXAMPLE
|
|
@@ -89291,7 +89291,8 @@ keyOut(color, tolerance, replacement) - remove a certain color in the picture an
|
|
|
89291
89291
|
the default tolerance is .1 - the higher the tolerance the less sensitive the keying process - so more colors will be removed similar to the provided color
|
|
89292
89292
|
color and tolerance can be an array of colors and tolerances (or just one tolerance if all are the same)
|
|
89293
89293
|
replacement (default clear) a color to replace the keyed out color with or an optional array to match the colors array if an array is used
|
|
89294
|
-
|
|
89294
|
+
Note: there is an outlineImage(pic, reverse) function that can be called to outline a DisplayObject - search docs for outlineImage
|
|
89295
|
+
|
|
89295
89296
|
ZIM 4TH adds all the methods listed under Container (see above), such as:
|
|
89296
89297
|
drag(), hitTestRect(), animate(), sca(), reg(), mov(), center(), centerReg(),
|
|
89297
89298
|
addTo(), removeFrom(), loop(), outline(), place(), pos(), alp(), rot(), setMask(), etc.
|