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

There is no posibility to switch off wordwrap #264

Open
zadolbaloi opened this issue Jun 21, 2022 · 2 comments
Open

There is no posibility to switch off wordwrap #264

zadolbaloi opened this issue Jun 21, 2022 · 2 comments

Comments

@zadolbaloi
Copy link

It is no way how to use "wordWrap: false" and place new lines by the '\n' charecter.
If we use -wordWrap: false, then we get "infinity" width of textContainer. It leads to disappearing texts at all.

@mimshwright
Copy link
Owner

Hi. Can you send me an example of this? I don't see the issue when I'm testing it.

From demo/index.html

            // Wrapping and Alignment
            const wrappingText = `Global word wrap and alignment properties are controlled by the "default" style, and can\'t be overridden by other styles.`;
            const wrappingStyle = {
              default: {
                fontFamily: "Arial",
                fontSize: "24px",
                fill: "#CC6600",
                wordWrap: true,
                wordWrapWidth: 150,
                align: "right",
              },
            };
            let wrapping = new TaggedText(wrappingText, wrappingStyle, {});

            const nonWrappingText = `This one doesn't have \`wordWrap\` so it just keeps going and going and going off the edge! \nHowever, you can use line breaks to manually wrap it.`;
            const nonWrappingStyle = {
              default: {
                fontFamily: "Arial",
                fontSize: "17px",
                fill: "#669900",
                wordWrap: false, // <<<<<<<<<<<<
                wordWrapWidth: 150,
                align: "left",
              },
            };
            let nonWrapping = new TaggedText(nonWrappingText, nonWrappingStyle);
            nonWrapping.x = 30;
            nonWrapping.y = 330;
            
            nonWrapping.textContainer.width; // 693

Result:
image

@zadolbaloi
Copy link
Author

Thank you for an example. If we will use align: "center" for the nonWrappingText we get an infinite textbox. And I can`t choose a width of the textContainer.

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