Skip to content

Commit

Permalink
use ctrl-drag to duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
carrotIndustries committed Jun 18, 2019
1 parent 3567736 commit 7406a05
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/core/tool_paste.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ ToolResponse ToolPaste::update(const ToolArgs &args)
update_tip();
return ToolResponse::fast();
}
else if (args.type == ToolEventType::CLICK) {
else if (args.type == ToolEventType::CLICK || (is_transient && args.type == ToolEventType::CLICK_RELEASE)) {
if (args.button == 1) {
merge_selected_junctions();
core.r->commit();
Expand Down
12 changes: 9 additions & 3 deletions src/imp/imp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ void ImpBase::run(int argc, char *argv[])

canvas->signal_motion_notify_event().connect([this](GdkEventMotion *ev) {
if (selection_for_drag_move.size()) {
handle_drag();
handle_drag(ev->state & Gdk::CONTROL_MASK);
}
return false;
});
Expand Down Expand Up @@ -878,7 +878,7 @@ void ImpBase::handle_tool_action(const ActionConnection &conn)
tool_begin(conn.tool_id);
}

void ImpBase::handle_drag()
void ImpBase::handle_drag(bool ctrl)
{
auto pos = canvas->get_cursor_pos_win();
auto delta = pos - cursor_pos_drag_begin;
Expand All @@ -889,7 +889,13 @@ void ImpBase::handle_drag()
ToolArgs args;
args.coords = cursor_pos_grid_drag_begin;
args.selection = selection_for_drag_move;
ToolResponse r = core.r->tool_begin(ToolID::MOVE, args, imp_interface.get(), true);
ToolID tool_id;
if (ctrl)
tool_id = ToolID::DUPLICATE;
else
tool_id = ToolID::MOVE;

ToolResponse r = core.r->tool_begin(tool_id, args, imp_interface.get(), true);
tool_process(r);
}
selection_for_drag_move.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/imp/imp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class ImpBase {
private:
void fix_cursor_pos();
Glib::RefPtr<Gio::FileMonitor> preferences_monitor;
void handle_drag();
void handle_drag(bool ctrl);
void update_selection_label();
std::string get_tool_settings_filename(ToolID id);

Expand Down

0 comments on commit 7406a05

Please sign in to comment.