Object libraries like Vector2 optimizations.
This commit is contained in:
@@ -20,8 +20,8 @@ function TreeView:new( bounds, text, callbacks, styles, tooltip )
|
||||
|
||||
object.bounds = bounds:clone()
|
||||
object.text = text
|
||||
object.scroll = Vec2:new()
|
||||
object.view = Rect:new()
|
||||
object.scroll = Vec2:new( 0, 0 )
|
||||
object.view = Rect:new( 0, 0, 0, 0 )
|
||||
object.callbacks = callbacks -- select, grab, drag.
|
||||
object.styles = styles
|
||||
object.tooltip = tooltip
|
||||
@@ -269,7 +269,7 @@ function TreeView:itemSelect( item )
|
||||
end
|
||||
|
||||
function TreeView:update()
|
||||
local mousePos = Vec2:new( RL.GetMousePosition() )
|
||||
local mousePos = Vec2:newT( RL.GetMousePosition() )
|
||||
local guiMousePos = mousePos + self.gui.mouseOffset
|
||||
local mouseInView = self.view:checkCollisionPoint( mousePos )
|
||||
|
||||
@@ -336,8 +336,8 @@ end
|
||||
function TreeView:draw()
|
||||
local oldScroll = self.scroll:clone()
|
||||
local _, scroll, view = RL.GuiScrollPanel( self.bounds, self.text, self.content, self.scroll, self.view )
|
||||
self.view:set( view )
|
||||
self.scroll:set( scroll )
|
||||
self.view:setT( view )
|
||||
self.scroll:setT( scroll )
|
||||
|
||||
if self.scroll ~= oldScroll or self._forceCheckScroll then
|
||||
if not self._forceCheckScroll then
|
||||
@@ -386,7 +386,7 @@ function TreeView:setSize( size )
|
||||
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 )
|
||||
self.view = Rect:newT( view )
|
||||
|
||||
self.gui.view = Rect:new( 0, 0, self.view.width, self.view.height )
|
||||
self.framebufferSize = Vec2:new( self.bounds.width, self.bounds.height - self.gui.RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT )
|
||||
|
||||
Reference in New Issue
Block a user