zimjs 18.0.4 → 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 +29 -20
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
|
|
@@ -75725,7 +75730,7 @@ puppet(o) - make object go to the x and y of the object passed into to the o par
|
|
|
75725
75730
|
and controlled with animate(), wiggle(), zim drag(), gesture(), transform(), etc.
|
|
75726
75731
|
note: it is the x and y property only, not rotation or scale.
|
|
75727
75732
|
see https://zimjs.com/018/puppet.html
|
|
75728
|
-
|
|
75733
|
+
noPuppet() - stop the object from being a puppet
|
|
75729
75734
|
|
|
75730
75735
|
PROPERTIES - FOR OBJECTS - see also BODY PROPERTIES below
|
|
75731
75736
|
dynamic - set to true for dynamic and false for static
|
|
@@ -75956,6 +75961,7 @@ b2ContactListener = Box2D.Dynamics.b2ContactListener;
|
|
|
75956
75961
|
return obj;
|
|
75957
75962
|
};
|
|
75958
75963
|
obj.noPuppet = function() {
|
|
75964
|
+
var physics = obj.physics;
|
|
75959
75965
|
physics.world.DestroyJoint(obj.puppetJoint);
|
|
75960
75966
|
obj.puppetJoint = null;
|
|
75961
75967
|
zim.Ticker.remove(obj.zimPuppetTicker);
|
|
@@ -89172,6 +89178,8 @@ so when dragging, for instance, the whole pic moves rather than the bitmap insid
|
|
|
89172
89178
|
To interact with objects inside, set pic.mouseChildren = true.
|
|
89173
89179
|
Generally, for clarity, avoid adding objects to Shapes or Pics unless you are used to the mouseChildren setting.
|
|
89174
89180
|
|
|
89181
|
+
NOTE: there is an outlineImage(pic, reverse) function that can be called to outline a DisplayObject - search docs for outlineImage
|
|
89182
|
+
|
|
89175
89183
|
NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
|
|
89176
89184
|
|
|
89177
89185
|
EXAMPLE
|
|
@@ -89283,7 +89291,8 @@ keyOut(color, tolerance, replacement) - remove a certain color in the picture an
|
|
|
89283
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
|
|
89284
89292
|
color and tolerance can be an array of colors and tolerances (or just one tolerance if all are the same)
|
|
89285
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
|
|
89286
|
-
|
|
89294
|
+
Note: there is an outlineImage(pic, reverse) function that can be called to outline a DisplayObject - search docs for outlineImage
|
|
89295
|
+
|
|
89287
89296
|
ZIM 4TH adds all the methods listed under Container (see above), such as:
|
|
89288
89297
|
drag(), hitTestRect(), animate(), sca(), reg(), mov(), center(), centerReg(),
|
|
89289
89298
|
addTo(), removeFrom(), loop(), outline(), place(), pos(), alp(), rot(), setMask(), etc.
|