質問

I'm new to Smalltalk, so please bear with me. I'm simply trying to make a simple drawing using Morphs.

Now I can create Circles and Lines, but I'm having issues adjusting the start and end point in my workspace.

If you can offer any advice I'd greatly appreciate it!

man := Morph new.
head := CircleMorph new color: Color blue.
body := LineMorph new.
man addMorph: head.
man addMorph:  body.
man openInWindow.
役に立ちましたか?

解決

verticesAt:put: allows you to directly change the points in a LineMorph:

line := LineMorph new.
line verticesAt: 1 put: 0@0.
line verticesAt: 2 put: 100@50.

or use the #vertices:color:borderWidth:borderColor: class-side method:

LineMorph 
    vertices: (Array with: 0@0 with: 100@50)
    color: Color transparent
    borderWidth: 1
    borderColor: Color black
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top