zimjs 17.2.2 → 17.2.3
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/.github/FUNDING.yml +1 -1
- package/package.json +1 -1
- package/src/zim.js +60 -47
package/.github/FUNDING.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# These are supported funding model platforms
|
|
2
2
|
|
|
3
|
-
github:
|
|
3
|
+
github: [danzen]
|
|
4
4
|
patreon: zimjs
|
|
5
5
|
open_collective: # Replace with a single Open Collective username
|
|
6
6
|
ko_fi: # Replace with a single Ko-fi username
|
package/package.json
CHANGED
package/src/zim.js
CHANGED
|
@@ -10816,16 +10816,16 @@ NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set
|
|
|
10816
10816
|
|
|
10817
10817
|
EXAMPLE
|
|
10818
10818
|
// slice a pic in four at 25% from the edges, scale the middle and keep the sides and corners not scaled.
|
|
10819
|
-
new SlicedBitmap(1600, pic.height, pic, [0.25,0.75],[0.25,0.75]], [[0,1,0],[0,1,0])
|
|
10819
|
+
new SlicedBitmap(1600, pic.height, pic, [[0.25,0.75],[0.25,0.75]], [[0,1,0],[0,1,0]])
|
|
10820
10820
|
.center()
|
|
10821
10821
|
.transform({minScaleX:.05, minScaleY:.05});
|
|
10822
10822
|
END EXAMPLE
|
|
10823
10823
|
|
|
10824
10824
|
EXAMPLE
|
|
10825
10825
|
// slice a pic in four at 25% from the edges, scale the middle and keep the sides and corners not scaled.
|
|
10826
|
-
const pic = new Pic("
|
|
10827
|
-
const startSlices = [0.25,0.75],[0.25,0.75]];
|
|
10828
|
-
const startTypes = [[0,2,0],[0,1,0]; // middle is tiled horizontally and stretched vertically
|
|
10826
|
+
const pic = new Pic("pic.png"); // preload this in Frame() or loadAssets()
|
|
10827
|
+
const startSlices = [[0.25,0.75],[0.25,0.75]];
|
|
10828
|
+
const startTypes = [[0,2,0],[0,1,0]]; // middle is tiled horizontally and stretched vertically
|
|
10829
10829
|
const slicer = new Slicer({
|
|
10830
10830
|
obj:pic.clone(), // slicer will adjust obj so clone the pic so can use it unaffected later
|
|
10831
10831
|
scale:.5,
|
|
@@ -17592,36 +17592,35 @@ Note the points property has been split into points and pointObjects (and there
|
|
|
17592
17592
|
};
|
|
17593
17593
|
|
|
17594
17594
|
// squiggle
|
|
17595
|
-
if (that.interactive) {
|
|
17596
|
-
|
|
17597
|
-
|
|
17598
|
-
|
|
17599
|
-
|
|
17600
|
-
|
|
17601
|
-
|
|
17602
|
-
|
|
17603
|
-
|
|
17604
|
-
|
|
17605
|
-
|
|
17606
|
-
|
|
17607
|
-
|
|
17608
|
-
|
|
17609
|
-
|
|
17610
|
-
|
|
17611
|
-
|
|
17612
|
-
|
|
17613
|
-
|
|
17614
|
-
|
|
17615
|
-
|
|
17616
|
-
|
|
17617
|
-
|
|
17618
|
-
|
|
17619
|
-
|
|
17620
|
-
|
|
17621
|
-
});
|
|
17595
|
+
if (that.interactive && move) shape.drag({onTop:false});
|
|
17596
|
+
moveDownEvent = shape.on("mousedown", function(e) {
|
|
17597
|
+
stage = e.target.stage;
|
|
17598
|
+
startPosition = {x:shape.x, y:shape.y};
|
|
17599
|
+
if (that.selectPoints) that.keyFocus = true;
|
|
17600
|
+
upTop();
|
|
17601
|
+
});
|
|
17602
|
+
movePressEvent = shape.on("pressmove", function() {
|
|
17603
|
+
sets.x = shape.x;
|
|
17604
|
+
sets.y = shape.y;
|
|
17605
|
+
sticks.x = shape.x;
|
|
17606
|
+
sticks.y = shape.y;
|
|
17607
|
+
});
|
|
17608
|
+
moveUpEvent = shape.on("pressup", function() {
|
|
17609
|
+
var moveControlCheck = (shape.x != startPosition.x || shape.y != startPosition.y);
|
|
17610
|
+
var movePoint = shape.localToLocal(that.regX,that.regY,that.parent);
|
|
17611
|
+
that.x = movePoint.x;
|
|
17612
|
+
that.y = movePoint.y;
|
|
17613
|
+
sets.x = sets.y = sticks.x = sticks.y = shape.x = shape.y = 0;
|
|
17614
|
+
if (moveControlCheck) {
|
|
17615
|
+
var ev = new createjs.Event("change");
|
|
17616
|
+
ev.controlType = "move";
|
|
17617
|
+
that.dispatchEvent(ev);
|
|
17618
|
+
}
|
|
17619
|
+
if (stage) stage.update();
|
|
17620
|
+
});
|
|
17622
17621
|
|
|
17623
|
-
|
|
17624
|
-
|
|
17622
|
+
if (!that.move) stopDragging(true); // true is first time
|
|
17623
|
+
|
|
17625
17624
|
|
|
17626
17625
|
function upTop() {
|
|
17627
17626
|
if (that.onTop) {
|
|
@@ -27649,6 +27648,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
27649
27648
|
if (replace) that.contentContainer.removeAllChildren();
|
|
27650
27649
|
if (center) obj.center(that.contentContainer, index);
|
|
27651
27650
|
else obj.addTo(that.contentContainer, index);
|
|
27651
|
+
// addHTML(that.contentContainer);
|
|
27652
27652
|
return that;
|
|
27653
27653
|
}
|
|
27654
27654
|
|
|
@@ -31526,10 +31526,10 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
|
|
|
31526
31526
|
},
|
|
31527
31527
|
set: function(value) {
|
|
31528
31528
|
readOnly = value;
|
|
31529
|
-
that.htmlTag.
|
|
31529
|
+
that.htmlTag.readOnly = readOnly;
|
|
31530
31530
|
}
|
|
31531
31531
|
});
|
|
31532
|
-
if (readOnly) that.readOnly = true;
|
|
31532
|
+
if (readOnly) that.htmlTag.readOnly = true;
|
|
31533
31533
|
|
|
31534
31534
|
Object.defineProperty(that, 'focus', {
|
|
31535
31535
|
get: function() {
|
|
@@ -32144,9 +32144,10 @@ list - (default Options 1-30) an array of strings, numbers or zim Label objects
|
|
|
32144
32144
|
note: the Accordion List is currently incompatible with the Organizer, addTo() and removeFrom()
|
|
32145
32145
|
viewNum - (default 5) how many items to show in the width and height provided
|
|
32146
32146
|
adjusting this number will also change the overall scale of custom items for horizontal lists
|
|
32147
|
-
|
|
32147
|
+
(this does not affect vertical lists due to the way vertical tabs are optimized)
|
|
32148
32148
|
or see the noScale parameter to avoid scaling custom items in horizontal lists
|
|
32149
32149
|
if no items are provided to start but rather added with addAt() then choose a viewNum that roughly matches how many items will fit in the view
|
|
32150
|
+
Note - the items will not be scaled larger by a viewNum setting... only scaled smaller.
|
|
32150
32151
|
vertical - (default true) set to false to make a horizontal list
|
|
32151
32152
|
currentSelected - (default false) set to true to show the current selection as highlighted
|
|
32152
32153
|
align - (default CENTER) horizontal align
|
|
@@ -32171,8 +32172,8 @@ borderColor - (default silver) border color
|
|
|
32171
32172
|
borderWidth - (default 1) the thickness of the border
|
|
32172
32173
|
padding - (default 0) places the content in from edges of border (see paddingH and paddingV)
|
|
32173
32174
|
corner - (default 0) is the rounded corner of the list (does not accept corner array - scrollBars are too complicated)
|
|
32174
|
-
swipe - (default
|
|
32175
|
-
also can set swipe to just
|
|
32175
|
+
swipe - (default AUTO/true) the direction for swiping set to NONE / false for no swiping
|
|
32176
|
+
also can set swipe to just VERTICAL or HORIZONTAL
|
|
32176
32177
|
scrollBarActive - (default true) shows scrollBar (set to false to not)
|
|
32177
32178
|
scrollBarDrag - (default true) set to false to not be able to drag the scrollBar
|
|
32178
32179
|
scrollBarColor - (default borderColor) the color of the scrollBar
|
|
@@ -34084,18 +34085,23 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
34084
34085
|
|
|
34085
34086
|
if (zot(align)) align = DS.align!=null?DS.align:"center";
|
|
34086
34087
|
if (zot(spacing)) spacing = DS.spacing!=null?DS.spacing:2;
|
|
34087
|
-
if (zot(backgroundColor)) backgroundColor = DS.backgroundColor!=null?DS.backgroundColor:zim.tin;
|
|
34088
|
+
if (zot(backgroundColor)) backgroundColor = DS.backgroundColor!=null?DS.backgroundColor:zim.tin;
|
|
34088
34089
|
if (zot(rollBackgroundColor)) rollBackgroundColor = DS.rollBackgroundColor!=null?DS.rollBackgroundColor:zim.grey;
|
|
34089
34090
|
if (zot(selectedBackgroundColor)) selectedBackgroundColor = DS.selectedBackgroundColor!=null?DS.selectedBackgroundColor:zim.charcoal;
|
|
34090
34091
|
if (zot(selectedRollBackgroundColor)) selectedRollBackgroundColor = DS.selectedRollBackgroundColor!=null?DS.selectedRollBackgroundColor:zim.grey;
|
|
34091
|
-
if (zot(color)) color = DS.color!=null?DS.color:zim.white;
|
|
34092
|
+
if (zot(color)) color = DS.color!=null?DS.color:zim.white;
|
|
34092
34093
|
if (zot(rollColor)) rollColor = DS.rollColor!=null?DS.rollColor:color;
|
|
34093
34094
|
if (zot(selectedColor)) selectedColor = DS.selectedColor!=null?DS.selectedColor:color;
|
|
34094
34095
|
if (zot(selectedRollColor)) selectedRollColor = DS.selectedRollColor!=null?DS.selectedRollColor:rollColor;
|
|
34095
34096
|
|
|
34096
34097
|
var c = new zim.Container();
|
|
34097
34098
|
c.type = "CheckItem";
|
|
34098
|
-
|
|
34099
|
+
label = zik(label);
|
|
34100
|
+
rollColor = zik(rollColor);
|
|
34101
|
+
selectedColor = zik(selectedColor);
|
|
34102
|
+
rollBackgroundColor = zik(rollBackgroundColor);
|
|
34103
|
+
|
|
34104
|
+
c.checkBox = new zim.CheckBox({size:size, label:label, color:color, tap:true});
|
|
34099
34105
|
c.backing = new zim.Rectangle(width-spacing*2, c.checkBox.height+paddingV*2, backgroundColor).addTo(c);
|
|
34100
34106
|
c.checkBox.center(c);
|
|
34101
34107
|
if (align != "center" && align != "middle") c.checkBox.pos(paddingH,null,align=="right");
|
|
@@ -36410,7 +36416,7 @@ NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set
|
|
|
36410
36416
|
|
|
36411
36417
|
EXAMPLE
|
|
36412
36418
|
// slice a pic in four at 25% from the edges, scale the middle and keep the sides and corners not scaled.
|
|
36413
|
-
const pic = new Pic("
|
|
36419
|
+
const pic = new Pic("pic.png"); // preload this in Frame() or loadAssets()
|
|
36414
36420
|
const slicer = new Slicer({
|
|
36415
36421
|
obj:pic.clone(), // slicer will adjust obj so clone the pic so can use it unaffected later
|
|
36416
36422
|
scale:.5,
|
|
@@ -36421,7 +36427,7 @@ const slicer = new Slicer({
|
|
|
36421
36427
|
|
|
36422
36428
|
slicer.on("loaded", ()=>{
|
|
36423
36429
|
if (preview) preview.dispose();
|
|
36424
|
-
preview = new
|
|
36430
|
+
preview = new SlicedBitmap(1600, 600, slicer.obj.clone(), slicer.slices, slicer.types, 2, .5)
|
|
36425
36431
|
.pos(0,100,CENTER,BOTTOM)
|
|
36426
36432
|
.transform({minScaleX:.05, minScaleY:.05});
|
|
36427
36433
|
});
|
|
@@ -36947,6 +36953,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36947
36953
|
loader.resize();
|
|
36948
36954
|
}
|
|
36949
36955
|
adjustBoxes();
|
|
36956
|
+
|
|
36950
36957
|
if (obj.width) {
|
|
36951
36958
|
obj.scaleTo(that.box,100,100).loc(0,0,sc,0);
|
|
36952
36959
|
that.stage.update();
|
|
@@ -36955,7 +36962,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36955
36962
|
obj.scaleTo(that.box,100,100).loc(0,0,sc,0);
|
|
36956
36963
|
that.stage.update();
|
|
36957
36964
|
}, 50);
|
|
36958
|
-
}
|
|
36965
|
+
}
|
|
36966
|
+
|
|
36959
36967
|
}
|
|
36960
36968
|
if (resize) {
|
|
36961
36969
|
that.resizeHandle.on("pressup", function() {
|
|
@@ -37157,7 +37165,7 @@ NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set
|
|
|
37157
37165
|
|
|
37158
37166
|
EXAMPLE
|
|
37159
37167
|
// slice a pic in four at 25% from the edges, scale the middle and keep the sides and corners not scaled.
|
|
37160
|
-
const pic = new Pic("
|
|
37168
|
+
const pic = new Pic("pic.png"); // preload this in Frame() or loadAssets()
|
|
37161
37169
|
const slicer = new Slicer({
|
|
37162
37170
|
obj:pic.clone(), // slicer will adjust obj so clone the pic so can use it unaffected later
|
|
37163
37171
|
scale:.5,
|
|
@@ -51214,6 +51222,8 @@ RETURNS obj for chaining
|
|
|
51214
51222
|
target.addAt(placeObject, target.dropReticleIndex);
|
|
51215
51223
|
|
|
51216
51224
|
target.dropItem = dragObject;
|
|
51225
|
+
dragObject.droppedTarget = target;
|
|
51226
|
+
dragObject.dropTarget = target;
|
|
51217
51227
|
target.dropList = target;
|
|
51218
51228
|
target.dropNewIndex = target.dropReticleIndex;
|
|
51219
51229
|
target.dropReticleIndex = null;
|
|
@@ -51238,6 +51248,7 @@ RETURNS obj for chaining
|
|
|
51238
51248
|
else placeObject.mouse();
|
|
51239
51249
|
if (dropFull) target.dropFull = true;
|
|
51240
51250
|
placeObject.droppedTarget = target;
|
|
51251
|
+
placeObject.dropTarget = target;
|
|
51241
51252
|
return false;
|
|
51242
51253
|
}
|
|
51243
51254
|
}
|
|
@@ -53912,7 +53923,7 @@ Dynamically changes or adds a boundary rectangle to the object being dragged wit
|
|
|
53912
53923
|
|
|
53913
53924
|
EXAMPLE
|
|
53914
53925
|
const boundary = new Boundary(100,100,500,400); // x,y,w,h
|
|
53915
|
-
|
|
53926
|
+
new Circle().center().gestureBoundary(boundary);
|
|
53916
53927
|
END EXAMPLE
|
|
53917
53928
|
|
|
53918
53929
|
PARAMETERS
|
|
@@ -93299,9 +93310,11 @@ Or, the Three class can be used to help show ZIM in threejs
|
|
|
93299
93310
|
as an interactive and animated canavs texture.
|
|
93300
93311
|
See also TextureActive and TextureActives in the main ZIM docs.
|
|
93301
93312
|
|
|
93313
|
+
See: https://zimjs.com/three - for the mini-site with three.js
|
|
93314
|
+
|
|
93302
93315
|
three.js examples - with three.js inside ZIM
|
|
93303
93316
|
https://zimjs.com/bits/view/three.html
|
|
93304
|
-
https://zimjs.com/three/
|
|
93317
|
+
https://zimjs.com/capture/three/
|
|
93305
93318
|
https://codepen.io/zimjs/pen/abzXeZX
|
|
93306
93319
|
https://codepen.io/zimjs/pen/qGPVqO
|
|
93307
93320
|
|