Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output pin text not rendering correctly. #166

Open
nathan130200 opened this issue Sep 12, 2022 · 2 comments
Open

Output pin text not rendering correctly. #166

nathan130200 opened this issue Sep 12, 2022 · 2 comments

Comments

@nathan130200
Copy link

I'm having small problem with output pins. I'm new with imgui and nodes, and i've created an basic POO classes to manage all nodes/pins, but output attributes isn't right aligned:

image

I had tried do some calc text size, but don't worked. My render code for pin:

void Pin::Render()
{
	PushColorStyle(ImNodesCol_Pin, m_type);
	PushColorStyle(ImNodesCol_PinHovered, m_type);
	PushColorStyle(ImNodesCol_Link, m_type);
	PushColorStyle(ImNodesCol_LinkHovered, m_type);
	PushColorStyle(ImNodesCol_LinkSelected, m_type);

	if (m_kind == PinKind_In)
		BeginInputAttribute(m_id, m_shape);
	else if (m_kind == PinKind_Out)
		BeginOutputAttribute(m_id, m_shape);

	if (m_title.size() > 0)
	{
		ImGui::Text("%s", m_title.c_str());
		//ImGui::TextUnformatted(m_title.c_str());
	}

	if (ImGui::IsItemHovered() && m_description.size() > 0) {
		ImGui::BeginTooltip();
		ImGui::TextUnformatted(m_description.c_str());
		ImGui::EndTooltip();
	}

	if (m_kind == PinKind_In)
		EndInputAttribute();
	else if (m_kind == PinKind_Out)
		EndOutputAttribute();

	PopColorStyle();
	PopColorStyle();
	PopColorStyle();
	PopColorStyle();
	PopColorStyle();
}
@nathan130200
Copy link
Author

Also mixing with ImGui controls, node is getting too big:
image

@navyenzo
Copy link

navyenzo commented Apr 7, 2024

in order to kind of fix this issue I keep track of desired node Width for each type of node in my application, and I set the node width, abs draw the node

then when drawing the output pins, i set the cursor at the node with - calculated text size and it surprisingly works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants