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

Bug: guides not rendering when adding programmatically #86

Open
SidIcarus opened this issue Dec 8, 2023 · 0 comments
Open

Bug: guides not rendering when adding programmatically #86

SidIcarus opened this issue Dec 8, 2023 · 0 comments

Comments

@SidIcarus
Copy link

SidIcarus commented Dec 8, 2023

Environments

Description

In the demo I have the addGuides button on the right hand side. Upon clicking it, it adds guides in increments of 20 to both the horizontal and vertical guides. These state of guides are found under editor.state.horizontalGuides, editor.horizontalGuides.getGuides(), & editor.moveableLayer.horizontalGuidelines, along with the vertical ones in the vertical named properties; these values are console.logged out after they are modified via addGuides.

The singular element that is generated is snappable to the moveable guides upon clicking the button but the guides have not been rendered. Calling forceUpdate() on either the guides instances does not force them to render(). But, if I interact with the guides before or after clicking the button, the new guides will render once. After that, it goes back to not rendering until I interact with it again.

Is there a way to force it to render programmatically? Or a way to a request modifying (add,remove,move) a guide?

Edit:

It seems like retrieving the innerGuide and calling forceUpdate() does force the rendering. Not sure why the outer one doesn't seem to work.

2nd Edit:

In addition to calling the getInnerGuide().forceUpdate() You'll also need to reload the guides so that you can continue adding guides via the ruler.

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