Closed dtturcotte closed 1 year ago
From code of 1st part -- put circles into container.
After drawing bounds of container, you can see that circles are starting at center of container
(Origin of container is fixed to
0.5
x0.5
)
Might set xPos
, yPos
to -circleContainer.width/2
, -circleContainer.height/2
.
However, size of container still can't overlap all circles.
"(Origin of container is fixed to 0.5x0.5)", but Phaser.GameObject.Container
's xOrigin and yOrigin are readonly, and there's no setOrigin()
on this object.
And for "Might set xPos, yPos to -circleContainer.width/2, -circleContainer.height/2.", are you setting this on the rightScrollablePanel
(e.g., rightScrollablePanel.setPosition(-circleContainer.width / 2, -circleContainer.height / 2)
)?
If it's too difficult to add the circles to a container first, is it possible to just add the circles to the rightScrollablePanel
's sizer
at a x,y
determined by me?
sizer is extended from containerLite, which has pin
method, for pinning child without layout it (not add
method). However, the pinning position is not the same as built-in container.
For example, a containerLite at (400, 300), adds a child which at (400, 400), then position of child won't change, the related position is (0, 100).
You can change origin of sizer/containerLite to (0
,0
), before adding child.
BTW, you can still use sizer's add
method, assign the padding.left
to zig-zag wave
BTW, you can still use sizer's
add
method, assign thepadding.left
to zig-zag wave
So this would be instead of adding the circles to a circleContainer
? I would add the circles directly to the sizer, then use sizer's padding left to change direction?
EDIT: this seemed to work! I had completely forgot about using padding for this.
EDIT2: The sizer
(red border) seems out of alignment with its containing scrollablePanel
(black border). sizer
's x,y is set at 0,0. Do you know why this might be?
Can't get the point of EDIT2, could you describe more detail? Might add more texts on image, like where is scrollablePanel (black border)?
Actually, all set! Thank you.
Hello, thank you for your last feature addition of strikethrough.
I need to add a bunch of circles (
this.scene.add.circle(xPos, yPos, radius, 0x000000)
) to a scrollablePanel and be able to scroll vertically from top to bottom. The circles will be arranged in sort of a zig-zag wave from top to bottom. As of now, it seems to add elements to a "scrollable" container, I need to add asizer
, which seems to arrange elements itself even if I set their x, y. To get around this, I added the elements to a container first, then set the size of the container, then added the container to the sizer. This worked, but the scrollable panel shows the elements starting from the bottom.Code snippet:
Adding of the scrollablePanel:
Top of box:
After scrolling down: