Implement shrink option (#376)

* Add shrink option that allow change default shrink

Shrink option allow to scale the godot application. This path enable
dynamic change of this value in the options.

* Fix the computation of cursor location

For an unknown reason the function get_local_mouse_position return
incorrect current_pixel when shrink is not 1. This path compute the
transformation manually and povide correct values for any shrink value.
This commit is contained in:
gschwind 2020-11-07 02:57:35 +01:00 committed by GitHub
parent 613dc9f0c8
commit 279228daba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 6 deletions

View file

@ -50,7 +50,10 @@ func _input(event : InputEvent) -> void:
# elif not get_viewport_rect().has_point(event.position):
# return
current_pixel = get_local_mouse_position() + location
#current_pixel = get_local_mouse_position() + location
var tmp_transform = get_canvas_transform().affine_inverse()
var tmp_position = Global.main_viewport.get_local_mouse_position()
current_pixel = tmp_transform.basis_xform(tmp_position)+tmp_transform.origin
if Global.has_focus:
update()