zimjs 19.1.4 → 19.1.6
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 +390 -190
package/package.json
CHANGED
package/src/zim.js
CHANGED
|
@@ -13370,16 +13370,16 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
13370
13370
|
if (p.indexOf(",") != -1) {
|
|
13371
13371
|
zim.loop(p.split(" "), function (point) {
|
|
13372
13372
|
var pp = point.split(",");
|
|
13373
|
-
points.push([Number(pp[0].trim()), Number(pp[1].trim())]);
|
|
13373
|
+
points.push([Number(pp[0].trim()), Number(pp[1].trim()),0,0,0,0,0,0,"none"]);
|
|
13374
13374
|
});
|
|
13375
13375
|
} else {
|
|
13376
13376
|
var lastP;
|
|
13377
13377
|
zim.loop(p.split(" "), function (point, i) {
|
|
13378
|
-
if ((i+1)%2==0) points.push([lastP, point.trim()]);
|
|
13378
|
+
if ((i+1)%2==0) points.push([Number(lastP), Number(point.trim()),0,0,0,0,0,0,"none"]);
|
|
13379
13379
|
lastP = point.trim();
|
|
13380
13380
|
});
|
|
13381
13381
|
}
|
|
13382
|
-
if (type=="polygon") shape = new Blob(f, s, ss, points);
|
|
13382
|
+
if (type=="polygon") shape = new Blob(f, s, ss, points, null, null, null, null, showControls, null, null, null, null, null, null, null, null, null, null, null, null, null, interactive);
|
|
13383
13383
|
else shape = new zim.Squiggle(s, ss, points, null, null, null, null, showControls, null, null, null, null, null, null, null, null, null, null, null, null, null, interactive);
|
|
13384
13384
|
} else if (type == "ellipse") {
|
|
13385
13385
|
shape = new zim.Blob(f, s, ss, ellipse(0, 0, Number(tag.getAttribute("rx")), Number(tag.getAttribute("ry"))), null, null, null, null, showControls, null, null, null, null, null, null, null, null, null, null, null, null, null, interactive);
|
|
@@ -17681,6 +17681,7 @@ addPoint(percent, controlType) - add a point at a percent (100) of the total cur
|
|
|
17681
17681
|
controlType can be as specified in main points parameter
|
|
17682
17682
|
returns index of new point
|
|
17683
17683
|
addPoints(num, controlType, startPoint, spread, dataOnly, points, even) - add num points between existing points
|
|
17684
|
+
accepts ZIM DUO normal parameters or configuration object literal with parameter names as propterties
|
|
17684
17685
|
controlType can be as specified in main points parameter
|
|
17685
17686
|
specify a startPoint to add points between the startPoint and the next point (one segment of points)
|
|
17686
17687
|
spread (default false) set to true to spread points evenly around path rather than evenly between segments
|
|
@@ -19580,6 +19581,8 @@ Note the points property has been split into points and pointObjects (and there
|
|
|
19580
19581
|
}
|
|
19581
19582
|
|
|
19582
19583
|
this.addPoints = function(num, controlType, startPoint, spread, dataOnly, points, even) {
|
|
19584
|
+
var sig = "num, controlType, startPoint, spread, dataOnly, points, even";
|
|
19585
|
+
var duo; if (duo = zob(that.addPoints, arguments, sig)) return duo;
|
|
19583
19586
|
if (zot(points)) points = zim.copy(that.points);
|
|
19584
19587
|
var ratios = zim.copy(that.segmentRatios);
|
|
19585
19588
|
var lastRatio = 0;
|
|
@@ -19869,6 +19872,7 @@ addPoint(percent, controlType) - add a point at a percent (100) of the total cur
|
|
|
19869
19872
|
controlType can be as specified in main points parameter
|
|
19870
19873
|
returns index of new point
|
|
19871
19874
|
addPoints(num, controlType, startPoint, spread, dataOnly, points, even) - add num points between existing points
|
|
19875
|
+
accepts ZIM DUO normal parameters or configuration object literal with parameter names as propterties
|
|
19872
19876
|
controlType can be as specified in main points parameter
|
|
19873
19877
|
specify a startPoint to add points between the startPoint and the next point (one segment of points)
|
|
19874
19878
|
spread (default false) set to true to spread points evenly around path rather than evenly between segments
|
|
@@ -21920,6 +21924,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
21920
21924
|
}
|
|
21921
21925
|
|
|
21922
21926
|
this.addPoints = function(num, controlType, startPoint, spread, dataOnly, points, even) {
|
|
21927
|
+
var sig = "num, controlType, startPoint, spread, dataOnly, points, even";
|
|
21928
|
+
var duo; if (duo = zob(that.addPoints, arguments, sig)) return duo;
|
|
21923
21929
|
if (zot(points)) points = zim.copy(that.points);
|
|
21924
21930
|
var ratios = zim.copy(that.segmentRatios);
|
|
21925
21931
|
var lastRatio = 0;
|
|
@@ -24186,7 +24192,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
24186
24192
|
fitText();
|
|
24187
24193
|
}
|
|
24188
24194
|
|
|
24189
|
-
function fitText() {
|
|
24195
|
+
function fitText() {
|
|
24190
24196
|
that.size = maxSize?maxSize:200;
|
|
24191
24197
|
var count = 0;
|
|
24192
24198
|
while(lineHeight < lH / 2 && (that.height > lH || that.width > lW)) {
|
|
@@ -32858,7 +32864,7 @@ borderColor - |ZIM VEE| (default null) the background stroke color
|
|
|
32858
32864
|
borderWidth - (default null) thickness of the background border
|
|
32859
32865
|
maxLength - (default null) set to limit the number of characters in the field
|
|
32860
32866
|
password - (default false) set to true to show **** for text to hide password
|
|
32861
|
-
|
|
32867
|
+
see also inputType
|
|
32862
32868
|
selectionColor - (default color) the selection color of the text
|
|
32863
32869
|
selectionAlpha - (default .2) the alpha of the selection color
|
|
32864
32870
|
cursorColor - (default color) the blinking cursor in the text
|
|
@@ -32888,7 +32894,7 @@ scrollBarV - (default true) if scrolling in vertical is needed then show scrollB
|
|
|
32888
32894
|
readOnly - (default false) set to true for field to be readOnly - also see readOnly property
|
|
32889
32895
|
inputType - (default "text") set to "text", "number", "password", "email"
|
|
32890
32896
|
number has 0-9 . + - / * % $ available
|
|
32891
|
-
|
|
32897
|
+
see also password for password setting
|
|
32892
32898
|
rtl - (default ZIM DIR) the direction of the text. Also set "rtl" in the HTML tag dir parameter for RTL
|
|
32893
32899
|
uppercase - (default false) set to true to force uppercase letters
|
|
32894
32900
|
placeholderInstant - (default true) set to false to not remove the placeholder as soon as the cursor is in the field
|
|
@@ -33264,7 +33270,7 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
|
|
|
33264
33270
|
blinker.oldX = blinkerX; // get previous blinker global x.
|
|
33265
33271
|
// end Pettis Brandon code '23
|
|
33266
33272
|
|
|
33267
|
-
if (that.stage) that.stage.update();
|
|
33273
|
+
if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && that.stage) that.stage.update();
|
|
33268
33274
|
}, null, null, null, null, mID);
|
|
33269
33275
|
|
|
33270
33276
|
if (pastText != null) {
|
|
@@ -33327,11 +33333,11 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
|
|
|
33327
33333
|
function doPlaceholder() {
|
|
33328
33334
|
if (label.text != "" && that.placeholderLabel.parent) {
|
|
33329
33335
|
that.placeholderLabel.removeFrom();
|
|
33330
|
-
if (that.stage) that.stage.update();
|
|
33336
|
+
if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && that.stage) that.stage.update();
|
|
33331
33337
|
}
|
|
33332
33338
|
if (label.text == "" && !that.placeholderLabel.parent) {
|
|
33333
33339
|
that.add(that.placeholderLabel);
|
|
33334
|
-
if (that.stage) that.stage.update();
|
|
33340
|
+
if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && that.stage) that.stage.update();
|
|
33335
33341
|
}
|
|
33336
33342
|
}
|
|
33337
33343
|
|
|
@@ -33492,7 +33498,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
|
|
|
33492
33498
|
this.hiddenInput.autocorrect = "off";
|
|
33493
33499
|
this.hiddenInput.autocomplete = "off";
|
|
33494
33500
|
this.hiddenInput.spellcheck = false;
|
|
33495
|
-
this.hiddenInput.style.position = "absolute"
|
|
33501
|
+
this.hiddenInput.style.position = "fixed"; // changed from "absolute" in ZIM 019 to fix iOS bug
|
|
33496
33502
|
this.hiddenInput.style.overflow = "hidden";
|
|
33497
33503
|
this.hiddenInput.style.touchAction = "none";
|
|
33498
33504
|
|
|
@@ -33506,6 +33512,9 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
|
|
|
33506
33512
|
|
|
33507
33513
|
this.hiddenInput.style.left = "-99999px";
|
|
33508
33514
|
this.hiddenInput.style.top = "-99999px";
|
|
33515
|
+
// this.hiddenInput.style.left = "10px";
|
|
33516
|
+
// this.hiddenInput.style.top = "10px";
|
|
33517
|
+
|
|
33509
33518
|
this.hiddenInput.style.zIndex = -999;
|
|
33510
33519
|
this.hiddenInput.style.opacity = 0;
|
|
33511
33520
|
this.hiddenInput.style.width = "1px";
|
|
@@ -33523,6 +33532,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
|
|
|
33523
33532
|
this.selection.alp(0.2);
|
|
33524
33533
|
this.positionBlinkerAndSelection();
|
|
33525
33534
|
this.dispatchEvent("focus");
|
|
33535
|
+
if (that.stage) that.stage.update();
|
|
33526
33536
|
}
|
|
33527
33537
|
this.onBlur = function() {
|
|
33528
33538
|
if (this.stage) frame = this.stage.frame;
|
|
@@ -33532,6 +33542,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
|
|
|
33532
33542
|
this.selection.alp(0.0);
|
|
33533
33543
|
this.hiddenInput.type = inputType; // ZIM NFT 00 patch
|
|
33534
33544
|
this.dispatchEvent("blur");
|
|
33545
|
+
if (that.stage) that.stage.update();
|
|
33535
33546
|
}
|
|
33536
33547
|
this.onInput = function(e, noEvent) {
|
|
33537
33548
|
if (uppercase) this.hiddenInput.value = this.hiddenInput.value.toUpperCase();
|
|
@@ -33552,6 +33563,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
|
|
|
33552
33563
|
if (this.focus) {
|
|
33553
33564
|
this.blinker.replayTween();
|
|
33554
33565
|
}
|
|
33566
|
+
if (that.stage) that.stage.update();
|
|
33555
33567
|
}
|
|
33556
33568
|
this.onKeydown = function(e) {
|
|
33557
33569
|
this.deleteKey = (e.code=="Backspace"||e.code=="Delete");
|
|
@@ -33561,6 +33573,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
|
|
|
33561
33573
|
that.positionBlinkerAndSelection.call(that);
|
|
33562
33574
|
// that.dispatchEvent(keyevt);
|
|
33563
33575
|
that.dispatchEvent(e);
|
|
33576
|
+
if (that.stage) that.stage.update();
|
|
33564
33577
|
}, 10);
|
|
33565
33578
|
}
|
|
33566
33579
|
this.onMousedown = function(e) {
|
|
@@ -33576,7 +33589,8 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
|
|
|
33576
33589
|
var selectionIdx = this.mapPointToIndex(point);
|
|
33577
33590
|
if (rtl) this.hiddenInput.setSelectionRange(le-selectionIdx, le-selectionIdx);
|
|
33578
33591
|
else this.hiddenInput.setSelectionRange(selectionIdx, selectionIdx);
|
|
33579
|
-
this.positionBlinkerAndSelection();
|
|
33592
|
+
this.positionBlinkerAndSelection();
|
|
33593
|
+
if (that.stage) that.stage.update();
|
|
33580
33594
|
}
|
|
33581
33595
|
this.onPressmove = function(e) {
|
|
33582
33596
|
// ZIM NFT 01 Patch any le or rtl
|
|
@@ -33598,18 +33612,20 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
|
|
|
33598
33612
|
} else {
|
|
33599
33613
|
this.hiddenInput.setSelectionRange(selectionIdx, this.hiddenInput.selectionEnd, rtl?"forward":"backward");
|
|
33600
33614
|
}
|
|
33601
|
-
}
|
|
33602
|
-
|
|
33615
|
+
}
|
|
33603
33616
|
this.positionBlinkerAndSelection();
|
|
33617
|
+
if (that.stage) that.stage.update();
|
|
33604
33618
|
}
|
|
33605
33619
|
this.onDblclick = function() {
|
|
33606
33620
|
this.hiddenInput.select();
|
|
33607
33621
|
this.positionBlinkerAndSelection();
|
|
33622
|
+
if (that.stage) that.stage.update();
|
|
33608
33623
|
}
|
|
33609
33624
|
this.hiddenInput.addEventListener("paste", function() {
|
|
33610
33625
|
setTimeout(function() {
|
|
33611
33626
|
that.hiddenInput.setSelectionRange(that.hiddenInput.selectionStart, that.hiddenInput.selectionEnd, rtl?"forward":"backward");
|
|
33612
33627
|
// setTimeout(function() {that.positionBlinkerAndSelection()}, 50);
|
|
33628
|
+
if (that.stage) that.stage.update();
|
|
33613
33629
|
}, 50);
|
|
33614
33630
|
});
|
|
33615
33631
|
this.positionBlinkerAndSelection = function() {
|
|
@@ -33645,7 +33661,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
|
|
|
33645
33661
|
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);
|
|
33646
33662
|
this.dispatchEvent("blinker");
|
|
33647
33663
|
}
|
|
33648
|
-
if (this.stage) this.stage.update();
|
|
33664
|
+
// if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && this.stage) this.stage.update();
|
|
33649
33665
|
}
|
|
33650
33666
|
this.eventPositionGlobalToLocal = function(e) {
|
|
33651
33667
|
var point = this.globalToLocal(e.stageX / zim.scaX, e.stageY / zim.scaY);
|
|
@@ -33691,6 +33707,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
|
|
|
33691
33707
|
if (uppercase) text = text.toUpperCase();
|
|
33692
33708
|
this.hiddenInput.value = text;
|
|
33693
33709
|
this.onInput(null, noEvent);
|
|
33710
|
+
if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && that.stage) that.stage.update();
|
|
33694
33711
|
}
|
|
33695
33712
|
Object.defineProperty(this, 'focus', {
|
|
33696
33713
|
get: function() {
|
|
@@ -33704,7 +33721,9 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
|
|
|
33704
33721
|
this.positionBlinkerAndSelection();
|
|
33705
33722
|
} else {
|
|
33706
33723
|
that.hiddenInput.blur();
|
|
33707
|
-
|
|
33724
|
+
if (that.stage) that.stage.update();
|
|
33725
|
+
}
|
|
33726
|
+
if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && that.stage) that.stage.update();
|
|
33708
33727
|
}
|
|
33709
33728
|
});
|
|
33710
33729
|
|
|
@@ -36035,25 +36054,25 @@ NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set
|
|
|
36035
36054
|
|
|
36036
36055
|
EXAMPLE
|
|
36037
36056
|
const stepper = new Stepper()
|
|
36038
|
-
|
|
36039
|
-
|
|
36040
|
-
|
|
36041
|
-
|
|
36042
|
-
|
|
36057
|
+
.center()
|
|
36058
|
+
.change(()=>{
|
|
36059
|
+
label.text = stepper.value;
|
|
36060
|
+
S.update();
|
|
36061
|
+
});
|
|
36043
36062
|
const label = new Label({
|
|
36044
|
-
|
|
36045
|
-
|
|
36063
|
+
align:CENTER,
|
|
36064
|
+
text: stepper.value
|
|
36046
36065
|
}).reg(CENTER).pos(0,100,CENTER,BOT);
|
|
36047
36066
|
// press and drag too
|
|
36048
36067
|
|
|
36049
36068
|
// Steppers can be words too
|
|
36050
36069
|
const stepper2 = new Stepper({
|
|
36051
|
-
|
|
36052
|
-
|
|
36053
|
-
|
|
36070
|
+
list:["Roger", "Wilma","Sandy","Paul"],
|
|
36071
|
+
width:200,
|
|
36072
|
+
continuous:true
|
|
36054
36073
|
}).pos(0,130,CENTER,CENTER).change(()=>{
|
|
36055
|
-
|
|
36056
|
-
|
|
36074
|
+
label.text = stepper2.value;
|
|
36075
|
+
S.update();
|
|
36057
36076
|
});
|
|
36058
36077
|
END EXAMPLE
|
|
36059
36078
|
|
|
@@ -36133,6 +36152,7 @@ containerPrev, containerNext - access to the zim Container that holds the arrows
|
|
|
36133
36152
|
arrowPrev, arrowNext - access to the zim Triangle objects
|
|
36134
36153
|
arrowPrev2, arrowNext2 - access to the zim Triangle objects for arrows2
|
|
36135
36154
|
min, max - only for number mode at the moment - currently, do not change the max to be less than the min
|
|
36155
|
+
step - get or set the main step of the Stepper (double check it is working, consider experimental, ZIM 019 patch)
|
|
36136
36156
|
label - access to the Label
|
|
36137
36157
|
textBox - access to the text box backing shape
|
|
36138
36158
|
continuous - does the stepper loop
|
|
@@ -36156,7 +36176,11 @@ and S.update() in change event to see component change its graphics
|
|
|
36156
36176
|
|
|
36157
36177
|
EVENTS
|
|
36158
36178
|
dispatches a "change" event when changed by pressing an arrow or a keyboard arrow
|
|
36159
|
-
|
|
36179
|
+
but not when setting index or value properties
|
|
36180
|
+
dispatches a "keychange" event when changed by pressing a key that changes the value
|
|
36181
|
+
note the change from keys are also dispatched under "change"
|
|
36182
|
+
but sometimes if updating data, a pressup and a keychange combo is better
|
|
36183
|
+
as change from pressing and dragging can be at the framerate
|
|
36160
36184
|
|
|
36161
36185
|
ALSO: see the CreateJS Easel Docs for Container events such as:
|
|
36162
36186
|
added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmove, pressup, removed, rollout, rollover
|
|
@@ -36229,44 +36253,47 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36229
36253
|
var numVal;
|
|
36230
36254
|
var numDir = 1;
|
|
36231
36255
|
var decimals;
|
|
36232
|
-
|
|
36233
|
-
|
|
36234
|
-
|
|
36235
|
-
|
|
36236
|
-
|
|
36237
|
-
|
|
36238
|
-
|
|
36239
|
-
|
|
36240
|
-
|
|
36241
|
-
|
|
36242
|
-
|
|
36256
|
+
function setup() {
|
|
36257
|
+
if (stepperType == "number") {
|
|
36258
|
+
min = Number(min);
|
|
36259
|
+
max = Number(max);
|
|
36260
|
+
if (isNaN(min)) min = 0;
|
|
36261
|
+
if (isNaN(max)) max = 100;
|
|
36262
|
+
if (max < min) {
|
|
36263
|
+
numDir = -1;
|
|
36264
|
+
var temp = max; // one day ES6
|
|
36265
|
+
max = min;
|
|
36266
|
+
min = temp;
|
|
36267
|
+
numVal = max;
|
|
36268
|
+
} else {
|
|
36269
|
+
numVal = min;
|
|
36270
|
+
}
|
|
36271
|
+
that.min = min;
|
|
36272
|
+
that.max = max;
|
|
36273
|
+
if (0 > min && 0 < max) numVal = 0;
|
|
36274
|
+
step = Math.abs(step);
|
|
36275
|
+
decimals = Math.max(getDecimals(step), getDecimals(step2));
|
|
36276
|
+
} else if (stepperType == "letter") {
|
|
36277
|
+
list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
|
36278
|
+
if (typeof min != "string") min = "A";
|
|
36279
|
+
if (typeof max != "string") max = "Z";
|
|
36280
|
+
min = min.substr(0,1).toUpperCase();
|
|
36281
|
+
max = max.substr(0,1).toUpperCase();
|
|
36282
|
+
var startLetter = list.indexOf(min);
|
|
36283
|
+
if (startLetter < 0) {min = "A"; startLetter = 0;}
|
|
36284
|
+
var endLetter = list.indexOf(max);
|
|
36285
|
+
if (endLetter < 0) {max = "Z"; endLetter = list.length;}
|
|
36286
|
+
if (endLetter < startLetter) {
|
|
36287
|
+
list.reverse();
|
|
36288
|
+
startLetter = list.length-1-startLetter;
|
|
36289
|
+
endLetter = list.length-1-endLetter;
|
|
36290
|
+
}
|
|
36291
|
+
list = list.splice(startLetter, endLetter-startLetter+1);
|
|
36243
36292
|
} else {
|
|
36244
|
-
|
|
36245
|
-
}
|
|
36246
|
-
this.min = min;
|
|
36247
|
-
this.max = max;
|
|
36248
|
-
if (0 > min && 0 < max) numVal = 0;
|
|
36249
|
-
step = Math.abs(step);
|
|
36250
|
-
decimals = Math.max(getDecimals(step), getDecimals(step2));
|
|
36251
|
-
} else if (stepperType == "letter") {
|
|
36252
|
-
list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
|
36253
|
-
if (typeof min != "string") min = "A";
|
|
36254
|
-
if (typeof max != "string") max = "Z";
|
|
36255
|
-
min = min.substr(0,1).toUpperCase();
|
|
36256
|
-
max = max.substr(0,1).toUpperCase();
|
|
36257
|
-
var startLetter = list.indexOf(min);
|
|
36258
|
-
if (startLetter < 0) {min = "A"; startLetter = 0;}
|
|
36259
|
-
var endLetter = list.indexOf(max);
|
|
36260
|
-
if (endLetter < 0) {max = "Z"; endLetter = list.length;}
|
|
36261
|
-
if (endLetter < startLetter) {
|
|
36262
|
-
list.reverse();
|
|
36263
|
-
startLetter = list.length-1-startLetter;
|
|
36264
|
-
endLetter = list.length-1-endLetter;
|
|
36265
|
-
}
|
|
36266
|
-
list = list.splice(startLetter, endLetter-startLetter+1);
|
|
36267
|
-
} else {
|
|
36268
|
-
stepperType = "list";
|
|
36293
|
+
stepperType = "list";
|
|
36294
|
+
}
|
|
36269
36295
|
}
|
|
36296
|
+
setup();
|
|
36270
36297
|
|
|
36271
36298
|
function getDecimals(num) {
|
|
36272
36299
|
var decimals = String(num).split(".")[1];
|
|
@@ -36279,18 +36306,18 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36279
36306
|
var rawY = 0;
|
|
36280
36307
|
|
|
36281
36308
|
if (draggable) {
|
|
36282
|
-
|
|
36309
|
+
that.on("mousedown", function(e) {
|
|
36283
36310
|
if (that.zimAccessibility && that.zimAccessibility.aria) return;
|
|
36284
|
-
|
|
36311
|
+
that.stage.mouseMoveOutside = true;
|
|
36285
36312
|
rawX = e.rawX/zim.scaX;
|
|
36286
36313
|
rawY = e.rawY/zim.scaY;
|
|
36287
|
-
rawEvent =
|
|
36314
|
+
rawEvent = that.stage.on("stagemousemove", function(e){
|
|
36288
36315
|
rawX = e.rawX/zim.scaX;
|
|
36289
36316
|
rawY = e.rawY/zim.scaY;
|
|
36290
36317
|
}, null, null, null, null, mID);
|
|
36291
36318
|
}, null, true, null, null, mID);
|
|
36292
36319
|
}
|
|
36293
|
-
|
|
36320
|
+
that.label = label;
|
|
36294
36321
|
label.mouseChildren = false;
|
|
36295
36322
|
label.mouseEnabled = false;
|
|
36296
36323
|
|
|
@@ -36473,6 +36500,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36473
36500
|
}
|
|
36474
36501
|
doStep(dragDir);
|
|
36475
36502
|
doHold();
|
|
36503
|
+
// optimize takes away update on changing label so add it here
|
|
36504
|
+
if (that.stage && (zim.OPTIMIZE||WW.OPTIMIZE)) that.stage.update();
|
|
36476
36505
|
}, dragInput);
|
|
36477
36506
|
}
|
|
36478
36507
|
doHold();
|
|
@@ -36711,6 +36740,41 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36711
36740
|
}
|
|
36712
36741
|
});
|
|
36713
36742
|
|
|
36743
|
+
// version of value that does not update stage
|
|
36744
|
+
Object.defineProperty(this, 'valueLite', {
|
|
36745
|
+
get: function() {
|
|
36746
|
+
if (stepperType=="number") {
|
|
36747
|
+
return Number(numVal);
|
|
36748
|
+
} else {
|
|
36749
|
+
return list[index];
|
|
36750
|
+
}
|
|
36751
|
+
},
|
|
36752
|
+
set: function(value) {
|
|
36753
|
+
if(zot(value)) return;
|
|
36754
|
+
if (stepperType=="number") {
|
|
36755
|
+
value = Number(value);
|
|
36756
|
+
if (that.max > that.min) {
|
|
36757
|
+
if (value > that.max || value < that.min) return;
|
|
36758
|
+
} else {
|
|
36759
|
+
if (value < that.max || value > that.min) return;
|
|
36760
|
+
}
|
|
36761
|
+
var newIndex = that.stepperArray.indexOf(value);
|
|
36762
|
+
if (newIndex < 0) return;
|
|
36763
|
+
index = newIndex;
|
|
36764
|
+
numVal = Number(that.stepperArray[index]);
|
|
36765
|
+
setLabel(numVal, numVal, false); // false to not update stage
|
|
36766
|
+
} else {
|
|
36767
|
+
if (list.indexOf(value) > -1) {
|
|
36768
|
+
value = list.indexOf(value);
|
|
36769
|
+
} else {return;}
|
|
36770
|
+
if (value == that.index) return;
|
|
36771
|
+
index=value;
|
|
36772
|
+
setLabel(list[index], index, false); // false to not update stage
|
|
36773
|
+
}
|
|
36774
|
+
}
|
|
36775
|
+
});
|
|
36776
|
+
|
|
36777
|
+
|
|
36714
36778
|
Object.defineProperty(this, 'currentValue', {
|
|
36715
36779
|
get: function() {
|
|
36716
36780
|
return this.value;
|
|
@@ -36746,6 +36810,18 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36746
36810
|
}
|
|
36747
36811
|
});
|
|
36748
36812
|
|
|
36813
|
+
Object.defineProperty(this, 'step', {
|
|
36814
|
+
get: function() {
|
|
36815
|
+
return step;
|
|
36816
|
+
},
|
|
36817
|
+
set: function(value) {
|
|
36818
|
+
if (value == 0) value = 1;
|
|
36819
|
+
step = step2 = actualStep = value;
|
|
36820
|
+
var v = that.value;
|
|
36821
|
+
setup();
|
|
36822
|
+
that.value = zim.decimals(zim.constrain(that.min + Math.round((v - that.min) / step+.00001) * step, that.min, that.max), 5);
|
|
36823
|
+
}
|
|
36824
|
+
});
|
|
36749
36825
|
|
|
36750
36826
|
this._enabled = true;
|
|
36751
36827
|
Object.defineProperty(that, 'enabled', {
|
|
@@ -36825,8 +36901,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36825
36901
|
}
|
|
36826
36902
|
}
|
|
36827
36903
|
|
|
36828
|
-
function setLabel(text, n) {
|
|
36904
|
+
function setLabel(text, n, update) {
|
|
36829
36905
|
index = n;
|
|
36906
|
+
if (zot(update)) update = true;
|
|
36830
36907
|
if (display) {
|
|
36831
36908
|
if (stepperType == "number") {
|
|
36832
36909
|
if (text != 0 && decimals > 0) {
|
|
@@ -36839,9 +36916,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36839
36916
|
// label.y = box.y+(box.getBounds().height-label.getBounds().height)/2;
|
|
36840
36917
|
}
|
|
36841
36918
|
if (arrows) setArrows();
|
|
36842
|
-
if (next && ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && next.stage)) {
|
|
36919
|
+
if (update && next && ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && next.stage)) {
|
|
36843
36920
|
next.stage.update();
|
|
36844
|
-
} else if (label && ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && label.stage)) {
|
|
36921
|
+
} else if (update && label && ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && label.stage)) {
|
|
36845
36922
|
label.stage.update();
|
|
36846
36923
|
}
|
|
36847
36924
|
if (that.zimAccessibility) that.zimAccessibility.changeTitle(that, null, true);
|
|
@@ -36888,14 +36965,22 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36888
36965
|
} else {
|
|
36889
36966
|
actualStep = step2;
|
|
36890
36967
|
}
|
|
36968
|
+
var lastV = that.value;
|
|
36891
36969
|
doStep(1);
|
|
36970
|
+
if (that.value != lastV) {
|
|
36971
|
+
that.dispatchEvent("keychange");
|
|
36972
|
+
}
|
|
36892
36973
|
} else if (k == backwardVertical || k == backwardHorizontal) {
|
|
36893
36974
|
if ((vertical && k == backwardVertical) || (!vertical && k == backwardHorizontal)) {
|
|
36894
36975
|
actualStep = step;
|
|
36895
36976
|
} else {
|
|
36896
36977
|
actualStep = step2;
|
|
36897
36978
|
}
|
|
36979
|
+
var lastV = that.value
|
|
36898
36980
|
doStep(-1);
|
|
36981
|
+
if (that.value != lastV) {
|
|
36982
|
+
that.dispatchEvent("keychange");
|
|
36983
|
+
}
|
|
36899
36984
|
}
|
|
36900
36985
|
}
|
|
36901
36986
|
}
|
|
@@ -36923,7 +37008,10 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36923
37008
|
other = true;
|
|
36924
37009
|
} else if (k==173 || k==189) {
|
|
36925
37010
|
that.value = that.value * -1;
|
|
36926
|
-
if (that.value != lastValue)
|
|
37011
|
+
if (that.value != lastValue) {
|
|
37012
|
+
that.dispatchEvent("change");
|
|
37013
|
+
that.dispatchEvent("keychange");
|
|
37014
|
+
}
|
|
36927
37015
|
lastValue = that.value;
|
|
36928
37016
|
negativeCheck = !negativeCheck;
|
|
36929
37017
|
} else if (k == 46) { // delete
|
|
@@ -36947,14 +37035,20 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
36947
37035
|
if (num < min || num > max) return;
|
|
36948
37036
|
|
|
36949
37037
|
that.value = num;
|
|
36950
|
-
if (that.value != lastValue)
|
|
37038
|
+
if (that.value != lastValue) {
|
|
37039
|
+
that.dispatchEvent("change");
|
|
37040
|
+
that.dispatchEvent("keychange");
|
|
37041
|
+
}
|
|
36951
37042
|
lastValue = that.value;
|
|
36952
37043
|
|
|
36953
37044
|
} else {
|
|
36954
37045
|
keyRestartCheck = true;
|
|
36955
37046
|
lastKeyNum = "";
|
|
36956
37047
|
that.value = String.fromCharCode(e.keyCode);
|
|
36957
|
-
if (that.value != lastValue)
|
|
37048
|
+
if (that.value != lastValue) {
|
|
37049
|
+
that.dispatchEvent("change");
|
|
37050
|
+
that.dispatchEvent("keychange");
|
|
37051
|
+
}
|
|
36958
37052
|
lastValue = that.value;
|
|
36959
37053
|
}
|
|
36960
37054
|
}
|
|
@@ -72833,7 +72927,33 @@ It tiles all TextureActive objects across the ZIM stage (and beyond to the right
|
|
|
72833
72927
|
It adds a slider and swiper to view the objects.
|
|
72834
72928
|
It adds a key (default t) and toggle() method to toggle between the three.js canvas and the ZIM canvas.
|
|
72835
72929
|
|
|
72836
|
-
|
|
72930
|
+
EXAMPLE
|
|
72931
|
+
// Do not use TextureActiveManager directly
|
|
72932
|
+
// Make sure to import the three module
|
|
72933
|
+
|
|
72934
|
+
const panel = new TextureActive(W,H);
|
|
72935
|
+
const circle = new Circle(100,red).center(panel).drag();
|
|
72936
|
+
|
|
72937
|
+
const three = new Three({
|
|
72938
|
+
width:window.innerWidth,
|
|
72939
|
+
height:window.innerHeight,
|
|
72940
|
+
cameraPosition:new THREE.Vector3(0,0,500),
|
|
72941
|
+
textureActive:true
|
|
72942
|
+
});
|
|
72943
|
+
|
|
72944
|
+
const renderer = three.renderer;
|
|
72945
|
+
const scene = three.scene;
|
|
72946
|
+
const camera = three.camera;
|
|
72947
|
+
|
|
72948
|
+
const controls = new OrbitControls(camera, three.canvas);
|
|
72949
|
+
|
|
72950
|
+
const textureActives = new TextureActives(panel, THREE, three, renderer, scene, camera, controls);
|
|
72951
|
+
// turn off T key to toggle between ZIM and three.js
|
|
72952
|
+
textureActives.manager.toggleKey = -1;
|
|
72953
|
+
|
|
72954
|
+
const canvasWindow = three.makePanel(panel, textureActives);
|
|
72955
|
+
scene.add(canvasWindow);
|
|
72956
|
+
END EXAMPLE
|
|
72837
72957
|
|
|
72838
72958
|
PARAMETERS
|
|
72839
72959
|
stage (default the ZIMDefaultFrame's stage) the stage to operate on - provided internally
|
|
@@ -77395,6 +77515,15 @@ circle.contact(obj=>{
|
|
|
77395
77515
|
});
|
|
77396
77516
|
END EXAMPLE
|
|
77397
77517
|
|
|
77518
|
+
EXAMPLE
|
|
77519
|
+
// Can join objects together with different types of joins (distance, weld, revolute)
|
|
77520
|
+
STYLE = {corner:10};
|
|
77521
|
+
const bar1 = new Rectangle(100,20).reg(CENTER).loc(100,600).addPhysics();
|
|
77522
|
+
const bar2 = new Rectangle(100,20).reg(CENTER).loc(200,600).addPhysics();
|
|
77523
|
+
// revolute only needs one point - choose end middle of bar1 (remember reg is in center)
|
|
77524
|
+
physics.join(bar1, bar2, new Point(bar1.x+bar1.width/2, bar1.y), null, -90, 90, "revolute");
|
|
77525
|
+
END EXAMPLE
|
|
77526
|
+
|
|
77398
77527
|
EXAMPLE
|
|
77399
77528
|
// control a ball with a DPad - better than keys for mobile
|
|
77400
77529
|
const physics = new Physics(0);
|
|
@@ -77576,6 +77705,7 @@ addPhysics(dynamic, contract, shape, friction, linear, angular, density, bouncin
|
|
|
77576
77705
|
friction - (default .8) - how sticky will the body act - set to 0 to slide.
|
|
77577
77706
|
linear - (default .5) - linear damping which slows the movement - set to 0 for no damping
|
|
77578
77707
|
angular - (default .5) - angular damping which slows the rotation - set to 0 for no damping
|
|
77708
|
+
also can use obj.body.SetFixedRotation(true) to stop the physics body from rotating
|
|
77579
77709
|
density - (default 1) - the density that can affect what happens with collisions
|
|
77580
77710
|
bounciness - (default 0) - how bouncy the object is - 0 is not bouncy 4 is crazy bouncy
|
|
77581
77711
|
maskBits - (default null) - used with categoryBits to determine which bodies will collide with which other bodies
|
|
@@ -77614,8 +77744,9 @@ torque(amount) - add a turning force over time on the object
|
|
|
77614
77744
|
just applying the torque once will hardly do anything - use an spin() for that
|
|
77615
77745
|
setLinearVelocity(x, y) - set the linear velocity - this overrides current forces
|
|
77616
77746
|
so might look unnatural as setLinearVelocity(0,0) will stop the object moving
|
|
77617
|
-
setAngularVelocity(amount) - set the angular velocity - this
|
|
77747
|
+
setAngularVelocity(amount) - set the angular velocity - this overrides current forces
|
|
77618
77748
|
so might look unnatural as setAngularVelocity(0) will stop the object spinning
|
|
77749
|
+
Also can use obj.body.SetFixedRotation(true) to stop the physics body from rotating
|
|
77619
77750
|
sleep() - puts object to sleep so no physics calculations are done
|
|
77620
77751
|
wake() - wakes up object from sleep so physics calculations are done
|
|
77621
77752
|
follow(damp, dampY, leftOffset, rightOffset, upOffset, downOffset, offsetDamp, offsetDampY, horizontal, vertical, borderLock, borderOriginal)
|
|
@@ -77718,7 +77849,7 @@ zimObj - the ZIM Object that the body is mapped to
|
|
|
77718
77849
|
x - deprecated - please use the BODY's loc(x, y) method - note: zimObj.body.loc() is not the same as the zimObj.loc() method
|
|
77719
77850
|
y - deprecated - please use the BODY's loc(x, y) method - note: zimObj.body.loc() is not the same as the zimObj.loc() method
|
|
77720
77851
|
rotation - the rotation of the body (degrees) - setting this will also rotate the ZIM DisplayObject
|
|
77721
|
-
Also
|
|
77852
|
+
Also can use obj.body.SetFixedRotation(true) to stop the physics body from rotating https://zimjs.com/zapp/print/Z_C6SBW
|
|
77722
77853
|
And the counter rotation technique here: https://zimjs.com/data/
|
|
77723
77854
|
|
|
77724
77855
|
GLOBAL VARIABLES
|
|
@@ -90626,7 +90757,6 @@ loadFailObj - (default result of F.makeCircles) object that shows if asset() doe
|
|
|
90626
90757
|
This will be given a type property of "EmptyAsset"
|
|
90627
90758
|
Set the loadFailObj property below to null to set no object - but this will yield errors unless each resulting asset() is tested
|
|
90628
90759
|
Set to new Container() to show nothing (but avoid errors) - or new Rectangle(10, 10) to show little black square, etc.
|
|
90629
|
-
sensors - (default false) set to true to capture Frame devicemotion and deviceorientation events - see Events
|
|
90630
90760
|
retina - (default true) scales stage to use pixelDensity (sharper when scaling up) and supports Adobe Animate export
|
|
90631
90761
|
may need to set mouse event targets to e.stageX/zim.scaX and e.stageY.zim.scaY
|
|
90632
90762
|
except for using S.getObjectUnderPoint()
|
|
@@ -91026,7 +91156,7 @@ EVENTS
|
|
|
91026
91156
|
note - when changing scale, it is better to multiply by a factor rather than add to the scale
|
|
91027
91157
|
eg. circle.scale = constrain(circle.scale*(sign(e.deltaY)>0?.75:1.25), .5, 5);
|
|
91028
91158
|
"deviceorientation" - turned on when using ZIM PermissionAsk()
|
|
91029
|
-
fired as device orientation changes
|
|
91159
|
+
fired as device orientation changes - use for tilt or compass
|
|
91030
91160
|
eventObject.rotation.x (beta in HTML specs) holds rotation about the x axis between -180 and 180 (tipped forward or backward)
|
|
91031
91161
|
eventObject.rotation.y (gamma in HTML specs) holds rotation about the y axis between -90 and 90 (tipped left or right)
|
|
91032
91162
|
eventObject.rotation.z (alpha in HTML specs) holds rotation about the z axis 0-360 clockwise (relative to orientation when app loads)
|
|
@@ -91040,7 +91170,8 @@ EVENTS
|
|
|
91040
91170
|
S.update();
|
|
91041
91171
|
});
|
|
91042
91172
|
"devicemotion" - turned on when using ZIM PermissionAsk()
|
|
91043
|
-
|
|
91173
|
+
tracks device accelerometer to capture shake
|
|
91174
|
+
eventObject.acceleration holds x, y and z properties of motion
|
|
91044
91175
|
eg.
|
|
91045
91176
|
var label = new Label().center();
|
|
91046
91177
|
// Note: MUST USE PermissionAsk()
|
|
@@ -94731,7 +94862,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
94731
94862
|
if (zot(bitmap)) bitmap = DS.bitmap!=null?DS.bitmap:true;
|
|
94732
94863
|
if (zot(splitTypes)) splitTypes = DS.splitTypes!=null?DS.splitTypes:false;
|
|
94733
94864
|
if (zot(geometric)) geometric = DS.geometric!=null?DS.geometric:true;
|
|
94734
|
-
if (zot(showControls)) showControls = DS.showControls!=null?DS.showControls:
|
|
94865
|
+
if (zot(showControls)) showControls = DS.showControls!=null?DS.showControls:null;
|
|
94735
94866
|
if (zot(interactive)) interactive = DS.interactive!=null?DS.interactive:true;
|
|
94736
94867
|
|
|
94737
94868
|
this.zimContainer_constructor(width, height);
|
|
@@ -95255,70 +95386,48 @@ END EXAMPLE
|
|
|
95255
95386
|
//-83.867
|
|
95256
95387
|
|
|
95257
95388
|
/*--
|
|
95258
|
-
Tilt - device
|
|
95389
|
+
Tilt - device orientation event
|
|
95259
95390
|
|
|
95260
95391
|
Tilt
|
|
95261
|
-
"
|
|
95392
|
+
"deviceorientation" Frame event
|
|
95262
95393
|
|
|
95263
95394
|
DESCRIPTION
|
|
95264
|
-
The Frame has a "
|
|
95265
|
-
and a "
|
|
95395
|
+
The Frame has a "deviceorientation" event to capture tilt or device rotation (like a compass)
|
|
95396
|
+
and a "devicemotion" event to capture shaking the device with the accelerometer.
|
|
95266
95397
|
|
|
95267
|
-
|
|
95398
|
+
SEE: Shake - for the "devicemotion" event for accelerometer motion
|
|
95268
95399
|
|
|
95269
|
-
|
|
95270
|
-
For either event the Frame sensors parameter MUST be set to true
|
|
95400
|
+
SEE: the PermissionAsk() class which will handle asking for permissions on devices.
|
|
95271
95401
|
|
|
95272
95402
|
EXAMPLE
|
|
95403
|
+
// TILT OR COMPASS - https://zimjs.com/zapp/Z_Q5UYS
|
|
95273
95404
|
// for capturing tilt on device (rotation about an axis)
|
|
95274
|
-
//
|
|
95275
|
-
|
|
95276
|
-
//
|
|
95277
|
-
|
|
95278
|
-
|
|
95279
|
-
|
|
95280
|
-
|
|
95281
|
-
|
|
95282
|
-
END EXAMPLE
|
|
95283
|
-
|
|
95284
|
-
EXAMPLE
|
|
95285
|
-
// on iOS, the sensors must be allowed first - this example works for all devices
|
|
95286
|
-
const label = new Label().center();
|
|
95287
|
-
const permissionType = "deviceorientation"; // or "devicemotion"
|
|
95288
|
-
const ask = new PermissionAsk(init, permissionType);
|
|
95289
|
-
function init(yes) {
|
|
95290
|
-
// if the user answers yes to the PermissionAsk
|
|
95291
|
-
const errorPane = new Pane("SENSOR not available",yellow);
|
|
95292
|
-
if (yes) {
|
|
95293
|
-
// use the sensors
|
|
95405
|
+
// be on a mobile device or a device with sensors
|
|
95406
|
+
new PermissionAsk(yes=>{
|
|
95407
|
+
if (yes) { // the user answered yes to PermissionAsk
|
|
95408
|
+
// all code goes in here
|
|
95409
|
+
new Label("Tilt the device to move circle").alp(.3).pos(0,30,CENTER);
|
|
95410
|
+
const circle = new Circle().center();
|
|
95411
|
+
const amount = .5;
|
|
95412
|
+
const compass = new Line(60, 4, light, "arrow").rot(90).centerReg(circle); // point up
|
|
95294
95413
|
F.on("deviceorientation", e=>{
|
|
95295
|
-
|
|
95414
|
+
// for tilt
|
|
95415
|
+
circle.mov(e.rotation.y*amount, e.rotation.x*amount);
|
|
95416
|
+
circle.x = constrain(circle.x, 0, W);
|
|
95417
|
+
circle.y = constrain(circle.y, 0, H);
|
|
95418
|
+
// for compass use e.rotation.z
|
|
95419
|
+
// which has 0 angle at device start rotation (not necessarily North)
|
|
95420
|
+
compass.rot(90-e.rotation.z); // rotate opposite device rotation
|
|
95296
95421
|
S.update();
|
|
95297
95422
|
});
|
|
95298
|
-
|
|
95299
|
-
|
|
95300
|
-
|
|
95301
|
-
}
|
|
95302
|
-
}
|
|
95303
|
-
END EXAMPLE
|
|
95304
|
-
|
|
95305
|
-
EXAMPLE
|
|
95306
|
-
// for shaking motion - ALSO see the PermissionAsk example above
|
|
95307
|
-
// and replace "deviceorientation" with "devicemotion"
|
|
95308
|
-
// and replace e.rotation.x, etc. with e.acceleration.x etc.
|
|
95309
|
-
// also set Frame sensors parameter to true
|
|
95310
|
-
// and be on a mobile device
|
|
95311
|
-
const label = new Label().center();
|
|
95312
|
-
F.on("devicemotion", e=>{
|
|
95313
|
-
label.text = e.acceleration.x +","+ e.acceleration.y +","+ e.acceleration.z;
|
|
95314
|
-
S.update();
|
|
95423
|
+
} else { // the user answered no to PermissionAsk
|
|
95424
|
+
new Pane("SENSOR not available",yellow).show();
|
|
95425
|
+
}
|
|
95315
95426
|
});
|
|
95316
95427
|
END EXAMPLE
|
|
95317
95428
|
|
|
95318
95429
|
EVENTS
|
|
95319
|
-
"
|
|
95320
|
-
fired on moving mobile device - like a tilt or shake - eventObject.acceleration holds x, y and z properties of motion
|
|
95321
|
-
"deviceorientation" - for rotation (also set Frame sensors parameter to true)
|
|
95430
|
+
"deviceorientation" - for tilt
|
|
95322
95431
|
fired as device orientation changes:
|
|
95323
95432
|
eventObject.rotation.x (beta in HTML specs) holds rotation about the x axis between -180 and 180 (tipped forward or backward)
|
|
95324
95433
|
eventObject.rotation.y (gamma in HTML specs) holds rotation about the y axis between -90 and 90 (tipped left or right)
|
|
@@ -95329,6 +95438,61 @@ EVENTS
|
|
|
95329
95438
|
// Device motion and orientation events are available as Frame events
|
|
95330
95439
|
//-83.86
|
|
95331
95440
|
|
|
95441
|
+
/*--
|
|
95442
|
+
Shake - device motion event
|
|
95443
|
+
|
|
95444
|
+
Shake
|
|
95445
|
+
"devicemotion" Frame event
|
|
95446
|
+
|
|
95447
|
+
DESCRIPTION
|
|
95448
|
+
The Frame has a "devicemotion" event to capture shaking the device with the accelerometer.
|
|
95449
|
+
|
|
95450
|
+
SEE: Tilt - for the "deviceorientation" event for tilt or compass
|
|
95451
|
+
|
|
95452
|
+
SEE: the PermissionAsk() class which will handle asking for permissions on devices.
|
|
95453
|
+
|
|
95454
|
+
EXAMPLE
|
|
95455
|
+
// SHAKE - https://zimjs.com/zapp/Z_XF8JM
|
|
95456
|
+
// for capturing shaking motion on device (acceleration about an axis)
|
|
95457
|
+
// be on a mobile device or a device with sensors
|
|
95458
|
+
new PermissionAsk(init, "devicemotion");
|
|
95459
|
+
function init(yes) {
|
|
95460
|
+
if (yes) { // the user answered yes to PermissionAsk
|
|
95461
|
+
// all code goes in here
|
|
95462
|
+
new Label("Shake the device").center();
|
|
95463
|
+
S.update();
|
|
95464
|
+
let id;
|
|
95465
|
+
F.on("devicemotion", e=>{
|
|
95466
|
+
// for shake
|
|
95467
|
+
if (
|
|
95468
|
+
Math.abs(e.acceleration.x) > 5 ||
|
|
95469
|
+
Math.abs(e.acceleration.y) > 5 ||
|
|
95470
|
+
Math.abs(e.acceleration.z) > 5
|
|
95471
|
+
) {
|
|
95472
|
+
if (F.color != green) {
|
|
95473
|
+
F.color = green;
|
|
95474
|
+
S.update();
|
|
95475
|
+
}
|
|
95476
|
+
if (id) id.clear();
|
|
95477
|
+
id = timeout(.2, ()=>{
|
|
95478
|
+
F.color = light;
|
|
95479
|
+
S.update();
|
|
95480
|
+
});
|
|
95481
|
+
}
|
|
95482
|
+
});
|
|
95483
|
+
} else { // the user answered no to PermissionAsk
|
|
95484
|
+
new Pane("SENSOR not available",yellow).show();
|
|
95485
|
+
}
|
|
95486
|
+
}
|
|
95487
|
+
END EXAMPLE
|
|
95488
|
+
|
|
95489
|
+
EVENTS
|
|
95490
|
+
"devicemotion" - for shake
|
|
95491
|
+
fired on moving mobile device - like a shake - eventObject.acceleration holds x, y and z properties of motion
|
|
95492
|
+
--*///+83.87
|
|
95493
|
+
// Device motion and orientation events are available as Frame events
|
|
95494
|
+
//-83.87
|
|
95495
|
+
|
|
95332
95496
|
/*--
|
|
95333
95497
|
zim.PermissionAsk = function(callback, permissionType, color, backgroundColor, style, group, inherit)
|
|
95334
95498
|
|
|
@@ -95336,9 +95500,8 @@ PermissionAsk
|
|
|
95336
95500
|
zim class - extends a zim.Pane which extends a zim.Container
|
|
95337
95501
|
|
|
95338
95502
|
DESCRIPTION
|
|
95339
|
-
A circular confirmation widget to ask the user if they want a permission
|
|
95503
|
+
A circular confirmation widget to ask the user if they want a permission on devices.
|
|
95340
95504
|
For some iOS permissions, the app needs to be interactive with first before permission can be asked!
|
|
95341
|
-
This is for iOS only - if not in iOS then will just pass through the test.
|
|
95342
95505
|
|
|
95343
95506
|
Also adds Frame deviceorientation and devicemotion events for a matching permissionType.
|
|
95344
95507
|
Pre ZIM 018, this was done with a sensors parameter on the Frame.
|
|
@@ -95350,50 +95513,67 @@ NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set
|
|
|
95350
95513
|
|
|
95351
95514
|
EXAMPLE
|
|
95352
95515
|
// DEVICE ORIENTATION - gives angle of device in all 3 dimensions
|
|
95516
|
+
// See https://zimjs.com/zapp/Z_Q5UYS
|
|
95353
95517
|
// Note: this is NOT an orientation event to see if phone is portrait or landscape (see Frame orientation event)
|
|
95354
|
-
|
|
95355
|
-
|
|
95356
|
-
|
|
95357
|
-
|
|
95358
|
-
|
|
95359
|
-
|
|
95360
|
-
|
|
95361
|
-
// use the sensors
|
|
95362
|
-
const label = new Label("on mobile").centerReg();
|
|
95518
|
+
new PermissionAsk(yes=>{
|
|
95519
|
+
if (yes) { // the user answered yes to PermissionAsk
|
|
95520
|
+
// all code goes in here
|
|
95521
|
+
new Label("Tilt the device to move circle").alp(.3).pos(0,30,CENTER);
|
|
95522
|
+
const circle = new Circle().center();
|
|
95523
|
+
const amount = .5;
|
|
95524
|
+
const compass = new Line(60, 4, light, "arrow").rot(90).centerReg(circle); // point up
|
|
95363
95525
|
F.on("deviceorientation", e=>{
|
|
95364
|
-
|
|
95365
|
-
|
|
95526
|
+
// for tilt
|
|
95527
|
+
circle.mov(e.rotation.y*amount, e.rotation.x*amount);
|
|
95528
|
+
circle.x = constrain(circle.x, 0, W);
|
|
95529
|
+
circle.y = constrain(circle.y, 0, H);
|
|
95530
|
+
// for compass use e.rotation.z
|
|
95531
|
+
// which has 0 angle at device start rotation (not necessarily North)
|
|
95532
|
+
compass.rot(90-e.rotation.z); // rotate opposite device rotation
|
|
95366
95533
|
S.update();
|
|
95367
95534
|
});
|
|
95368
|
-
} else { // the user answered no to PermissionAsk
|
|
95369
|
-
|
|
95370
|
-
}
|
|
95371
|
-
}
|
|
95535
|
+
} else { // the user answered no to PermissionAsk
|
|
95536
|
+
new Pane("SENSOR not available",yellow).show();
|
|
95537
|
+
}
|
|
95538
|
+
});
|
|
95372
95539
|
END EXAMPLE
|
|
95373
95540
|
|
|
95374
95541
|
EXAMPLE
|
|
95375
95542
|
// DEVICE MOTION - gives accelerometer values in all 3 dimensions
|
|
95376
|
-
//
|
|
95377
|
-
|
|
95378
|
-
const permissionType = "devicemotion";
|
|
95379
|
-
const ask = new PermissionAsk(init, permissionType);
|
|
95543
|
+
// See https://zimjs.com/zapp/Z_XF8JM
|
|
95544
|
+
new PermissionAsk(init, "devicemotion");
|
|
95380
95545
|
function init(yes) {
|
|
95381
|
-
|
|
95382
|
-
|
|
95383
|
-
|
|
95384
|
-
|
|
95385
|
-
|
|
95386
|
-
|
|
95387
|
-
|
|
95388
|
-
|
|
95546
|
+
if (yes) { // the user answered yes to PermissionAsk
|
|
95547
|
+
// all code goes in here
|
|
95548
|
+
new Label("Shake the device").center();
|
|
95549
|
+
S.update();
|
|
95550
|
+
let id;
|
|
95551
|
+
F.on("devicemotion", e=>{
|
|
95552
|
+
// for shake
|
|
95553
|
+
if (
|
|
95554
|
+
Math.abs(e.acceleration.x) > 5 ||
|
|
95555
|
+
Math.abs(e.acceleration.y) > 5 ||
|
|
95556
|
+
Math.abs(e.acceleration.z) > 5
|
|
95557
|
+
) {
|
|
95558
|
+
if (F.color != green) {
|
|
95559
|
+
F.color = green;
|
|
95560
|
+
S.update();
|
|
95561
|
+
}
|
|
95562
|
+
if (id) id.clear();
|
|
95563
|
+
id = timeout(.2, ()=>{
|
|
95564
|
+
F.color = light;
|
|
95565
|
+
S.update();
|
|
95566
|
+
});
|
|
95567
|
+
}
|
|
95389
95568
|
});
|
|
95390
|
-
} else { // the user answered no to PermissionAsk
|
|
95391
|
-
|
|
95569
|
+
} else { // the user answered no to PermissionAsk
|
|
95570
|
+
new Pane("SENSOR not available",yellow).show();
|
|
95392
95571
|
}
|
|
95393
95572
|
}
|
|
95394
95573
|
END EXAMPLE
|
|
95395
95574
|
|
|
95396
95575
|
EXAMPLE
|
|
95576
|
+
// CAM
|
|
95397
95577
|
// on iOS, the app must be interacted with before using mic or cam
|
|
95398
95578
|
// goes right to permissions on computer and android
|
|
95399
95579
|
// pops up a PermissionAsk Pane on iOS then if yes, goes to permissions on iOS
|
|
@@ -95405,6 +95585,7 @@ function init(val) {
|
|
|
95405
95585
|
END EXAMPLE
|
|
95406
95586
|
|
|
95407
95587
|
EXAMPLE
|
|
95588
|
+
// MIC
|
|
95408
95589
|
// on iOS, the app must be interacted with before using mic or cam
|
|
95409
95590
|
// this goes right to permissions on computer and android
|
|
95410
95591
|
// but pops up a PermissionAsk Pane on iOS then if yes, goes to permissions on iOS
|
|
@@ -95423,6 +95604,17 @@ callback - the function to callback when permission is accepted
|
|
|
95423
95604
|
for iOS the PermissionAsk Pane will be shown and the system permissions
|
|
95424
95605
|
in all cases, the callback will be called on result
|
|
95425
95606
|
the parameter given to the callback will be true (sensors) or a media stream (mic / cam) or false if not accepted
|
|
95607
|
+
the callback will receive an error number as its second parameter
|
|
95608
|
+
1 - device orientation fail
|
|
95609
|
+
2 - device motion fail
|
|
95610
|
+
3 - test timeout fail
|
|
95611
|
+
4 - mic or miccam fail
|
|
95612
|
+
5 - mediaDevices or getUserMedia fail
|
|
95613
|
+
6 - native request permission denied by user
|
|
95614
|
+
7 - request permission fail
|
|
95615
|
+
8 - ZIM interface request permission denied by user (NO chosen)
|
|
95616
|
+
9 - mic or miccam fail (no ZIM interface)
|
|
95617
|
+
10 - mediaDevices or getUserMedia fail (no ZIM interface)
|
|
95426
95618
|
permissionType - (default "deviceorientation") the string deviceorientation, devicemotion, mic, cam, or miccam
|
|
95427
95619
|
color - (default zim.dark) the font and border color of the widget
|
|
95428
95620
|
backgroundColor - (default zim.lighter) the backgroundColor of the widget
|
|
@@ -95481,22 +95673,22 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
95481
95673
|
|
|
95482
95674
|
var that = this;
|
|
95483
95675
|
|
|
95484
|
-
Style.addGroup("PermissionAsk", {
|
|
95485
|
-
width:100,
|
|
95676
|
+
Style.addGroup("PermissionAsk", {
|
|
95486
95677
|
color:color,
|
|
95487
95678
|
rollColor:backgroundColor,
|
|
95488
95679
|
corner:10,
|
|
95489
95680
|
backgroundColor:zim.faint,
|
|
95490
95681
|
rollBackgroundColor:color,
|
|
95491
95682
|
borderColor:color,
|
|
95492
|
-
borderWidth:2
|
|
95683
|
+
borderWidth:2,
|
|
95684
|
+
align:CENTER
|
|
95493
95685
|
});
|
|
95494
95686
|
var pt = permissionType;
|
|
95495
95687
|
var okay = false;
|
|
95496
|
-
that.yes = new zim.Button({label:"YES", group:"PermissionAsk"}).sca(.65).pos(0,30,CENTER,TOP,this);
|
|
95688
|
+
that.yes = new zim.Button({label:"YES", width:100, group:"PermissionAsk"}).sca(.65).pos(0,30,CENTER,TOP,this);
|
|
95497
95689
|
var words = {deviceorientation:"sensors", devicemotion:"sensors", mic:"mic", cam:"cam", miccam:"mic/cam"};
|
|
95498
95690
|
that.label = new zim.Label("Use " + (words[pt]?words[pt]:"feature") + "?", 30, null, color, null, null, null, "center").sca(.9).centerReg(this);
|
|
95499
|
-
that.no = new zim.Button({label:"NO", group:"PermissionAsk"}).sca(.65).pos(0,30,CENTER,BOTTOM,this);
|
|
95691
|
+
that.no = new zim.Button({label:"NO", width:100, group:"PermissionAsk"}).sca(.65).pos(0,30,CENTER,BOTTOM,this);
|
|
95500
95692
|
|
|
95501
95693
|
new zim.Circle(110, zim.clear, color, 1).center(this).alp(.8);
|
|
95502
95694
|
new zim.Circle(120, zim.clear, color, 1).center(this).alp(.5);
|
|
@@ -95515,9 +95707,9 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
95515
95707
|
callback(stream);
|
|
95516
95708
|
})
|
|
95517
95709
|
.catch(function(err) {
|
|
95518
|
-
callback(false);
|
|
95710
|
+
callback(false, 9);
|
|
95519
95711
|
});
|
|
95520
|
-
} else callback(false);
|
|
95712
|
+
} else callback(false, 10);
|
|
95521
95713
|
return;
|
|
95522
95714
|
}
|
|
95523
95715
|
|
|
@@ -95531,19 +95723,19 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
95531
95723
|
function testMe(e) {
|
|
95532
95724
|
if (okay) return;
|
|
95533
95725
|
if (permissionType=="deviceorientation") {
|
|
95534
|
-
if (e.alpha==null || (e.alpha==0&&e.beta==0&&e.gamma==0)) callback(false);
|
|
95726
|
+
if (e.alpha==null || (e.alpha==0&&e.beta==0&&e.gamma==0)) callback(false, 1);
|
|
95535
95727
|
else setEvents();
|
|
95536
95728
|
} else {
|
|
95537
95729
|
// if (!e.acceleration || e.acceleration.x==null || (e.acceleration.x==0&&e.acceleration.y==0&&e.acceleration.z==0)) callback(false);
|
|
95538
|
-
if (!e.acceleration || e.acceleration.x==null) callback(false);
|
|
95730
|
+
if (!e.acceleration || e.acceleration.x==null) callback(false, 2);
|
|
95539
95731
|
else setEvents();
|
|
95540
95732
|
}
|
|
95541
95733
|
called = true;
|
|
95542
95734
|
WW.removeEventListener(permissionType, testMe);
|
|
95543
95735
|
}
|
|
95544
95736
|
setTimeout(function(){
|
|
95545
|
-
if (!called) callback(false);
|
|
95546
|
-
},
|
|
95737
|
+
if (!called) callback(false, 3);
|
|
95738
|
+
}, 5000);
|
|
95547
95739
|
}
|
|
95548
95740
|
|
|
95549
95741
|
var lastZ = 0;
|
|
@@ -95592,9 +95784,9 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
95592
95784
|
callback(stream);
|
|
95593
95785
|
})
|
|
95594
95786
|
.catch(function(err) {
|
|
95595
|
-
callback(false);
|
|
95787
|
+
callback(false, 4);
|
|
95596
95788
|
});
|
|
95597
|
-
} else callback(false);
|
|
95789
|
+
} else callback(false, 5);
|
|
95598
95790
|
} else {
|
|
95599
95791
|
var s = DeviceMotionEvent;
|
|
95600
95792
|
if (pt != "devicemotion") s = DeviceOrientationEvent;
|
|
@@ -95603,13 +95795,13 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
95603
95795
|
setEvents();
|
|
95604
95796
|
okay = true;
|
|
95605
95797
|
}
|
|
95606
|
-
else callback(false);
|
|
95798
|
+
else callback(false, 6);
|
|
95607
95799
|
}).catch(function(e){
|
|
95608
|
-
callback(false);
|
|
95800
|
+
callback(false, 7);
|
|
95609
95801
|
});
|
|
95610
95802
|
}
|
|
95611
95803
|
} else {
|
|
95612
|
-
callback(false);
|
|
95804
|
+
callback(false, 8);
|
|
95613
95805
|
}
|
|
95614
95806
|
}
|
|
95615
95807
|
|
|
@@ -96296,13 +96488,13 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
96296
96488
|
var controls = new zim.Container(w*.6,w*.25);
|
|
96297
96489
|
var conLev = new zim.Label({text:"LEVEL", shiftV:4}).alp(.8).sca(objTitle.scale);
|
|
96298
96490
|
var conLevI = new zim.Label({text:"Depth", shiftV:4, italic:true}).alp(.5).sca(objTitle.scale);
|
|
96299
|
-
var conLevS = new zim.Stepper({shadowColor:-1, bgColor:grey, color:lighter, value:settings.level, arrowScale:.6, group:"noMonitor"}).scaleTo(controls,40).change(function() {
|
|
96491
|
+
var conLevS = new zim.Stepper({arrows:true, shadowColor:-1, bgColor:grey, color:lighter, value:settings.level, arrowScale:.6, group:"noMonitor"}).scaleTo(controls,40).change(function() {
|
|
96300
96492
|
settings.level = conLevS.value;
|
|
96301
96493
|
updateSettings();
|
|
96302
96494
|
});
|
|
96303
96495
|
var conSpe = new zim.Label({text:"BATCH", shiftV:4}).alp(.8).sca(objTitle.scale);
|
|
96304
96496
|
var conSpeI = new zim.Label({text:"Seconds", shiftV:4, italic:true}).alp(.5).sca(objTitle.scale);
|
|
96305
|
-
var conBatS = new zim.Stepper({min:.1, max:3, step:.1, value:settings.time, shadowColor:-1, bgColor:grey, color:lighter, arrowScale:.6, group:"noMonitor"}).sca(conLevS.scale).change(function() {
|
|
96497
|
+
var conBatS = new zim.Stepper({arrows:true, min:.1, max:3, step:.1, value:settings.time, shadowColor:-1, bgColor:grey, color:lighter, arrowScale:.6, group:"noMonitor"}).sca(conLevS.scale).change(function() {
|
|
96306
96498
|
settings.time = conBatS.value;
|
|
96307
96499
|
updateSettings();
|
|
96308
96500
|
});;
|
|
@@ -97125,6 +97317,8 @@ const content = makeContent({
|
|
|
97125
97317
|
END EXAMPLE
|
|
97126
97318
|
|
|
97127
97319
|
PARAMETERS
|
|
97320
|
+
** supports VEE - parameters marked with ZIM VEE mean a zim Pick() object or Pick Literal can be passed
|
|
97321
|
+
Pick Literal formats: [1,3,2] - random; {min:10, max:20} - range; series(1,2,3) - order, function(){return result;} - function
|
|
97128
97322
|
content - the content to make - using one of three formats:
|
|
97129
97323
|
a string or number to add a ZIM Label (also see color parameter and property)
|
|
97130
97324
|
a ZIM DisplayObject such as a Circle or a Container with more objects, etc.
|
|
@@ -97135,10 +97329,10 @@ content - the content to make - using one of three formats:
|
|
|
97135
97329
|
buttons - an array of ZIM Button objects or configuration objects {} as follows:
|
|
97136
97330
|
{label, color, rollColor, backgroundColor, rollBackgroundColor, call}
|
|
97137
97331
|
with call being a callback function for when the button is pressed
|
|
97138
|
-
buttonScale - the scale for the buttons
|
|
97332
|
+
buttonScale - |ZIM VEE| the scale for the buttons
|
|
97139
97333
|
color - the color of the message
|
|
97140
|
-
spacingH - horizontal space between the buttons (default 20xbuttonScale)
|
|
97141
|
-
spacingV - vertical space between the content areas
|
|
97334
|
+
spacingH - |ZIM VEE| horizontal space between the buttons (default 20xbuttonScale) starts with expected spaces, last space is set at left and right
|
|
97335
|
+
spacingV - |ZIM VEE| vertical space between the content areas (default 20) starts with space from top ends with space from bottom
|
|
97142
97336
|
scrollBar - set to true if a default scrollBar is present in Window or a number if custom
|
|
97143
97337
|
align - default CENTER, or use LEFT or RIGHT
|
|
97144
97338
|
maxWidth - (default null) pass in a maximum width to keep scale the content to
|
|
@@ -97173,14 +97367,15 @@ RETURNS - a Label if a string or number is passed as content, a Container if a c
|
|
|
97173
97367
|
|
|
97174
97368
|
if (!data.align) data.align = "center";
|
|
97175
97369
|
obj = new zim.Container();
|
|
97176
|
-
var
|
|
97177
|
-
|
|
97178
|
-
if (data.
|
|
97179
|
-
if (data.
|
|
97370
|
+
var s1 = zik(spacingV);
|
|
97371
|
+
var spacer = new Container(10,s1).addTo(obj);
|
|
97372
|
+
if (data.header) data.header.pos(0,s1,"left","top",obj);
|
|
97373
|
+
if (data.message) var label = new zim.Label({text:data.message, color:zot(data.color)?color:data.color, align:data.align}).reg(LEFT,TOP).loc(0,obj.height+(data.header?zik(spacingV):0),obj);
|
|
97374
|
+
if (data.display) data.display.pos(0,-data.display.height-(data.header||data.message?zik(spacingV):0),"left","bottom",obj);
|
|
97180
97375
|
if (data.buttons) {
|
|
97181
97376
|
if (!Array.isArray(data.buttons)) data.buttons = [data.buttons];
|
|
97182
97377
|
var ideal = data.length*100;
|
|
97183
|
-
var buts = new zim.Container().loc(0,obj.height+(data.header||data.message||data.display?spacingV:0),obj);
|
|
97378
|
+
var buts = new zim.Container().loc(0,obj.height+(data.header||data.message||data.display?zik(spacingV):0),obj);
|
|
97184
97379
|
for (var bb=0; bb<data.buttons.length; bb++) {
|
|
97185
97380
|
var bd = data.buttons[bb];
|
|
97186
97381
|
var call = bd.call||function(){};
|
|
@@ -97197,8 +97392,12 @@ RETURNS - a Label if a string or number is passed as content, a Container if a c
|
|
|
97197
97392
|
bd.button = bd;
|
|
97198
97393
|
}
|
|
97199
97394
|
bd.button.call = call;
|
|
97200
|
-
bd.button.sca(data.buttonScale).loc((bb==0?0:buts.width+spacingH),0,buts).tap(function(e){e.target.call(e.target)});
|
|
97201
|
-
}
|
|
97395
|
+
bd.button.sca(zik(data.buttonScale)).loc((bb==0?0:buts.width+zik(spacingH)),0,buts).tap(function(e){e.target.call(e.target)});
|
|
97396
|
+
}
|
|
97397
|
+
for (var bb=0; bb<data.buttons.length; bb++) {
|
|
97398
|
+
var bd = data.buttons[bb];
|
|
97399
|
+
bd.button.y = (buts.height - bd.button.height) / 2;
|
|
97400
|
+
}
|
|
97202
97401
|
}
|
|
97203
97402
|
var bb = obj.getBounds();
|
|
97204
97403
|
obj.setBounds(bb.x, bb.y, bb.width, bb.height);
|
|
@@ -97211,8 +97410,9 @@ RETURNS - a Label if a string or number is passed as content, a Container if a c
|
|
|
97211
97410
|
o.pos(0,null,"right");
|
|
97212
97411
|
}
|
|
97213
97412
|
}
|
|
97214
|
-
if (maxWidth && typeof maxWidth == "number") obj.width = Math.min(obj.width, maxWidth-spacingH*2-(data.scrollBar===true?12:data.scrollBar>0?data.scrollBar:0));
|
|
97215
|
-
|
|
97413
|
+
if (maxWidth && typeof maxWidth == "number") obj.width = Math.min(obj.width, maxWidth-zik(spacingH)*2-(data.scrollBar===true?12:data.scrollBar>0?data.scrollBar:0));
|
|
97414
|
+
var s2 = zik(spacingV);
|
|
97415
|
+
new zim.Container(10,s2).pos(0,-s2,"center","bottom",obj).bot();
|
|
97216
97416
|
|
|
97217
97417
|
obj.setBounds(null); // make spacer in bottom adjust bounds
|
|
97218
97418
|
|