Open czinczaar opened 1 year ago
Hello! Scrolls are fine, they can work in any direction
You have a kind if camera (scroll_view node) and game map (scroll_content). So you can scroll through all the map
You can check the examples here https://insality.github.io/druid/druid/ and also make note how the GUI layout is created (for scroll view/content)
If you have any concrete question, please answer :)
I'm fairly sure there is a bug in the sliders. I cannot drag the pin if the end_pos
is negative.
I moved the pin to the 0 position for testing purposes.
This works as expected. I can use mouse to drag the pin to the right to increase the value. --->
local scroll_slider = self.druid:new_slider("grid_scroll_pin", vmath.vector3(287, 0, 0), function (_, value)
grid_scroll:scroll_to_percent(vmath.vector3(value, 0, 0), true)
end)
Cannot use mouse to drag the pin. Pin should be draggable to the left to increase the value <---
but it does not move.
local scroll_slider = self.druid:new_slider("grid_scroll_pin", vmath.vector3(-287, 0, 0), function (_, value)
grid_scroll:scroll_to_percent(vmath.vector3(value, 0, 0), true)
end)
This issue persist for both horizontal and vertical. I tried to make a vertical scroll but got stopped by this issue when trying to make a slider where 0 value is at the top and 1 value is at the bottom. There was a broken success by rotating the grid_scroll_slider
Z
by 180 degrees but then dragging motion was opposite of the pin go direction.
Looks like a small change fixed this but I have no idea yet if it breaks something.
https://github.com/Insality/druid/blob/master/druid/extended/slider.lua#L135
>
into ~=
if self.dist.x ~= 0 then
self.value = (self.target_pos.x - self.start_pos.x) / self.dist.x
end
if self.dist.y ~= 0 then
self.value = (self.target_pos.y - self.start_pos.y) / self.dist.y
end
Okay.. the above is not the fix. For now I got a vertical slider with a static grid working. So far the issue was that the pivot for grid_content
and grid_scroll_slider
were wrong. They need to the north and south respectively. There is an issue with the pin initial position though, but for now it can be fixed with a simple gui.set_position after the druid slider is created.
Now to try to get it working with a data list..
I had a huge headache when trying to get the slider to scroll the data list without it going too far when moving too fast. This problem fixed itself when I commented out this line in scroll.lua. The pin is scrolling the data list by calculating the list item index from percent.
Hi, about vertical sliders: it seems the end pos can only be positive? If not, how do you make a proper vertical slider? Thanks.