Made Zoom tool work on the second viewport too

This commit is contained in:
Manolis Papadeas 2021-02-01 21:07:09 +02:00
parent 097367ac45
commit 40f6a24fdc
2 changed files with 9 additions and 1 deletions

View file

@ -31,6 +31,7 @@ Laurenz Reinthaler (Schweini07), kleonc, Variable-ind
- Improved the "Scale Image" dialog. It now automatically sets the size to the current project's size, has a button to lock aspect ratio, and resizing based on percentage. - Improved the "Scale Image" dialog. It now automatically sets the size to the current project's size, has a button to lock aspect ratio, and resizing based on percentage.
- Having no active selection no longer treats all the pixels of the canvas as selected. This is also a performance boost, especially for larger images, as Pixelorama no longer has to loop through all of the pixels to select them. - Having no active selection no longer treats all the pixels of the canvas as selected. This is also a performance boost, especially for larger images, as Pixelorama no longer has to loop through all of the pixels to select them.
- Tile mode rects are now cached for a little speedup. ([#443](https://github.com/Orama-Interactive/Pixelorama/pull/443)) - Tile mode rects are now cached for a little speedup. ([#443](https://github.com/Orama-Interactive/Pixelorama/pull/443))
- The zoom tool now works on the second canvas too.
### Fixed ### Fixed
- Fixed issue with pixels being selected outside of the canvas boundaries, when the selection rectangle was outside the canvas and its size got reduced. - Fixed issue with pixels being selected outside of the canvas boundaries, when the selection rectangle was outside the canvas and its size got reduced.

View file

@ -33,7 +33,14 @@ func update_config() -> void:
func draw_start(_position : Vector2) -> void: func draw_start(_position : Vector2) -> void:
Global.camera.zoom_camera(_zoom_mode * 2 - 1) var mouse_pos := get_global_mouse_position()
var viewport_rect := Rect2(Global.main_viewport.rect_global_position, Global.main_viewport.rect_size)
var viewport_rect_2 := Rect2(Global.second_viewport.rect_global_position, Global.second_viewport.rect_size)
if viewport_rect.has_point(mouse_pos):
Global.camera.zoom_camera(_zoom_mode * 2 - 1)
elif viewport_rect_2.has_point(mouse_pos):
Global.camera2.zoom_camera(_zoom_mode * 2 - 1)
func draw_move(_position : Vector2) -> void: func draw_move(_position : Vector2) -> void: