zimjs 17.0.1 → 17.0.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/package.json +1 -1
- package/src/zim.js +147 -40
- package/ts-src/typings/zim/index.d.ts +5 -19
package/package.json
CHANGED
package/src/zim.js
CHANGED
|
@@ -5317,7 +5317,7 @@ zog(decimals(1.8345, 2)); // 1.83
|
|
|
5317
5317
|
zog(decimals(123,-1)); // 120
|
|
5318
5318
|
zog(decimals(2.3,null,2)); // 2.30
|
|
5319
5319
|
zog(decimals(3,null,null,2)); // 03
|
|
5320
|
-
zog(decimals(
|
|
5320
|
+
zog(decimals(12/60,2,2,1,null,true)); // 0:12
|
|
5321
5321
|
END EXAMPLE
|
|
5322
5322
|
|
|
5323
5323
|
PARAMETERS
|
|
@@ -5327,6 +5327,7 @@ addZeros - (default 0) set to number of places to fill in zeros after decimal (a
|
|
|
5327
5327
|
addZerosBefore - (default 1) set to number of places to fill in zeros before decimal (and return String)
|
|
5328
5328
|
includeZero - (default true) set to false to always have zero just be 0 without any extra zeros
|
|
5329
5329
|
time - (default false) a swap of : for . to handle minutes and seconds (not hours)
|
|
5330
|
+
take time in seconds and divide by 60 and pass that in for num
|
|
5330
5331
|
|
|
5331
5332
|
RETURNS a rounded Number or a String if addZeros, addZerosBefore or time is true
|
|
5332
5333
|
--*///+13
|
|
@@ -10468,6 +10469,7 @@ width - gets or sets the width. Setting the width will scale the height to keep
|
|
|
10468
10469
|
height - gets or sets the height. Setting the height will scale the width to keep proportion (see heightOnly below)
|
|
10469
10470
|
widthOnly - gets or sets the width. This sets only the width and may change the aspect ratio of the object
|
|
10470
10471
|
heightOnly - gets or sets the height. This sets only the height and may change the aspect ratio of the object
|
|
10472
|
+
cacheScale - get the requested scale parameter or if cached, the cache scale
|
|
10471
10473
|
draggable - set to true for a default drag() and false for a noDrag()
|
|
10472
10474
|
level - gets or sets the level of the object in its parent container (or the stage) - a property for parent.getChildIndex() and parent.setChildIndex()
|
|
10473
10475
|
depth - for ZIM VR - the depth used to shift left and right channel and for parallax in VR - also see dep() ZIM Display method
|
|
@@ -10520,7 +10522,9 @@ zim.Bitmap = function(image, width, height, left, top, scale, style, group, inhe
|
|
|
10520
10522
|
|
|
10521
10523
|
var that = this;
|
|
10522
10524
|
this.type = "Bitmap";
|
|
10523
|
-
if (!zot(width) && !zot(height)) this.setBounds(0,0,width,height);
|
|
10525
|
+
if (!zot(width) && !zot(height)) this.setBounds(0,0,width*scale,height*scale);
|
|
10526
|
+
|
|
10527
|
+
this.cacheScale = scale;
|
|
10524
10528
|
|
|
10525
10529
|
this.drawImageData = function(x, y, sourceX, sourceY, sourceWidth, sourceHeight) {
|
|
10526
10530
|
if (zot(x)) x = 0;
|
|
@@ -10607,6 +10611,7 @@ zim.Bitmap = function(image, width, height, left, top, scale, style, group, inhe
|
|
|
10607
10611
|
var sig = "a,b,c,d,scale,options,rtl,willReadFrequently";
|
|
10608
10612
|
var duo; if (duo = zob(that.cache, arguments, sig)) return duo;
|
|
10609
10613
|
var bounds;
|
|
10614
|
+
that.cacheScale = scale;
|
|
10610
10615
|
if (zot(c)) {
|
|
10611
10616
|
if (zot(a)) {
|
|
10612
10617
|
bounds = this.getBounds();
|
|
@@ -27138,7 +27143,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
27138
27143
|
});
|
|
27139
27144
|
var titleBarLabel = that.titleBarLabel = t;
|
|
27140
27145
|
if (zot(tBarBackgroundColor)) tBarBackgroundColor = "rgba(0,0,0,.2)";
|
|
27141
|
-
that.titleBar = titleBar = new zim.Container(width, titleBarHeight, null, null, false).loc(0,
|
|
27146
|
+
that.titleBar = titleBar = new zim.Container(width, titleBarHeight, null, null, false).loc(0,-borderWidth/2,that);
|
|
27142
27147
|
var titleBarRect = that.titleBar.backing = new zim.Rectangle(width+borderWidth, titleBarHeight, tBarBackgroundColor, null, null, [corner[0]*.95, corner[1]*.95, 0, 0], true, null, null, false).center(titleBar);
|
|
27143
27148
|
if (titleBar) positionBar();
|
|
27144
27149
|
that.label = t;
|
|
@@ -30810,7 +30815,7 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
|
|
|
30810
30815
|
that.stage.update();
|
|
30811
30816
|
}
|
|
30812
30817
|
}
|
|
30813
|
-
if (placeholderInstant &&
|
|
30818
|
+
if (placeholderInstant && that.placeholderLabel.parent) {
|
|
30814
30819
|
that.placeholderLabel.removeFrom();
|
|
30815
30820
|
if (that.stage) that.stage.update();
|
|
30816
30821
|
}
|
|
@@ -31235,7 +31240,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
|
|
|
31235
31240
|
var paddingH = this.backing || this.background ? this.paddingH : 0;
|
|
31236
31241
|
var paddingV = this.backing || this.background ? this.paddingV : 0;
|
|
31237
31242
|
|
|
31238
|
-
if (this.hiddenInput.selectionStart !== this.hiddenInput.selectionEnd) {
|
|
31243
|
+
if (this.hiddenInput.selectionStart !== this.hiddenInput.selectionEnd || le == 0) {
|
|
31239
31244
|
var startX, endX;
|
|
31240
31245
|
if (rtl) {
|
|
31241
31246
|
startX = this.textWidthArray[le-this.hiddenInput.selectionStart]
|
|
@@ -31255,8 +31260,10 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
|
|
|
31255
31260
|
}
|
|
31256
31261
|
this.blinker.heightOnly = this.textHeight;
|
|
31257
31262
|
var xIdx = this.hiddenInput.selectionDirection === "backward" ? this.hiddenInput.selectionStart : this.hiddenInput.selectionEnd;
|
|
31258
|
-
if (!xIdx) xIdx = 0; // ZIM NFT 00 Patch
|
|
31263
|
+
// if (!xIdx) xIdx = 0; // ZIM NFT 00 Patch
|
|
31264
|
+
if (xIdx==null) xIdx = le; // ZIM 017 Patch
|
|
31259
31265
|
if (rtl) xIdx = le-xIdx;
|
|
31266
|
+
|
|
31260
31267
|
this.blinker.pos(this.textWidthArray[xIdx] + paddingH - 1 + ((align=="right" && this.text == "")?this.width:(align=="center" && this.text == "")?this.width/2:0) + shiftH, paddingV+shiftV);
|
|
31261
31268
|
this.dispatchEvent("blinker");
|
|
31262
31269
|
}
|
|
@@ -32985,6 +32992,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32985
32992
|
target.zgb = target.boundsToGlobal();
|
|
32986
32993
|
target.zgs = target.getConcatenatedDisplayProps().matrix.decompose().scaleX/frame.stage.scaleX;
|
|
32987
32994
|
});
|
|
32995
|
+
return that;
|
|
32988
32996
|
}
|
|
32989
32997
|
|
|
32990
32998
|
Object.defineProperty(that, 'dropTargets', {
|
|
@@ -34523,7 +34531,7 @@ expandBarVertical - (default 0 or 20 for horizontal) set to value to expand the
|
|
|
34523
34531
|
useLabels - (default false) - add Labels to ticks if useTicks is true - can apply STYLE
|
|
34524
34532
|
labelMargin - (default 20) - distance from ticks to Label if useLabels is true
|
|
34525
34533
|
labelColor - (default 20) - distance from ticks to Label if useLabels is true
|
|
34526
|
-
range - (default
|
|
34534
|
+
range - (default false) set to true to change to a range slider with two circle buttons
|
|
34527
34535
|
this will provide read and write rangeMin, rangeMax and rangeAve values instead of value
|
|
34528
34536
|
also will provide a read only rangeAmount
|
|
34529
34537
|
rangeBar, rangeSliderA, rangeSliderB, rangeButtonA and rangeButtonB properties will be added
|
|
@@ -59713,7 +59721,7 @@ transition - (default "none") the type of transition "none", "reveal", "slide",
|
|
|
59713
59721
|
NOTE: if using pages that are smaller than the stage, use a Rectangle() as the holder
|
|
59714
59722
|
and the transition effects will be automatically masked by the rectangle.
|
|
59715
59723
|
speed - (default .2) speed in seconds of the transition if set (see also ZIM TIME constant)
|
|
59716
|
-
transitionTable - (default none) an array to override general transitions with following format:
|
|
59724
|
+
transitionTable - (default "none") an array to override general transitions with following format:
|
|
59717
59725
|
[[fromPage, toPage, "transition", seconds(optional)], etc.]
|
|
59718
59726
|
holder - (default the default stage) where are we putting the pages (used for setting transition properties)
|
|
59719
59727
|
If using pages that are smaller than the stage
|
|
@@ -60512,6 +60520,7 @@ Additional "mousedown", "click" or other button events can be added if desired
|
|
|
60512
60520
|
this.group = group;
|
|
60513
60521
|
var DS = style===false?{}:zim.getStyle("Arrow", this.group, inherit);
|
|
60514
60522
|
|
|
60523
|
+
if (zot(pages)) pages = DS.pages!=null?DS.pages:null;
|
|
60515
60524
|
if (zot(direction)) direction = DS.direction!=null?DS.direction:"right";
|
|
60516
60525
|
if (zot(backgroundColor)) backgroundColor = DS.backgroundColor!=null?DS.backgroundColor:zim.blue;
|
|
60517
60526
|
this.arrowBackgroundColor = backgroundColor;
|
|
@@ -62850,8 +62859,8 @@ note: the item is not the event object target - as that is the tile
|
|
|
62850
62859
|
if (!zot(width)) colSize = null; // width and height override sizes
|
|
62851
62860
|
if (!zot(height)) rowSize = null;
|
|
62852
62861
|
|
|
62853
|
-
if (zot(spacingH)) spacingH = DS.spacingH!=null?DS.spacingH:
|
|
62854
|
-
if (zot(spacingV)) spacingV = DS.spacingV!=null?DS.spacingV:
|
|
62862
|
+
if (zot(spacingH)) spacingH = DS.spacingH!=null?DS.spacingH:null;
|
|
62863
|
+
if (zot(spacingV)) spacingV = DS.spacingV!=null?DS.spacingV:null;
|
|
62855
62864
|
var spacingHO = spacingH;
|
|
62856
62865
|
var spacingVO = spacingV;
|
|
62857
62866
|
if (zot(spacingH) || !zot(colSize) || !zot(width)) spacingH = 0; // sizes override spacing
|
|
@@ -70718,7 +70727,7 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
|
|
|
70718
70727
|
if (target.type == "Pen") target.write = false;
|
|
70719
70728
|
mouseEvent = stage.on("stagemousedown", function(e) {
|
|
70720
70729
|
var pp;
|
|
70721
|
-
|
|
70730
|
+
if (target.type == "Pen" && target.draggingCheck) zogb();
|
|
70722
70731
|
var con;
|
|
70723
70732
|
if (!mouseOutside && that.boundary && !that.boundary.type=="Blob") con = that.boundary;
|
|
70724
70733
|
else if (!mouseOutside && container && container.boundsToGlobal) con = container.boundsToGlobal();
|
|
@@ -70873,7 +70882,7 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
|
|
|
70873
70882
|
function moveMe() {
|
|
70874
70883
|
var p = container.globalToLocal(that.moveX, that.moveY);
|
|
70875
70884
|
that.x = p.x; that.y = p.y;
|
|
70876
|
-
calculate();
|
|
70885
|
+
calculate();
|
|
70877
70886
|
if (target.type == "Pen" && !moveCheck && target.drawing) moveCheck = true;
|
|
70878
70887
|
}
|
|
70879
70888
|
|
|
@@ -70957,6 +70966,7 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
|
|
|
70957
70966
|
var lastDirY=0;
|
|
70958
70967
|
|
|
70959
70968
|
var mainTicker = zim.Ticker.add(function() {
|
|
70969
|
+
if (target.draggingCheck) return;
|
|
70960
70970
|
if (type == "manual") calculate();
|
|
70961
70971
|
if (that.boundary && that.boundary.type!="Blob") {
|
|
70962
70972
|
that.x = zim.constrain(that.x, that.boundary.x, that.boundary.x+that.boundary.width);
|
|
@@ -74926,46 +74936,45 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
74926
74936
|
that.setMask(that.backing);
|
|
74927
74937
|
peel.addTo(that);
|
|
74928
74938
|
peel.c().f(zim.black).dr(0,0,0,0);
|
|
74929
|
-
that.moving = false;
|
|
74939
|
+
that.moving = false;
|
|
74930
74940
|
|
|
74931
74941
|
// backwards
|
|
74932
74942
|
if (pages[num-1]) {
|
|
74933
|
-
leftPage = pages[num-1].reg(0,0).rot(0).loc(0,0,that);
|
|
74943
|
+
leftPage = pages[num-1].reg(0,0).rot(0).loc(0,0,that).setMask(null);
|
|
74934
74944
|
} else if (num > 0) {
|
|
74935
74945
|
lastPage.reg(0,0).rot(0).loc(0,0,that).setMask(null);
|
|
74936
74946
|
}
|
|
74937
74947
|
|
|
74938
74948
|
if (pages[num-2]) {
|
|
74939
|
-
pageFore = pages[num-2].reg(width/2,height).loc(0,height,that).rot(-90);
|
|
74949
|
+
pageFore = pages[num-2].reg(width/2,height).loc(0,height,that).rot(-90).setMask(null);
|
|
74940
74950
|
} else {
|
|
74941
|
-
pageFore = new zim.Rectangle(width/2,height,backgroundColor).reg(width/2,height).loc(0,height,that).rot(-90);
|
|
74951
|
+
pageFore = new zim.Rectangle(width/2,height,backgroundColor).reg(width/2,height).loc(0,height,that).rot(-90).setMask(null);
|
|
74942
74952
|
}
|
|
74943
74953
|
if (pages[num-3]) {
|
|
74944
|
-
pagePrev = pages[num-3].rot(0).loc(0,0,that).setMask(peel);
|
|
74954
|
+
pagePrev = pages[num-3].reg(0,0).rot(0).loc(0,0,that).setMask(peel);
|
|
74945
74955
|
} else {
|
|
74946
|
-
pagePrev = new zim.Rectangle(width/2,height,backgroundColor).loc(0,0,that).setMask(peel);
|
|
74956
|
+
pagePrev = new zim.Rectangle(width/2,height,backgroundColor).reg(0,0).rot(0).loc(0,0,that).setMask(peel);
|
|
74947
74957
|
}
|
|
74948
74958
|
|
|
74949
74959
|
// forewards
|
|
74950
74960
|
if (pages[num]) {
|
|
74951
|
-
rightPage = pages[num].rot(0).reg(0,0).pos(0,0,zim.RIGHT,zim.TOP,that);
|
|
74961
|
+
rightPage = pages[num].rot(0).reg(0,0).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(null);
|
|
74952
74962
|
} else {
|
|
74953
74963
|
// need to make a first or last page here
|
|
74954
74964
|
stage.update();
|
|
74955
74965
|
return;
|
|
74956
74966
|
}
|
|
74957
74967
|
if (pages[num+1]) {
|
|
74958
|
-
pageBack = that.backNext = pages[num+1].reg(0,height).loc(width,height,that).rot(90);
|
|
74968
|
+
pageBack = that.backNext = pages[num+1].reg(0,height).loc(width,height,that).rot(90).setMask(null);
|
|
74959
74969
|
} else {
|
|
74960
|
-
pageBack = that.backNext = new zim.Rectangle(width/2,height,backgroundColor).reg(0,height).loc(width,height,that).rot(90);
|
|
74970
|
+
pageBack = that.backNext = new zim.Rectangle(width/2,height,backgroundColor).reg(0,height).loc(width,height,that).rot(90).setMask(null);
|
|
74961
74971
|
lastPage = pageBack;
|
|
74962
74972
|
}
|
|
74963
74973
|
if (pages[num+2]) {
|
|
74964
|
-
pageNext = that.backPrev = pages[num+2].rot(0).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(peel);
|
|
74974
|
+
pageNext = that.backPrev = pages[num+2].reg(0,0).rot(0).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(peel);
|
|
74965
74975
|
} else {
|
|
74966
|
-
pageNext = that.backPrev = new zim.Rectangle(width/2,height,backgroundColor).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(peel);
|
|
74967
|
-
}
|
|
74968
|
-
stage.update();
|
|
74976
|
+
pageNext = that.backPrev = new zim.Rectangle(width/2,height,backgroundColor).reg(0,0).rot(0).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(peel);
|
|
74977
|
+
}
|
|
74969
74978
|
}
|
|
74970
74979
|
toPage(startPage);
|
|
74971
74980
|
|
|
@@ -74974,17 +74983,30 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
74974
74983
|
return that._currentPage;
|
|
74975
74984
|
},
|
|
74976
74985
|
set: function(num) {
|
|
74977
|
-
offHTML();
|
|
74986
|
+
offHTML();
|
|
74978
74987
|
if (startPage%2==1) {
|
|
74979
|
-
num = Math.
|
|
74988
|
+
num = Math.floor(num/2)*2+1
|
|
74980
74989
|
} else {
|
|
74981
74990
|
num = Math.ceil(num/2)*2
|
|
74982
74991
|
}
|
|
74983
|
-
|
|
74984
|
-
|
|
74992
|
+
num = zim.constrain(num, 0, that.pages.length-1);
|
|
74993
|
+
|
|
74994
|
+
that.currentW = 0;
|
|
74995
|
+
that.currentH = 0;
|
|
74996
|
+
that.lastPage = zim.constrain(that._currentPage);
|
|
74997
|
+
|
|
74998
|
+
if (num==that.page) return;
|
|
74999
|
+
|
|
75000
|
+
else if (num>that.page) {
|
|
75001
|
+
that.direction = "right";
|
|
75002
|
+
that.pageNext = pageNext.zimBookIndex;
|
|
75003
|
+
|
|
74985
75004
|
pageBack.reg(0,0);
|
|
74986
75005
|
pageNext.setMask(null);
|
|
74987
|
-
} else {
|
|
75006
|
+
} else {
|
|
75007
|
+
that.direction = "left";
|
|
75008
|
+
that.pageNext = pageFore.zimBookIndex;
|
|
75009
|
+
|
|
74988
75010
|
pageFore.reg(0,0);
|
|
74989
75011
|
pagePrev.setMask(null);
|
|
74990
75012
|
}
|
|
@@ -75186,7 +75208,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
75186
75208
|
call:function () {
|
|
75187
75209
|
zim.Ticker.remove(ticker);
|
|
75188
75210
|
pageBack.reg(0,0);
|
|
75189
|
-
pageNext.setMask(null);
|
|
75211
|
+
pageNext.setMask(null);
|
|
75190
75212
|
toPage(that._currentPage+2);
|
|
75191
75213
|
that.moving = false;
|
|
75192
75214
|
turningCheck = false;
|
|
@@ -75240,7 +75262,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
75240
75262
|
that.dispatchEvent("page");
|
|
75241
75263
|
}
|
|
75242
75264
|
});
|
|
75243
|
-
var ticker = zim.Ticker.add(function() {
|
|
75265
|
+
var ticker = zim.Ticker.add(function() {
|
|
75244
75266
|
peel
|
|
75245
75267
|
.c()
|
|
75246
75268
|
.mt(0, height)
|
|
@@ -75289,7 +75311,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
75289
75311
|
if (zot(that.rollUp)) {setTimeout(function () {that.prevPage(speed);}, 10); return that;}
|
|
75290
75312
|
if (that.moving) return;
|
|
75291
75313
|
that.rollUp(width/2+.1, height+.1, "left", speed, "quadIn");
|
|
75292
|
-
}
|
|
75314
|
+
}
|
|
75293
75315
|
that.gotoPage = function(num, speed) {
|
|
75294
75316
|
if (zot(that.rollUp)) {setTimeout(function () {that.gotoPage(num, speed);}, 10); return that;}
|
|
75295
75317
|
num = zim.constrain(num, 0, that.pages.length-1);
|
|
@@ -78981,6 +79003,49 @@ pen.animate({
|
|
|
78981
79003
|
})
|
|
78982
79004
|
END EXAMPLE
|
|
78983
79005
|
|
|
79006
|
+
EXAMPLE
|
|
79007
|
+
// A Pen used on two different Pages with ZIM Pages
|
|
79008
|
+
// See https://zimjs.com/zapp/Z_VKB33
|
|
79009
|
+
|
|
79010
|
+
const page1 = new Page(W,H,orange,red);
|
|
79011
|
+
page1.paper = new Container(W,H).addTo(page1);
|
|
79012
|
+
const page2 = new Page(W,H,pink,purple);
|
|
79013
|
+
page2.paper = new Container(W,H).addTo(page2);
|
|
79014
|
+
|
|
79015
|
+
const pages = new Pages([page1, page2]).addTo();
|
|
79016
|
+
pages.active = false; // so drawing does not accidentally swipe pages
|
|
79017
|
+
|
|
79018
|
+
STYLE = {
|
|
79019
|
+
Arrow: {
|
|
79020
|
+
type:"angle",
|
|
79021
|
+
pages:pages,
|
|
79022
|
+
direction:series(RIGHT, LEFT),
|
|
79023
|
+
trans:"fan",
|
|
79024
|
+
rotation:series(0,180)
|
|
79025
|
+
}
|
|
79026
|
+
}
|
|
79027
|
+
const next = new Arrow().pos(50,50,RIGHT,BOTTOM);
|
|
79028
|
+
const prev = new Arrow().pos(50,50,LEFT,BOTTOM);
|
|
79029
|
+
|
|
79030
|
+
const pen = new Pen({
|
|
79031
|
+
paper:page1.paper,
|
|
79032
|
+
size:20,
|
|
79033
|
+
color:series(white,black)
|
|
79034
|
+
}).addTo();
|
|
79035
|
+
|
|
79036
|
+
// switch papers
|
|
79037
|
+
pages.on("page", ()=>{
|
|
79038
|
+
pen.paper = pages.page.paper;
|
|
79039
|
+
});
|
|
79040
|
+
|
|
79041
|
+
new MotionController({
|
|
79042
|
+
target:pen,
|
|
79043
|
+
type:"pressmove",
|
|
79044
|
+
speed:40,
|
|
79045
|
+
mousedownIncludes:[pages] // so will track mouse on pages
|
|
79046
|
+
});
|
|
79047
|
+
END EXAMPLE
|
|
79048
|
+
|
|
78984
79049
|
PARAMETERS
|
|
78985
79050
|
** supports DUO - parameters or single object with properties below
|
|
78986
79051
|
** supports VEE - parameters marked with ZIM VEE mean a zim Pick() object or Pick Literal can be passed
|
|
@@ -79041,12 +79106,8 @@ saveState(obj, startLayer, endLayer) - record an undo state for the paper or a l
|
|
|
79041
79106
|
startLayer and endLayer are for if the layer level of the shape changes
|
|
79042
79107
|
undo() - go back one undo state (called automatically by CTRL Z if undoKeys is true - default)
|
|
79043
79108
|
redo() - go forward one undo state (called automatically by CTRL Y or CTRL SHIFT Z if undoKeys is true - default)
|
|
79044
|
-
delete(index) - delete a line segment at a given index (actually sets its alpha to 0 to maintain layers on undo)
|
|
79045
|
-
use: pen.paper.on("mousedown", function (e) {
|
|
79046
|
-
pen.delete(paper.getChildIndex(e.target)); // for instance
|
|
79047
|
-
})
|
|
79048
79109
|
deleteSegment(object) - delete a line segment object
|
|
79049
|
-
use: pen.paper.on("mousedown",
|
|
79110
|
+
use: pen.paper.on("mousedown", e => {
|
|
79050
79111
|
pen.deleteSegment(e.target); // for instance
|
|
79051
79112
|
})
|
|
79052
79113
|
clone() - clone the pen (note there is no exact clone)
|
|
@@ -79709,6 +79770,7 @@ dispatches an "undo" and a "redo" whenever undo and redo happens
|
|
|
79709
79770
|
});
|
|
79710
79771
|
paper.drag({onTop:onTop});
|
|
79711
79772
|
paper.on("pressup", function (e) {
|
|
79773
|
+
that.draggingCheck = false;
|
|
79712
79774
|
if (deleteable && that.shiftKey) return;
|
|
79713
79775
|
// if (e.target.alpha == 0) return;
|
|
79714
79776
|
if (e.target.visible == false) return;
|
|
@@ -82523,6 +82585,18 @@ EXAMPLE
|
|
|
82523
82585
|
new Pane({content:"START", keyboardAccess:true}).show();
|
|
82524
82586
|
END EXAMPLE
|
|
82525
82587
|
|
|
82588
|
+
EXAMPLE
|
|
82589
|
+
// dynamically adjusting touch - there are also touch and singleTouch parameters of Frame
|
|
82590
|
+
// also, drag() has its own singleTouch parameter
|
|
82591
|
+
const radio = new RadioButtons(30, ["MULTI TOUCH", "SINGLE TOUCH", "NO TOUCH"]).center().mov(0,-200).change(()=>{
|
|
82592
|
+
if (radio.text.includes("MULTI")) F.singleTouch = false;
|
|
82593
|
+
else if (radio.text.includes("SINGLE")) F.singleTouch = true;
|
|
82594
|
+
else F.touch = false;
|
|
82595
|
+
});
|
|
82596
|
+
new Circle(50,white,red,5).center().mov(-100,50).drag();
|
|
82597
|
+
new Circle(50,white,purple,5).center().mov(100,50).drag();
|
|
82598
|
+
END EXAMPLE
|
|
82599
|
+
|
|
82526
82600
|
PARAMETERS supports DUO - parameters or single object with properties below
|
|
82527
82601
|
scaling - (default FULL) can have values as follows
|
|
82528
82602
|
Note: as of ZIM Cat 04, the constant FIT or the string "fit", etc. can be used
|
|
@@ -82571,7 +82645,9 @@ ticker - (default null) - an optional callback function to be added to the ZIM T
|
|
|
82571
82645
|
progress - (default null) - set to a Waiter() or ProgressBar() object to show while loading
|
|
82572
82646
|
rollover - (default true or false on mobile) activates rollovers
|
|
82573
82647
|
touch - (default true) activates touch on mobile - this will be multitouch by default
|
|
82574
|
-
set to false for no touch on mobile
|
|
82648
|
+
set to false for no touch on mobile
|
|
82649
|
+
also see singleTouch parameter to set singleTouch
|
|
82650
|
+
also see touch and singleTouch properties
|
|
82575
82651
|
scrollTop - (default false) activates scrolling on older apple devices to hide the url bar
|
|
82576
82652
|
align - (default CENTER) for FIT and FILL, the horizontal alignment LEFT, CENTER, RIGHT
|
|
82577
82653
|
valign - (default CENTER) for FIT and FILL, the vertical alignment TOP, CENTER, BOTTOM
|
|
@@ -82620,6 +82696,7 @@ maxNum - for sound this is how many instances of the sound can play at once
|
|
|
82620
82696
|
also see sound interrupt parameter
|
|
82621
82697
|
singleTouch - set to true for single touch rather than the default multitouch (or touch false)
|
|
82622
82698
|
this will override the touch setting to turn touch to true
|
|
82699
|
+
also see touch and singleTouch properties
|
|
82623
82700
|
|
|
82624
82701
|
METHODS
|
|
82625
82702
|
loadAssets(assets, path, progress, xhr, time, loadTimeout, outputAudioSprite, crossOrigin, fileType, queueOnly, maxConnections, maxNum) |ZIM DUO| also accepts ZIM DUO configuration object as single parameter
|
|
@@ -82903,6 +82980,11 @@ zil - reference to zil events that stop canvas from shifting or scrolling - also
|
|
|
82903
82980
|
can set allowDefault property to false then allow specific defaults by removing zil events - see zil global function
|
|
82904
82981
|
example: window.removeEventListener("keydown", F.zil[0]); removes keydown preventions (for page up, page down, home, end, etc)
|
|
82905
82982
|
allowDefault - set to true to remove zil or false to set zil (see above) also affects body overflow
|
|
82983
|
+
touch - get or set the touch setting - setting to false will not allow touch on mobile
|
|
82984
|
+
also see touch and singleTouch parameters and singleTouch property
|
|
82985
|
+
singleTouch - get or set the singleTouch setting - set to true to turn on single touch and false to turn on multitouch
|
|
82986
|
+
setting either true or false will set the touch property to true
|
|
82987
|
+
also see the touch and singleTouch parameters and touch property
|
|
82906
82988
|
followBoundary - update with a ZIM Boundary for follow() if "full" mode Frame "resize" event happens, etc.
|
|
82907
82989
|
altKey - true if the alt key is being pressed otherwise false
|
|
82908
82990
|
ctrlKey - true if the ctrl key is being pressed otherwise false
|
|
@@ -84478,6 +84560,31 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
84478
84560
|
}
|
|
84479
84561
|
});
|
|
84480
84562
|
|
|
84563
|
+
Object.defineProperty(that, 'touch', {
|
|
84564
|
+
get: function() {
|
|
84565
|
+
return touch;
|
|
84566
|
+
},
|
|
84567
|
+
set: function(value) {
|
|
84568
|
+
touch = value;
|
|
84569
|
+
createjs.Touch.disable(that.stage);
|
|
84570
|
+
if (touch) {
|
|
84571
|
+
createjs.Touch.enable(that.stage, singleTouch); // true for single touch, false for multitouch
|
|
84572
|
+
}
|
|
84573
|
+
}
|
|
84574
|
+
});
|
|
84575
|
+
|
|
84576
|
+
Object.defineProperty(that, 'singleTouch', {
|
|
84577
|
+
get: function() {
|
|
84578
|
+
return singleTouch;
|
|
84579
|
+
},
|
|
84580
|
+
set: function(value) {
|
|
84581
|
+
singleTouch = value;
|
|
84582
|
+
touch = true;
|
|
84583
|
+
createjs.Touch.disable(that.stage);
|
|
84584
|
+
createjs.Touch.enable(that.stage, singleTouch); // true for single touch, false for multitouch
|
|
84585
|
+
}
|
|
84586
|
+
});
|
|
84587
|
+
|
|
84481
84588
|
|
|
84482
84589
|
// CURSOR SYSTEM WITH CUR()
|
|
84483
84590
|
// added ZIM 014
|
|
@@ -89312,7 +89419,7 @@ but usually, just pass the callback as the first parameter
|
|
|
89312
89419
|
tile.center(pane);
|
|
89313
89420
|
}
|
|
89314
89421
|
|
|
89315
|
-
if (M && !( WW.matchMedia('(display-mode: standalone)').matches || (WW.navigator.standalone) || document.referrer.includes('android-app://') )) {
|
|
89422
|
+
if (M && !( WW.matchMedia('(display-mode: fullscreen)').matches || WW.matchMedia('(display-mode: standalone)').matches || (WW.navigator.fullscreen) || (WW.navigator.standalone) || document.referrer.includes('android-app://') )) {
|
|
89316
89423
|
showMessage();
|
|
89317
89424
|
} else {
|
|
89318
89425
|
if (call && call.constructor === Function) call();
|
|
@@ -34,6 +34,7 @@ declare global {
|
|
|
34
34
|
var yellow: string
|
|
35
35
|
var purple: string
|
|
36
36
|
var red: string
|
|
37
|
+
var salmon: string
|
|
37
38
|
var interstellar: string
|
|
38
39
|
var black: string
|
|
39
40
|
var darker: string
|
|
@@ -1387,6 +1388,7 @@ declare namespace zim {
|
|
|
1387
1388
|
height: number
|
|
1388
1389
|
widthOnly: number
|
|
1389
1390
|
heightOnly: number
|
|
1391
|
+
cacheScale: number
|
|
1390
1392
|
marginLeft: number
|
|
1391
1393
|
marginRight: number
|
|
1392
1394
|
marginTop: number
|
|
@@ -3772,28 +3774,12 @@ declare namespace zim {
|
|
|
3772
3774
|
visibleRight: number
|
|
3773
3775
|
visibleBottom: number
|
|
3774
3776
|
cursors: {}
|
|
3777
|
+
allowDefault: boolean
|
|
3778
|
+
touch: boolean
|
|
3779
|
+
singleTouch: boolean
|
|
3775
3780
|
readonly cursorList: Dictionary
|
|
3776
3781
|
readonly cursorObj: DisplayObject
|
|
3777
3782
|
zil: Function[]
|
|
3778
|
-
readonly orange: string
|
|
3779
|
-
readonly green: string
|
|
3780
|
-
readonly pink: string
|
|
3781
|
-
readonly blue: string
|
|
3782
|
-
readonly brown: string
|
|
3783
|
-
readonly yellow: string
|
|
3784
|
-
readonly red: string
|
|
3785
|
-
readonly purple: string
|
|
3786
|
-
readonly silver: string
|
|
3787
|
-
readonly tin: string
|
|
3788
|
-
readonly grey: string
|
|
3789
|
-
readonly lighter: string
|
|
3790
|
-
readonly light: string
|
|
3791
|
-
readonly dark: string
|
|
3792
|
-
readonly darker: string
|
|
3793
|
-
readonly white: string
|
|
3794
|
-
readonly black: string
|
|
3795
|
-
readonly clear: string
|
|
3796
|
-
readonly faint: string
|
|
3797
3783
|
altKey: boolean
|
|
3798
3784
|
ctrlKey: boolean
|
|
3799
3785
|
metaKey: boolean
|