Skip to content

Commit 88d57cc

Browse files
committed
Adjusted makeContent custom buttons
1 parent 0b872b8 commit 88d57cc

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zimjs",
3-
"version": "18.1.2",
3+
"version": "18.1.3",
44
"type": "module",
55
"main": "./src/zim.js",
66
"types": "./ts-src/typings/zim",

src/zim.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27659,7 +27659,7 @@ content - (default " ") optional content to be centered in one of three formats:
2765927659
header - a ZIM DisplayObject for the top of the content
2766027660
message - text that will put into a ZIM Label - default darker - see color property
2766127661
display - a ZIM DisplayObject for beneath the message
27662-
buttons - an array of ZIM Button objects or configuration objects {} as follows:
27662+
buttons - an array of ZIM Button objects or configuration objects {} as follows:
2766327663
{label, color, rollColor, backgroundColor, rollBackgroundColor, call}
2766427664
with call being a callback function for when the button is pressed
2766527665
buttonScale - the scale for the buttons
@@ -28270,7 +28270,7 @@ content - (default null) optional content to be centered in one of three formats
2827028270
header - a ZIM DisplayObject for the top of the content
2827128271
message - text that will put into a ZIM Label - default color white - see color property
2827228272
display - a ZIM DisplayObject for beneath the message
28273-
buttons - an array of ZIM Button objects or configuration objects {} as follows:
28273+
buttons - an array of ZIM Button objects or configuration objects {} as follows:
2827428274
{label, color, rollColor, backgroundColor, rollBackgroundColor, call}
2827528275
with call being a callback function for when the button is pressed
2827628276
buttonScale - the scale for the buttons
@@ -28799,7 +28799,7 @@ content - (default null) optional content to be centered in one of three formats
2879928799
header - a ZIM DisplayObject for the top of the content
2880028800
message - text that will put into a ZIM Label - default color white - see color property
2880128801
display - a ZIM DisplayObject for beneath the message
28802-
buttons - an array of ZIM Button objects or configuration objects {} as follows:
28802+
buttons - an array of ZIM Button objects or configuration objects {} as follows:
2880328803
{label, color, rollColor, backgroundColor, rollBackgroundColor, call}
2880428804
with call being a callback function for when the button is pressed
2880528805
buttonScale - the scale for the buttons
@@ -89553,7 +89553,6 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
8955389553
if (inner.type == "Bitmap") that.bitmap = inner.clone().addTo(that);
8955489554
else that.bitmap = inner.getChildAt(0).clone().addTo(that);
8955589555
that.id = that.bitmap.id = file;
89556-
zogb(that.id)
8955789556
that.image = that.bitmap.image;
8955889557
that.src = that.bitmap.src;
8955989558
that.item = that.bitmap.item;
@@ -92251,15 +92250,19 @@ RETURNS - a Label if a string or number is passed as content, a Container if a c
9225192250
var buts = new zim.Container().loc(0,obj.height+(data.header||data.message||data.display?spacingV:0),obj);
9225292251
for (var bb=0; bb<data.buttons.length; bb++) {
9225392252
var bd = data.buttons[bb];
92254-
var call = bd.call||function(){};
92255-
if (!bd.button) bd.button = new zim.Button({
92256-
width:bd.width,
92257-
label:bd.label,
92258-
backgroundColor:bd.backgroundColor||bd.bgColor,
92259-
color:bd.color,
92260-
rollBackgroundColor:bd.rollBackgroundColor||bd.rollBgColor,
92261-
rollColor:bd.rollColor
92262-
});
92253+
var call = bd.call||function(){};
92254+
if (bd.type != "Button") {
92255+
bd.button = new zim.Button({
92256+
width:bd.width,
92257+
label:bd.label,
92258+
backgroundColor:bd.backgroundColor||bd.bgColor,
92259+
color:bd.color,
92260+
rollBackgroundColor:bd.rollBackgroundColor||bd.rollBgColor,
92261+
rollColor:bd.rollColor
92262+
});
92263+
} else {
92264+
bd.button = bd;
92265+
}
9226392266
bd.button.call = call;
9226492267
bd.button.sca(data.buttonScale).loc((bb==0?0:buts.width+spacingH),0,buts).tap(function(e){e.target.call(e.target)});
9226592268
}
@@ -98346,3 +98349,4 @@ export let Style = zim.Style;
9834698349
export let assets = zim.assets;
9834798350
export let assetIDs = zim.assetIDs;
9834898351
export let ZIMON = zim.ZIMON;
98352+

0 commit comments

Comments
 (0)