Skip to content

How do I set editor tool to draw a rectangle using external-ui? #3714

Closed Answered by SomeHats
P0PCAT-012345 asked this question in Q&A
Discussion options

You must be logged in to vote

Geo shapes are a little weird in that they're all the same shape, but the visual is determined by a style. So you need to set the tool, but also use e.g. editor.setStyleForNextShape(GeoShapeGeoStyle, 'cloud').

You can see how we do this in our own UI here:

onSelect(source: TLUiEventSource) {
editor.batch(() => {
editor.setStyleForNextShapes(GeoShapeGeoStyle, id)
editor.setCurrentTool('geo')
trackEvent('select-tool', { source, id: `geo-${id}` })
})
},

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@P0PCAT-012345
Comment options

Answer selected by P0PCAT-012345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants