Add option to avoid drag & drop timeline range from edges

Related to #1498 in some way to start enabling new selection modes in
the timeline.
This commit is contained in:
David Capello 2023-09-19 12:07:14 -03:00
parent e2d8ffab54
commit d8814fa2f9
5 changed files with 15 additions and 6 deletions

View File

@ -204,6 +204,7 @@
<option id="select_on_click" type="bool" default="false" /> <option id="select_on_click" type="bool" default="false" />
<option id="select_on_click_with_key" type="bool" default="true" /> <option id="select_on_click_with_key" type="bool" default="true" />
<option id="select_on_drag" type="bool" default="true" /> <option id="select_on_drag" type="bool" default="true" />
<option id="drag_and_drop_from_edges" type="bool" default="true" />
</section> </section>
<section id="cursor"> <section id="cursor">
<option id="use_native_cursor" type="bool" default="false" /> <option id="use_native_cursor" type="bool" default="false" />

View File

@ -1677,6 +1677,7 @@ Enable the selected range of layers/frames/cels
when we press the mouse button and after we move when we press the mouse button and after we move
the mouse to another position. the mouse to another position.
END END
drag_and_drop_from_edges = Drag && drop from edges
reset_as_v12 = Reset as Aseprite v1.2 reset_as_v12 = Reset as Aseprite v1.2
default_first_frame = Default First Frame: default_first_frame = Default First Frame:
ui_mouse_cursor = UI Mouse Cursor ui_mouse_cursor = UI Mouse Cursor

View File

@ -295,6 +295,9 @@
text="@.select_on_drag" text="@.select_on_drag"
tooltip="@.select_on_drag_tooltip" tooltip="@.select_on_drag_tooltip"
pref="timeline.select_on_drag" /> pref="timeline.select_on_drag" />
<check id="drag_and_drop_from_edges"
text="@.drag_and_drop_from_edges"
pref="timeline.drag_and_drop_from_edges" />
<hbox> <hbox>
<hbox expansive="true" /> <hbox expansive="true" />
<button id="reset_timeline_sel" text="@general.reset" width="60" /> <button id="reset_timeline_sel" text="@general.reset" width="60" />

View File

@ -1701,18 +1701,21 @@ private:
layout(); layout();
} }
void onResetTimelineSel() { void onResetTimelineSelCommon() {
keepSelection()->setSelected(false); keepSelection()->setSelected(false);
selectOnClick()->setSelected(false);
selectOnClickWithKey()->setSelected(true); selectOnClickWithKey()->setSelected(true);
selectOnDrag()->setSelected(true); selectOnDrag()->setSelected(true);
dragAndDropFromEdges()->setSelected(true);
}
void onResetTimelineSel() {
onResetTimelineSelCommon();
selectOnClick()->setSelected(false);
} }
void onResetTimelineSelV12() { void onResetTimelineSelV12() {
keepSelection()->setSelected(false); onResetTimelineSelCommon();
selectOnClick()->setSelected(true); selectOnClick()->setSelected(true);
selectOnClickWithKey()->setSelected(true);
selectOnDrag()->setSelected(true);
} }
gfx::Rect gridBounds() const { gfx::Rect gridBounds() const {

View File

@ -3529,7 +3529,8 @@ Timeline::Hit Timeline::hitTest(ui::Message* msg, const gfx::Point& mousePos)
mouseMsg && mouseMsg &&
mouseMsg->right()) || mouseMsg->right()) ||
// Drag with left-click only if we are inside the range edges // Drag with left-click only if we are inside the range edges
!gfx::Rect(outline).shrink(2*outlineWidth()).contains(mousePos)) { (Preferences::instance().timeline.dragAndDropFromEdges() &&
!gfx::Rect(outline).shrink(2*outlineWidth()).contains(mousePos))) {
hit.part = PART_RANGE_OUTLINE; hit.part = PART_RANGE_OUTLINE;
} }
} }