mirror of
https://github.com/enso-org/enso.git
synced 2024-12-30 15:44:39 +03:00
Use correct position to calculate edge dragging. (https://github.com/enso-org/ide/pull/575)
Original commit: c1f703e045
This commit is contained in:
parent
e9e9feda1c
commit
e759b267be
@ -933,6 +933,12 @@ impl SceneData {
|
||||
self.context.viewport(0,0,canvas.width as i32, canvas.height as i32);
|
||||
});
|
||||
}
|
||||
|
||||
pub fn screen_to_scene_coordinates(&self, position:Vector3<f32>) -> Vector3<f32> {
|
||||
let position = position / self.camera().zoom();
|
||||
let position = Vector4::new(position.x, position.y, position.z, 1.0);
|
||||
(self.camera().inversed_view_matrix() * position).xyz()
|
||||
}
|
||||
}
|
||||
|
||||
impl display::Object for SceneData {
|
||||
|
@ -1501,6 +1501,12 @@ fn new_graph_editor(world:&World) -> GraphEditor {
|
||||
let outputs = UnsealedFrpOutputs::new();
|
||||
let sealed_outputs = outputs.seal(); // Done here to keep right eval order.
|
||||
|
||||
// === Mouse Cursor Transform ===
|
||||
frp::extend! { network
|
||||
cursor_pos_in_scene <- cursor.frp.position.map(f!((position) {
|
||||
scene.screen_to_scene_coordinates(*position).xy()
|
||||
}));
|
||||
}
|
||||
|
||||
// === Selection Target Redirection ===
|
||||
frp::extend! { network
|
||||
@ -1842,8 +1848,8 @@ fn new_graph_editor(world:&World) -> GraphEditor {
|
||||
|
||||
// === Move Edges ===
|
||||
detached_edge <- any(&inputs.some_edge_targets_detached,&inputs.some_edge_sources_detached);
|
||||
cursor_pos_on_detach <- cursor.frp.position.sample(&detached_edge);
|
||||
edge_refresh_cursor_pos <- any (cursor_pos_on_detach,cursor.frp.position);
|
||||
cursor_pos_on_detach <- cursor_pos_in_scene.sample(&detached_edge);
|
||||
edge_refresh_cursor_pos <- any (cursor_pos_on_detach,cursor_pos_in_scene);
|
||||
|
||||
is_hovering_output <- inputs.hover_node_output.map(|target| target.is_some());
|
||||
hover_node <- inputs.hover_node_output.unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user