Skip to content

Commit

Permalink
- fix node width when using longer node names & being folded
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph-hart committed Sep 30, 2024
1 parent 4d39c10 commit 9551adf
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion currentGitHash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
35da98ae75eb8d7d856ba083fb31fe44d37491a6
4d39c10811fdff150c2fd0c8552997dac2a177f2
2 changes: 1 addition & 1 deletion hi_backend/backend/currentGit.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define PREVIOUS_HISE_COMMIT "35da98ae75eb8d7d856ba083fb31fe44d37491a6"
#define PREVIOUS_HISE_COMMIT "4d39c10811fdff150c2fd0c8552997dac2a177f2"
13 changes: 11 additions & 2 deletions hi_scripting/scripting/scriptnode/api/NodeBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,18 @@ juce::UndoManager* NodeBase::getUndoManager(bool returnIfPending) const

juce::Rectangle<int> NodeBase::getBoundsToDisplay(Rectangle<int> originalHeight) const
{
auto titleWidth = GLOBAL_BOLD_FONT().getStringWidthFloat(getName());
auto minWidth = jmax<int>(UIValues::NodeWidth, titleWidth + UIValues::HeaderHeight * 4);

if (v_data[PropertyIds::Folded])
originalHeight = originalHeight.withHeight(UIValues::HeaderHeight).withWidth(UIValues::NodeWidth);

{

originalHeight = originalHeight.withHeight(UIValues::HeaderHeight).withWidth(minWidth);
}

if(originalHeight.getWidth() < minWidth)
originalHeight.setWidth(minWidth);

auto helpBounds = helpManager.getHelpSize().toNearestInt();

if (!helpBounds.isEmpty())
Expand Down
11 changes: 11 additions & 0 deletions hi_scripting/scripting/scriptnode/api/NodeBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,17 @@ class NodeBase : public ConstScriptingObject
NodeBase* getParentNode() const;
ValueTree getValueTree() const;
String getId() const;

String getName() const
{
auto nid = getValueTree()[PropertyIds::Name].toString();

if(nid.isEmpty())
return getId();

return nid;
}

UndoManager* getUndoManager(bool returnIfPending=false) const;

Rectangle<int> getBoundsToDisplay(Rectangle<int> originalHeight) const;
Expand Down
2 changes: 1 addition & 1 deletion hi_scripting/scripting/scriptnode/nodes/NodeContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ juce::Rectangle<int> NodeContainer::getContainerPosition(bool isVerticalContaine

minWidth = jmax(UIValues::NodeWidth, minWidth);

auto titleWidth = GLOBAL_BOLD_FONT().getStringWidthFloat(asNode()->getId());
auto titleWidth = GLOBAL_BOLD_FONT().getStringWidthFloat(asNode()->getName());

minWidth = jmax<int>(minWidth, titleWidth + UIValues::HeaderHeight * 4);

Expand Down

0 comments on commit 9551adf

Please sign in to comment.