0

I draw a circle inside a square in Smalltalk But I want to reduce it size by 10% so i tried to write it like that:

initialize
 | circleWidth circleHeight|
  super initialize.
  self label: ''.
  self borderWidth: 0.
  bounds := 0@0 corner: 70@70.

  circle := CircleMorph new.
  circleWidth := self bounds width*0.9.
  circleHeight := self bounds height*0.9.
  circle bounds: self bounds*0.9.

  circle color: Color paleBuff.
  circle borderWidth: 1.
  self addMorphCentered: circle.


  offColor := Color gray darker.
  onColor := Color gray darker.
  self useSquareCorners.
  self turnOff

But the line: circle bounds: self bounds*0.9. has some problem when compiling "Message not understood rectangle >>*" how can I do it?

aka.nice
  • 9,100
  • 1
  • 28
  • 40
Yuval Levy
  • 2,397
  • 10
  • 44
  • 73

1 Answers1

2

Use the message scaleBy: scale to scale a rectangle.

So

circle bounds: self bounds*0.9.

becomes:

circle bounds: (self bounds scaleBy: 0.9).
MartinW
  • 4,966
  • 2
  • 24
  • 60