image draging works with scale now
This commit is contained in:
parent
91e31fed7e
commit
5adc76505d
3 changed files with 6 additions and 4 deletions
|
@ -61,9 +61,10 @@ pub fn modify_sys(
|
|||
if let Some(size) = assets.get(h).map(|x| x.size()) {
|
||||
let size = size * 0.5;
|
||||
let t = gtransforms.get(e).unwrap();
|
||||
let scale = t.to_scale_rotation_translation().0;
|
||||
// Disregard rotations for now plz
|
||||
let diff = (mouse_pos - t.translation().xy()).abs();
|
||||
if diff.x < size.x && diff.y < size.y {
|
||||
if diff.x < size.x * scale.x && diff.y < size.y * scale.y {
|
||||
*holding = Holding::Image(e, mouse_pos - t.translation().xy());
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use bevy::math::{Vec3Swizzles, Mat2};
|
||||
use bevy::prelude::*;
|
||||
use bevy_egui::{egui, EguiContext};
|
||||
use bevy_prototype_lyon::prelude::{Path, DrawMode, FillMode, StrokeMode};
|
||||
use bevy_prototype_lyon::prelude::{Path, DrawMode};
|
||||
use crate::*;
|
||||
|
||||
#[derive(Default, Deref, DerefMut, Clone)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue