Fix interaction with moved color-picker (#3395)
This commit is contained in:
parent
1b830bbcb4
commit
1911248ade
|
|
@ -271,7 +271,7 @@ impl Area {
|
||||||
}
|
}
|
||||||
|
|
||||||
// interact right away to prevent frame-delay
|
// interact right away to prevent frame-delay
|
||||||
let move_response = {
|
let mut move_response = {
|
||||||
let interact_id = layer_id.id.with("move");
|
let interact_id = layer_id.id.with("move");
|
||||||
let sense = if movable {
|
let sense = if movable {
|
||||||
Sense::click_and_drag()
|
Sense::click_and_drag()
|
||||||
|
|
@ -291,18 +291,10 @@ impl Area {
|
||||||
enabled,
|
enabled,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Important check - don't try to move e.g. a combobox popup!
|
if movable && move_response.dragged() {
|
||||||
if movable {
|
|
||||||
if move_response.dragged() {
|
|
||||||
state.pivot_pos += ctx.input(|i| i.pointer.delta());
|
state.pivot_pos += ctx.input(|i| i.pointer.delta());
|
||||||
}
|
}
|
||||||
|
|
||||||
state.set_left_top_pos(
|
|
||||||
ctx.constrain_window_rect_to_area(state.rect(), drag_bounds)
|
|
||||||
.min,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (move_response.dragged() || move_response.clicked())
|
if (move_response.dragged() || move_response.clicked())
|
||||||
|| pointer_pressed_on_area(ctx, layer_id)
|
|| pointer_pressed_on_area(ctx, layer_id)
|
||||||
|| !ctx.memory(|m| m.areas.visible_last_frame(&layer_id))
|
|| !ctx.memory(|m| m.areas.visible_last_frame(&layer_id))
|
||||||
|
|
@ -314,15 +306,18 @@ impl Area {
|
||||||
move_response
|
move_response
|
||||||
};
|
};
|
||||||
|
|
||||||
state.set_left_top_pos(ctx.round_pos_to_pixels(state.left_top_pos()));
|
|
||||||
|
|
||||||
if constrain {
|
if constrain {
|
||||||
state.set_left_top_pos(
|
state.set_left_top_pos(
|
||||||
ctx.constrain_window_rect_to_area(state.rect(), drag_bounds)
|
ctx.constrain_window_rect_to_area(state.rect(), drag_bounds)
|
||||||
.left_top(),
|
.min,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.set_left_top_pos(ctx.round_pos_to_pixels(state.left_top_pos()));
|
||||||
|
|
||||||
|
// Update responsbe with posisbly moved/constrained rect:
|
||||||
|
move_response = move_response.with_new_rect(state.rect());
|
||||||
|
|
||||||
Prepared {
|
Prepared {
|
||||||
layer_id,
|
layer_id,
|
||||||
state,
|
state,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue