Skip to content

Commit

Permalink
Fix test case
Browse files Browse the repository at this point in the history
  • Loading branch information
rexrainbow committed Oct 3, 2024
1 parent 3225867 commit 11e49ed
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 31 deletions.
2 changes: 1 addition & 1 deletion docs/docs/ui-scrollablepanel.md
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ See [Base-sizer/Set children interactive](ui-basesizer.md#set-children-interacti
##### Events
See [Base-sizer/Set children interactive/Events](ui-basesizer.md#events)
See [Base-sizer/Set children interactive/Events](ui-basesizer.md#events_1)
## Steps of building a scrollable panel
Expand Down
58 changes: 28 additions & 30 deletions examples/ui-scrollablepanel/button-click-childinteractive.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Demo extends Phaser.Scene {
// child : Label from CreateItem()
print.text += `Click ${child.name}`;
console.log(`Click ${child.name}`);
if (child.isInTouching('actions[0]')) {
if (child.isInTouching('action')) {
print.text += `'s action button`;
}
print.text += '\n';
Expand All @@ -66,7 +66,7 @@ class Demo extends Phaser.Scene {
var CreatePanel = function (scene) {
var panel = scene.rexUI.add.sizer({
orientation: 'y',
space: { item: 5 }
space: { item: 5 },
})

for (var i = 0; i < 30; i++) {
Expand All @@ -81,44 +81,42 @@ var CreatePanel = function (scene) {
}

var CreateItem = function (scene, text) {
var item = scene.rexUI.add.dialog({
var item = scene.rexUI.add.sizer({
height: 80,

orientation: 'y',
space: { left: 10, right: 10, top: 10, bottom: 10 },
name: text
})

background: scene.rexUI.add.roundRectangle({
radius: 10,
color: COLOR_MAIN
}),

title: scene.rexUI.add.label({
text: scene.add.text(0, 0, text),
}),

content: scene.rexUI.add.label({
text: scene.add.text(0, 0, 'AAAAAAAA'),
}),

actions: [
item
.addBackground(
scene.rexUI.add.roundRectangle({
radius: 10,
color: COLOR_MAIN
})
)
.add(
scene.rexUI.add.label({
text: scene.add.text(0, 0, text),
}),
{ align: 'left' }
)
.add(
scene.rexUI.add.label({
text: scene.add.text(0, 0, 'AAAAAAAA'),
}),
{ align: 'left' }
)
.add(
scene.rexUI.add.label({
space: { left: 5, right: 5, top: 5, bottom: 5 },
background: scene.rexUI.add.roundRectangle({
color: COLOR_DARK
}),
text: scene.add.text(0, 0, 'OK'),
}),
],

proportion: {
content: 1,
},

align: {
actions: 'right'
},

name: text
})
{ align: 'right', key: 'action' }
)
return item;
}

Expand Down

0 comments on commit 11e49ed

Please sign in to comment.