[英]How to create an arrow morph in smalltalk80 (squeak) programmatically?
I need to draw an arrow morph from center of one given morph to center of another given morph. 我需要从一个给定变形的中心到另一个给定变形的中心绘制一个箭头变形。
Any help would be appreciated. 任何帮助,将不胜感激。
Assuming a
and b
are your morphs: 假设a
和b
是您的变形:
arrow := (LineMorph from: a center to: b center color: Color red width: 2) makeForwardArrow.
arrow openInWorld.
If you want to update the position after the morphs move, do this: 如果要在变形移动后更新位置,请执行以下操作:
arrow setVertices: {a center. b center}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.