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

Rendering nodes in order means contentEditable TextNodes could be unfocusable #4

Open
BlastWind opened this issue Mar 7, 2021 · 0 comments

Comments

@BlastWind
Copy link
Owner

with something along the lines of

    if (nodeData.type === "circle") {
      viewContainer
        .append("svg")
        .style("position", "absolute")
        .attr("width", "100%")
        .attr("height", "100%")
        .attr("class", "circleNodeContainer")
        .append("circle")
        .attr("r", 30)
        .attr("cx", nodeData.x)
        .attr("cy", nodeData.y);
    } else if (nodeData.type === "text") {
      viewContainer
        .append("div")
        .style("position", "absolute")
        .attr("contenteditable", true)
        .text("akdlfj");
    }
  });

I can append circle node and text node in order. However, circle nodes are currently rendered with a full sized SVG, which means: if a text node is rendered before a circle node, it can never be focused.

Two potential solutions (or really 1?):

  1. Don't render in order. Render circles first, text nodes second. Only display in order when text nodes need not to be edited/focused (e.g., when users are viewing a published roadmap?).
  2. Render circles at cx=cy=0 with an adjusted SVG (issue, still, SVG are squared, which means if a text node lies beneath the squared portion, it is unfocusable although it might appear it is.

Using solution 1 for now.

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

1 participant