@@ -12,7 +12,7 @@ use bevy_math::{prelude::*, DVec2, DVec3};
1212use bevy_platform:: collections:: HashMap ;
1313use bevy_reflect:: prelude:: * ;
1414use bevy_transform:: prelude:: * ;
15- use bevy_window:: PrimaryWindow ;
15+ use bevy_window:: { PrimaryWindow , Window } ;
1616
1717use bevy_picking:: pointer:: {
1818 PointerAction , PointerId , PointerInput , PointerInteraction , PointerLocation , PointerMap ,
@@ -183,6 +183,7 @@ impl EditorCamInputMessage {
183183 }
184184
185185 /// Receive [`EditorCamInputMessage`]s, and use these to start and end moves on the [`EditorCam`].
186+ #[ allow( clippy:: too_many_arguments) ]
186187 pub fn receive_messages (
187188 mut events : MessageReader < Self > ,
188189 mut controllers : Query < ( & mut EditorCam , & GlobalTransform ) > ,
@@ -191,6 +192,7 @@ impl EditorCamInputMessage {
191192 pointer_interactions : Query < & PointerInteraction > ,
192193 pointer_locations : Query < & PointerLocation > ,
193194 cameras : Query < ( & Camera , & Projection ) > ,
195+ windows : Query < & Window > ,
194196 ) {
195197 for event in events. read ( ) {
196198 let Ok ( ( mut controller, cam_transform) ) = controllers. get_mut ( event. camera ( ) ) else {
@@ -206,6 +208,11 @@ impl EditorCamInputMessage {
206208 . get_entity ( * pointer)
207209 . and_then ( |entity| pointer_interactions. get ( entity) . ok ( ) )
208210 . and_then ( |interaction| interaction. get_nearest_hit ( ) )
211+ // Since `bevy` 0.17.3:
212+ //
213+ // If the current hit is on a window, we cannot use the `hit.position` as an anchor
214+ // as the `hit.position` is in viewport coordinates.
215+ . filter ( |( entity, _hit) | !windows. contains ( * entity) )
209216 . and_then ( |( _, hit) | hit. position )
210217 . map ( |world_space_hit| {
211218 // Convert the world space hit to view (camera) space
0 commit comments