This commit is contained in:
Insality
2025-02-09 14:42:25 +02:00
parent 16d20da5ab
commit d06ebd53f9
7 changed files with 103 additions and 27 deletions

View File

@@ -91,30 +91,30 @@ local helper = require("druid.helper")
local component = require("druid.component")
---@class druid.scroll: druid.base_component
---@field node node
---@field click_zone node|nil
---@field on_scroll event On scroll move callback(self, position)
---@field on_scroll_to event On scroll_to function callback(self, target, is_instant)
---@field on_point_scroll event On scroll_to_index function callback(self, index, point)
---@field view_node node Scroll view node
---@field view_border vector4 Scroll view border
---@field content_node node Scroll content node
---@field view_size vector3 Scroll view size
---@field node node The root node
---@field click_zone node|nil Optional click zone to restrict scroll area
---@field on_scroll event Triggered on scroll move with (self, position)
---@field on_scroll_to event Triggered on scroll_to with (self, target, is_instant)
---@field on_point_scroll event Triggered on scroll_to_index with (self, index, point)
---@field view_node node The scroll view node (static part)
---@field view_border vector4 The scroll view borders
---@field content_node node The scroll content node (moving part)
---@field view_size vector3 Size of the view node
---@field position vector3 Current scroll position
---@field target_position vector3 Current scroll target position
---@field available_pos vector4 Available position for content node: (min_x, max_y, max_x, min_y)
---@field available_size vector3 Size of available positions: (width, height, 0)
---@field drag druid.drag Drag Druid component
---@field selected number|nil Current index of points of interests
---@field is_animate boolean Flag, if scroll now animating by gui.animate
---@field private _is_inert boolean Flag, if scroll now moving by inertion
---@field private inertion vector3 Current inert speed
---@field private _is_horizontal_scroll boolean Flag, if scroll now horizontal
---@field private _is_vertical_scroll boolean Flag, if scroll now vertical
---@field private _grid_on_change event Grid on change items event
---@field private _grid_on_change_callback function Grid on change items callback
---@field private _offset vector3 Offset value to set, where content is starts
---@field private style table Component style params
---@field target_position vector3 Target scroll position for animations
---@field available_pos vector4 Available content position (min_x, max_y, max_x, min_y)
---@field available_size vector3 Size of available positions (width, height, 0)
---@field drag druid.drag The drag component instance
---@field selected number|nil Current selected point of interest index
---@field is_animate boolean True if scroll is animating
---@field private _is_inert boolean True if inertial scrolling is enabled
---@field private inertion vector3 Current inertial movement vector
---@field private _is_horizontal_scroll boolean True if horizontal scroll enabled
---@field private _is_vertical_scroll boolean True if vertical scroll enabled
---@field private _grid_on_change event Grid items change event
---@field private _grid_on_change_callback function Grid change callback
---@field private _offset vector3 Content start offset
---@field private style table Component style parameters
local M = component.create("scroll")

View File

@@ -424,7 +424,7 @@ function M._update_nodes(lines, settings)
gui.set_outline(node, word.outline)
gui.set_shadow(node, word.shadow)
gui.set_text(node, word.text)
gui.set_color(node, word.color or word.text_color)
gui.set_color(node, word.color)
gui.set_font(node, word.font or settings.font)
end
word.node = node

View File

@@ -100,6 +100,7 @@ local rich_text = require("druid.custom.rich_text.module.rt")
---@class druid.rich_text.word
---@field node node
---@field relative_scale number
---@field source_text string
---@field color vector4
---@field position vector3
---@field offset vector3

View File

@@ -7,6 +7,8 @@
---@field height number
---@field max_ascent number
---@field max_descent number
---@field offset_x number
---@field offset_y number
---@class utf8
---@field len fun(s: string):number
@@ -24,4 +26,4 @@
---@field format fun()
---@field lower fun()
---@field upper fun()
---@field rep fun()
---@field rep fun()

View File

@@ -85,9 +85,8 @@ local function create_widget(self, widget_class)
__index = setmetatable(widget_class, WIDGET_METATABLE)
})
local uid = base_component.create_uid()
instance._component = {
_uid = uid,
_uid = base_component.create_uid(),
name = "Druid Widget",
input_priority = const.PRIORITY_INPUT,
default_input_priority = const.PRIORITY_INPUT,