1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Guides now move with a step of 0.5 pixels

This commit is contained in:
OverloadedOrama 2020-09-30 13:12:01 +03:00
parent 2bc5a919fb
commit 54cfecacc4
2 changed files with 9 additions and 6 deletions

View file

@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- A new purple theme. - A new purple theme.
### Changed ### Changed
- Guides now move with a step of 0.5 pixels. That makes it possible to have guides (and symmetry guides) to be in the middle of pixels.
- Changed how Dark, Gray, Caramel and Light themes look. All theme elements now have the same spacing and margins. - Changed how Dark, Gray, Caramel and Light themes look. All theme elements now have the same spacing and margins.
### Fixed ### Fixed

View file

@ -35,11 +35,13 @@ func _input(_event : InputEvent):
if has_focus and visible: if has_focus and visible:
if Input.is_action_pressed("left_mouse"): if Input.is_action_pressed("left_mouse"):
if type == Types.HORIZONTAL: if type == Types.HORIZONTAL:
points[0].y = round(mouse_pos.y) var yy = stepify(mouse_pos.y, 0.5)
points[1].y = round(mouse_pos.y) points[0].y = yy
points[1].y = yy
else: else:
points[0].x = round(mouse_pos.x) var xx = stepify(mouse_pos.x, 0.5)
points[1].x = round(mouse_pos.x) points[0].x = xx
points[1].x = xx
if Input.is_action_just_released("left_mouse"): if Input.is_action_just_released("left_mouse"):
Global.has_focus = true Global.has_focus = true
has_focus = false has_focus = false
@ -53,10 +55,10 @@ func _draw() -> void:
var zoom: Vector2 = Global.camera.zoom var zoom: Vector2 = Global.camera.zoom
if type == Types.HORIZONTAL: if type == Types.HORIZONTAL:
draw_set_transform(Vector2(Global.camera.offset.x - (viewport_size.x / 2) * zoom.x, points[0].y + font.get_height() * zoom.x * 2), rotation, zoom * 2) draw_set_transform(Vector2(Global.camera.offset.x - (viewport_size.x / 2) * zoom.x, points[0].y + font.get_height() * zoom.x * 2), rotation, zoom * 2)
draw_string(font, Vector2.ZERO, "%spx" % str(round(mouse_pos.y))) draw_string(font, Vector2.ZERO, "%spx" % str(stepify(mouse_pos.y, 0.5)))
else: else:
draw_set_transform(Vector2(points[0].x + font.get_height() * zoom.y, Global.camera.offset.y - (viewport_size.y / 2.25) * zoom.y), rotation, zoom * 2) draw_set_transform(Vector2(points[0].x + font.get_height() * zoom.y, Global.camera.offset.y - (viewport_size.y / 2.25) * zoom.y), rotation, zoom * 2)
draw_string(font, Vector2.ZERO, "%spx" % str(round(mouse_pos.x))) draw_string(font, Vector2.ZERO, "%spx" % str(stepify(mouse_pos.x, 0.5)))
func outside_canvas() -> bool: func outside_canvas() -> bool: