Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slider component doesn't support styles #197

Closed
unindented opened this issue Aug 1, 2022 · 1 comment
Closed

Slider component doesn't support styles #197

unindented opened this issue Aug 1, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@unindented
Copy link

I'd like to tweak the color of the pin in my slider components, with things like on_hover and on_mouse_hover, just like I do with buttons. I don't think it's possible at the moment, cause Slider doesn't make use of styles at all.

@Insality Insality added this to the 0.10.0 milestone Aug 31, 2022
@Insality Insality self-assigned this Aug 31, 2022
@Insality Insality added the enhancement New feature or request label Aug 31, 2022
@Insality Insality modified the milestones: 0.10.0, 0.11.0 Sep 9, 2022
@Insality Insality modified the milestones: 0.11.0, 0.12.0 May 10, 2023
@Insality
Copy link
Owner

Oh, hello!

i think the slider will not be supported with styles in future and more "standart" way is to after slider and a hover component with you additional style logic

It can be grouped in your own custom component to use it more easily and it can looks like this

local component = require("druid.component")

---@class my_slider: druid.base_component
local M = component.create("my_slider")


function M:init()
	self.druid = self:get_druid()

	self.slider = self.druid:new_slider("slider_node", vmath.vector3(100, 0, 0))
	self.hover = self.druid:new_hover("slider_node")
	self.hover.on_mouse_hover:subscribe(self.on_hover)
end


function M:on_hover(state)
	local alpha = state and 1.5 or 1
	gui.animate(self.slider.node, gui.PROP_SCALE, vmath.vector3(alpha), gui.EASING_OUTSINE, 0.2)
end


return M

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants