-
Notifications
You must be signed in to change notification settings - Fork 32
Remove viewport focus check from MapView _process #673
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,9 +131,13 @@ func _ready() -> void: | |
| _map_text.generate_map_names() | ||
|
|
||
| func _notification(what: int) -> void: | ||
| if what == NOTIFICATION_WM_MOUSE_EXIT: | ||
| _mouse_over_viewport = false | ||
| province_unhovered.emit() | ||
| match what: | ||
| NOTIFICATION_WM_MOUSE_ENTER: | ||
| _mouse_over_viewport = true | ||
| queue_province_hover_update() | ||
| NOTIFICATION_WM_MOUSE_EXIT: | ||
| _mouse_over_viewport = false | ||
| province_unhovered.emit() | ||
|
|
||
| func _world_to_map_coords(pos : Vector3) -> Vector2: | ||
| return (Vector2(pos.x, pos.z) - _map_mesh_corner) / _map_mesh_dims | ||
|
|
@@ -213,7 +217,6 @@ func _input(event : InputEvent) -> void: | |
| var _cardinal_movement_vector := Vector2.ZERO | ||
| func _unhandled_input(event : InputEvent) -> void: | ||
| if event is InputEventMouseMotion: | ||
| _mouse_over_viewport = true | ||
| queue_province_hover_update() | ||
|
|
||
| elif event.is_action(_action_north) or event.is_action(_action_south)\ | ||
|
|
@@ -278,10 +281,6 @@ func _process(delta : float) -> void: | |
| if _cardinal_movement_vector != Vector2.ZERO and get_window().gui_get_focus_owner() != null: | ||
| _cardinal_movement_vector = Vector2.ZERO | ||
|
|
||
| if _is_viewport_inactive(): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this case handled via the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be now, in the old code we weren't catching the on exit stuff iirc, it was just doing a check each tick. Not sure why it was like that, this system should be more correct(?) |
||
| _mouse_over_viewport = false | ||
| province_unhovered.emit() | ||
|
|
||
| _viewport_dims = Vector2(Resolution.get_current_resolution()) | ||
| # Process movement | ||
| _movement_process(delta) | ||
|
|
@@ -387,9 +386,6 @@ func _on_minimap_clicked(pos_clicked : Vector2) -> void: | |
| _clamp_over_map() | ||
| queue_province_hover_update() | ||
|
|
||
| func _is_viewport_inactive() -> bool: | ||
| return not get_window().has_focus() or get_window().is_input_handled() | ||
|
|
||
| func enable_processing() -> void: | ||
| set_process_unhandled_input(true) | ||
| set_process(true) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.