TreeView fix.

This commit is contained in:
jussi
2024-03-21 18:42:54 +02:00
parent 842e0efe36
commit a7528da4eb
3 changed files with 4 additions and 14 deletions

View File

@@ -3,8 +3,7 @@ Current {
Backlog {
* Raygui
* Icon enums.
* Set callbacks to single table?
* Set callbacks to single table.
* Raygui lib
* Check if could remove flickering from changing draw order by making queue for order
changing and only change them after everything is drawn.
@@ -20,7 +19,6 @@ Backlog {
* Improve Dungeon crawler example by generating custom mesh instead of drawing 3D quads.
* Platformer example physics update for true framerate independence.
* Android support
* Godot scene importer lib.
}
Bugs {

View File

@@ -249,7 +249,6 @@ end
local function addTreeView()
TreeView = Gui:TreeView(
Rect:new( 600, 20, 256, 328 ),
-- Rect:new( 600, 20, 256, 600 ),
"Tree View",
function( controls ) selected( controls ) end, -- Callback.
function( self ) Gui:set2Top( self ) end, -- Grab callback.

View File

@@ -197,7 +197,6 @@ function TreeView:itemSelect( item )
for i = #self.selectedItems, 1, -1 do
local moveItem = self.selectedItems[i]
-- print( moveItem.text, "moveItem._id", moveItem._id, item.text, "item._id", item._id )
if moveItem ~= item and not self:isChild( moveItem, item ) then
local parentControls = self.controls
@@ -206,13 +205,7 @@ function TreeView:itemSelect( item )
parentControls = moveItem._parent.controls
end
local pos = #self.selectedItems - i + 1
if moveItem._parent == item._parent and moveItem._childId < item._childId then
pos = 1
end
table.insert( moveItems, pos, table.remove( parentControls, moveItem._childId ) )
table.insert( moveItems, table.remove( parentControls, moveItem._childId ) )
end
moveItem.active = false
@@ -228,7 +221,7 @@ function TreeView:itemSelect( item )
local offset = 0
if moveItem._parent == item._parent and moveItem._childId < item._childId then
offset = -1
offset = -#moveItems
end
if self._movingItem == self.MOVE_ITEM_IN then
@@ -270,7 +263,7 @@ function TreeView:itemSelect( item )
end
if self.callback ~= nil then
self.callback( self.selectedItems )
-- self.callback( self.selectedItems )
end
end