diff options
| author | jussi | 2024-03-29 20:51:43 +0200 |
|---|---|---|
| committer | jussi | 2024-03-29 20:51:43 +0200 |
| commit | b96960a1f97f815a6872fedc422ea950ed477cda (patch) | |
| tree | 5dd7cc471be60806744b9869358e43cf507202fe /examples/raygui_extensions | |
| parent | 523351609a36ceb48581aa8edab160037a634ea8 (diff) | |
| download | reilua-enhanced-b96960a1f97f815a6872fedc422ea950ed477cda.tar.gz reilua-enhanced-b96960a1f97f815a6872fedc422ea950ed477cda.tar.bz2 reilua-enhanced-b96960a1f97f815a6872fedc422ea950ed477cda.zip | |
Raygui lib examples file browser.
Diffstat (limited to 'examples/raygui_extensions')
| -rw-r--r-- | examples/raygui_extensions/property_list.lua | 5 | ||||
| -rw-r--r-- | examples/raygui_extensions/tree_view.lua | 15 |
2 files changed, 10 insertions, 10 deletions
diff --git a/examples/raygui_extensions/property_list.lua b/examples/raygui_extensions/property_list.lua index 6d218e6..d379d72 100644 --- a/examples/raygui_extensions/property_list.lua +++ b/examples/raygui_extensions/property_list.lua @@ -27,6 +27,7 @@ function PropertyList:new( bounds, text, callbacks, styles, tooltip ) object.visible = true object.disabled = false object.draggable = true + object.defaultControlHeight = 22 object.mouseScale = 1 -- Set this if drawing in different size to render texture for example. object:setSize( Vec2:new( object.bounds.width, object.bounds.height ) ) @@ -143,7 +144,7 @@ function PropertyList:addGroup( name, active, group ) }, { -- Styles. properties = { - { RL.TOGGLE, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_LEFT } + { RL.TOGGLE, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_LEFT }, } } ) @@ -233,7 +234,7 @@ function PropertyList:setSize( size ) self.bounds.width - scrollBarWidth - self.padding * 2 - borderWidth * 2, self.bounds.height - scrollBarWidth - self.padding * 2 - borderWidth * 2 ) - self.defaultControlSize = Vec2:new( self.content.width, 22 ) + self.defaultControlSize = Vec2:new( self.content.width, self.defaultControlHeight ) local _, _, view = RL.GuiScrollPanel( self.bounds, self.text, self.content, self.scroll, self.view ) self.view = Rect:new( view ) diff --git a/examples/raygui_extensions/tree_view.lua b/examples/raygui_extensions/tree_view.lua index dbccc0e..ac73d4a 100644 --- a/examples/raygui_extensions/tree_view.lua +++ b/examples/raygui_extensions/tree_view.lua @@ -39,8 +39,9 @@ function TreeView:new( bounds, text, callbacks, styles, tooltip ) object.draggable = true object.allowMove = true object.allowMultiselect = true - + object.defaultControlHeight = 22 object.mouseScale = 1 -- Set this if drawing in different size to render texture for example. + object.selectedItems = {} object:setSize( Vec2:new( object.bounds.width, object.bounds.height ) ) @@ -161,14 +162,12 @@ function TreeView:checkItem( controls, item, mode ) if 0 < #control.controls then self:checkItem( control.controls, item, mode ) end - if mode == self.RANGE_SELECT then - if self._idRange[1] <= control._id and control._id <= self._idRange[2] then - control.active = true - end + if mode == self.RANGE_SELECT and control.visible + and self._idRange[1] <= control._id and control._id <= self._idRange[2] then + control.active = true end if control.active then table.insert( self.selectedItems, control ) - -- table.insert( self.selectedItems, 1, control ) end end end @@ -245,7 +244,7 @@ function TreeView:itemSelect( item ) -- Item select. local mode = self.SINGLE_SELECT - + if self.allowMultiselect then if RL.IsKeyDown( RL.KEY_LEFT_CONTROL ) or RL.IsKeyDown( RL.KEY_RIGHT_CONTROL ) then mode = self.MULTI_SELECT @@ -384,7 +383,7 @@ function TreeView:setSize( size ) self.bounds.width - scrollBarWidth - self.padding * 2 - borderWidth * 2, self.bounds.height - scrollBarWidth - self.padding * 2 - borderWidth * 2 ) - self.defaultControlSize = Vec2:new( self.content.width, 22 ) + self.defaultControlSize = Vec2:new( self.content.width, self.defaultControlHeight ) local _, _, view = RL.GuiScrollPanel( self.bounds, self.text, self.content, self.scroll, self.view ) self.view = Rect:new( view ) |
