Show location lines programatically

Programmatic way to show location guides.

command.showPositionGuides(sceneNode);

Use Case
Shelly is creating instructions wizard for her team on their new drafting project in XD. She’s responsible for ensuring the position of the layout is accurate. Her plugin moves through each object in the artboard and she wants to show the size and position. She uses the showPosition() to show guides for each scene node.

I think that that’s a good idea, but how can a user “unshow” those guides again? If you use a dialog window, the view is blocked anyway (so you can’t just hide them after the plugin is done executing) and otherwise, some sort of control to unshow the guides manually has to be implemented.

The only alternative is hiding them programmatically. However, this would provide an excelent source for bugs in plugins (which we don’t really have in such a way, yet), since unexperienced developers might not fail-safe unshow them in every event (it is difficult to do so when one’s somewhat experienced) :wink:

1 Like

Or else it can be acheive through introducing events in api that developers can get on object change in scenegraph

1 Like

Yes. You’d want an unshow() method to go along with it.

Don’t worry. You’re users will let you know if a bug exists that you’ve missed. :slight_smile:

But, yes, it would be a good idea to call a commands.unshowPositionGuides() method wherever you call myDialog.close().

1 Like

The way they are shown now is through holding ALT key down. My guess is that even if you have a method to show positioning guides as soon as your dialog closes the current rules would apply to hide guides unless the ALT key is held down meaning they would go away on their own or the developer would get an email telling them to bug test their plugin at least once :slight_smile: