-
Notifications
You must be signed in to change notification settings - Fork 182
Open
Description
I have a page with an existing svg
element that I loaded from a an asset file like icon.svg
. Then I wanted to attach a pts Space
to it to add additional interactive graphics, or to enable interaction on the existing objects within the svg
. Is there a way for SVGSpace
or SVGForm
to be aware of these existing objects so they are persistent?
// svg: SVGSVGElement
const space = new SVGSpace(svg)
space.bindMouse()
space.add({
/**
* @param type Event type, simplification of raw `event.type`.
* @param x Location x.
* @param y Location y.
* @param event Event.
*/
action: function (type, x, y, event) {
form.scope(this)
form.fill('red')
// simple example to draw red cursor at pointer location
form.circle(Circle.fromCenter([x, y], 10))
}
} as IPlayer)
// when this method is called, all existing objects in `svg` are deleted
space.play()
Metadata
Metadata
Assignees
Labels
No labels