Raygui lib treeView allowMove and allowMultiselect.
This commit is contained in:
@@ -37,6 +37,8 @@ function TreeView:new( bounds, text, callbacks, styles, tooltip )
|
|||||||
object.visible = true
|
object.visible = true
|
||||||
object.disabled = false
|
object.disabled = false
|
||||||
object.draggable = true
|
object.draggable = true
|
||||||
|
object.allowMove = true
|
||||||
|
object.allowMultiselect = true
|
||||||
|
|
||||||
object.mouseScale = 1 -- Set this if drawing in different size to render texture for example.
|
object.mouseScale = 1 -- Set this if drawing in different size to render texture for example.
|
||||||
object.selectedItems = {}
|
object.selectedItems = {}
|
||||||
@@ -191,7 +193,7 @@ function TreeView:itemSelect( item )
|
|||||||
|
|
||||||
local moveItems = {}
|
local moveItems = {}
|
||||||
|
|
||||||
if self._movingItem ~= self.MOVE_ITEM_NONE then
|
if self.allowMove and self._movingItem ~= self.MOVE_ITEM_NONE then
|
||||||
|
|
||||||
for i = #self.selectedItems, 1, -1 do
|
for i = #self.selectedItems, 1, -1 do
|
||||||
local moveItem = self.selectedItems[i]
|
local moveItem = self.selectedItems[i]
|
||||||
@@ -244,10 +246,12 @@ function TreeView:itemSelect( item )
|
|||||||
|
|
||||||
local mode = self.SINGLE_SELECT
|
local mode = self.SINGLE_SELECT
|
||||||
|
|
||||||
if RL.IsKeyDown( RL.KEY_LEFT_CONTROL ) or RL.IsKeyDown( RL.KEY_RIGHT_CONTROL ) then
|
if self.allowMultiselect then
|
||||||
mode = self.MULTI_SELECT
|
if RL.IsKeyDown( RL.KEY_LEFT_CONTROL ) or RL.IsKeyDown( RL.KEY_RIGHT_CONTROL ) then
|
||||||
elseif RL.IsKeyDown( RL.KEY_LEFT_SHIFT ) or RL.IsKeyDown( RL.KEY_RIGHT_SHIFT ) then
|
mode = self.MULTI_SELECT
|
||||||
mode = self.RANGE_SELECT
|
elseif RL.IsKeyDown( RL.KEY_LEFT_SHIFT ) or RL.IsKeyDown( RL.KEY_RIGHT_SHIFT ) then
|
||||||
|
mode = self.RANGE_SELECT
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if self._lastActiveItem ~= nil then
|
if self._lastActiveItem ~= nil then
|
||||||
@@ -298,7 +302,7 @@ function TreeView:update()
|
|||||||
|
|
||||||
self.gui:draw()
|
self.gui:draw()
|
||||||
|
|
||||||
if RL.IsMouseButtonDown( RL.MOUSE_BUTTON_LEFT ) and self._clickedItem ~= nil
|
if self.allowMove and RL.IsMouseButtonDown( RL.MOUSE_BUTTON_LEFT ) and self._clickedItem ~= nil
|
||||||
and not mouseInClickedItem and 0 < self.gui.focused then
|
and not mouseInClickedItem and 0 < self.gui.focused then
|
||||||
local focusBounds = self.gui.controls[ self.gui.focused ].bounds
|
local focusBounds = self.gui.controls[ self.gui.focused ].bounds
|
||||||
local relY = ( guiMousePos.y - focusBounds.y ) / focusBounds.height
|
local relY = ( guiMousePos.y - focusBounds.y ) / focusBounds.height
|
||||||
|
|||||||
Reference in New Issue
Block a user