Reputation: 783
I want to get a very basic interaction with a SVG loaded through Athens in Pharo using Morphic. This example shows what I'm looking for. I have used
(ASVGMorph fromFile: 'lion.svg') drawOn: Display getCanvas
but clicking the SVG makes the picture dissapear. However all examples I have seen were using a web browser. Is this possible using Athens? There is any other work in this area?
Upvotes: 3
Views: 711
Reputation: 1137
Yes, as Esteban pointed, to keep morph on desktop, you should add it to world, i.e. use
ASVGMorph is very basic, however, and not intended to serve all possible use cases. For more advanced uses, it is preferred to use ASVGRoot instance and draw it in own morph or compose with other drawings.
Upvotes: 2
Reputation: 4357
That's because you are drawing it in display canvas, which is refreshed every time... so is natural that you lost it...
What you need to do is:
(ASVGMorph fromFile: 'lion.svg') openInWorld.
or better, you probably want to put it in a window:
(ASVGMorph fromFile: 'lion.svg') openInWindow.
at the end, you will probably want it inside some other morph that you create, but debugging anyone of the solutions above with show you how to proceed :)
Upvotes: 3