mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Fix palette swatch highlight not being shown
This commit is contained in:
parent
06b405dae8
commit
165217acc3
|
@ -69,8 +69,8 @@ func draw_palette() -> void:
|
|||
var grid_index := i + grid_size.x * j
|
||||
var index := convert_grid_index_to_palette_index(grid_index)
|
||||
var swatch := swatches[grid_index]
|
||||
swatch.show_left_highlight = false
|
||||
swatch.show_right_highlight = false
|
||||
swatch.show_left_highlight = Palettes.left_selected_color == index
|
||||
swatch.show_right_highlight = Palettes.right_selected_color == index
|
||||
var color = current_palette.get_color(index)
|
||||
if color != null:
|
||||
swatch.color = color
|
||||
|
|
|
@ -81,10 +81,12 @@ func _on_PaletteScroll_gui_input(event: InputEvent) -> void:
|
|||
palette_grid.change_swatch_size(Vector2i.ONE)
|
||||
else:
|
||||
scroll_vector = Vector2i.LEFT if event.shift_pressed else Vector2i.UP
|
||||
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
||||
elif event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
||||
if event.ctrl_pressed:
|
||||
palette_grid.change_swatch_size(-Vector2i.ONE)
|
||||
else:
|
||||
scroll_vector = Vector2i.RIGHT if event.shift_pressed else Vector2i.DOWN
|
||||
else:
|
||||
return
|
||||
resize_grid()
|
||||
set_sliders(palette_grid.current_palette, palette_grid.grid_window_origin + scroll_vector)
|
||||
|
|
|
@ -34,12 +34,12 @@ func set_swatch_size(swatch_size: Vector2) -> void:
|
|||
func _draw() -> void:
|
||||
if not empty:
|
||||
# Black border around swatches with a color
|
||||
draw_rect(Rect2(Vector2.ZERO, size), Color.BLACK, false, 1)
|
||||
draw_rect(Rect2(Vector2.ONE, size), Color.BLACK, false, 1)
|
||||
|
||||
if show_left_highlight:
|
||||
# Display outer border highlight
|
||||
draw_rect(Rect2(Vector2.ZERO, size), Color.WHITE, false, 1)
|
||||
draw_rect(Rect2(Vector2.ONE, size - Vector2(2, 2)), Color.BLACK, false, 1)
|
||||
draw_rect(Rect2(Vector2.ONE, size), Color.WHITE, false, 1)
|
||||
draw_rect(Rect2(Vector2(2, 2), size - Vector2(2, 2)), Color.BLACK, false, 1)
|
||||
|
||||
if show_right_highlight:
|
||||
# Display inner border highlight
|
||||
|
|
Loading…
Reference in a new issue