3

我想使用 Morphic 在 Pharo 中与通过雅典加载的 SVG 进行非常基本的交互。这个例子显示了我在寻找什么。我用过

(ASVGMorph fromFile: 'lion.svg') drawOn: Display getCanvas

但是单击 SVG 会使图片消失。但是,我看到的所有示例都是使用 Web 浏览器。这可能使用雅典吗?这方面还有其他工作吗?

4

2 回答 2

3

那是因为你在显示画布中绘制它,每次都会刷新它......所以你失去它是很自然的......

你需要做的是:

(ASVGMorph fromFile: 'lion.svg') openInWorld.

或者更好,你可能想把它放在一个窗口中:

(ASVGMorph fromFile: 'lion.svg') openInWindow.

最后,您可能希望它在您创建的其他一些变形中,但调试上述解决方案中的任何一个都会向您展示如何继续:)

于 2013-01-31T08:29:10.160 回答
2

Yes, as Esteban pointed, to keep morph on desktop, you should add it to world, i.e. use

openInWorld, or #openInWindow.

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.

于 2013-02-05T11:56:49.570 回答