Allow detaching of links by dragging
This commit is contained in:
parent
5a59bc2abc
commit
b330829f09
@ -8,8 +8,16 @@ namespace hex {
|
||||
|
||||
ViewDataProcessor::ViewDataProcessor() : View("Data Processor") {
|
||||
imnodes::Initialize();
|
||||
imnodes::PushAttributeFlag(imnodes::AttributeFlags_EnableLinkDetachWithDragClick);
|
||||
imnodes::PushAttributeFlag(imnodes::AttributeFlags_EnableLinkCreationOnSnap);
|
||||
|
||||
View::subscribeEvent(Events::SettingsChanged, [this](auto) {
|
||||
{
|
||||
static bool always = true;
|
||||
imnodes::IO& io = imnodes::GetIO();
|
||||
io.link_detach_with_modifier_click.modifier = &always;
|
||||
}
|
||||
|
||||
View::subscribeEvent(Events::SettingsChanged, [](auto) {
|
||||
int theme = ContentRegistry::Settings::getSettingsData()["Interface"]["Color theme"];
|
||||
|
||||
switch (theme) {
|
||||
@ -33,6 +41,8 @@ namespace hex {
|
||||
for (auto &node : this->m_nodes)
|
||||
delete node;
|
||||
|
||||
imnodes::PopAttributeFlag();
|
||||
imnodes::PopAttributeFlag();
|
||||
imnodes::Shutdown();
|
||||
}
|
||||
|
||||
@ -217,6 +227,13 @@ namespace hex {
|
||||
|
||||
imnodes::EndNodeEditor();
|
||||
|
||||
{
|
||||
int linkId;
|
||||
if (imnodes::IsLinkDestroyed(&linkId)) {
|
||||
this->eraseLink(linkId);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int from, to;
|
||||
if (imnodes::IsLinkCreated(&from, &to)) {
|
||||
|
Loading…
Reference in New Issue
Block a user