[squeak-dev] The Inbox: Graphics-ct.437.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Aug 24 11:26:55 UTC 2020


Christoph Thiede uploaded a new version of Graphics to project The Inbox:
http://source.squeak.org/inbox/Graphics-ct.437.mcz

==================== Summary ====================

Name: Graphics-ct.437
Author: ct
Time: 24 August 2020, 1:26:40.516818 pm
UUID: 66c6c2fd-6978-6d43-8eda-c22f0a5defca
Ancestors: Graphics-kfr.436

Proposal: Add Point >> #exactCenter:, complementing Graphics-cbc.372. Refine relevant method comments in Point and Rectangle.

Usage example:

	m := Morph new.
	m changeProportionalLayout.
	
	n := Morph new.
	n color: Color red.
	m addMorph: n fullFrame: (LayoutFrame fractions: (
		0.5 @ 0.25 exactCenter: 0.5 @ 0.5)).
	
	m openInHand.

=============== Diff against Graphics-kfr.436 ===============

Item was changed:
  ----- Method: Point>>center: (in category 'converting to rectangle') -----
  center: aPoint 
+ 	"Answer a Rectangle whose extent is the receiver and whose center is approximately aPoint (after rounding to integers). This is one of the infix ways of expressing the creation of a rectangle."
- 	"Answer a Rectangle whose extent is the receiver and whose center is 
- 	aPoint. This is one of the infix ways of expressing the creation of a 
- 	rectangle."
  
+ 	^ Rectangle center: aPoint extent: self!
- 	^Rectangle center: aPoint extent: self!

Item was added:
+ ----- Method: Point>>exactCenter: (in category 'converting to rectangle') -----
+ exactCenter: aPoint 
+ 	"Answer a Rectangle whose extent is the receiver and whose center is exactly aPoint. This is one of the infix ways of expressing the creation of a rectangle."
+ 
+ 	^ Rectangle exactCenter: aPoint extent: self!

Item was changed:
  ----- Method: Rectangle class>>center:extent: (in category 'instance creation') -----
  center: centerPoint extent: extentPoint 
+ 	"Answer an instance of me whose center is approximately centerPoint (after rounding to integers) and whose extent is extentPoint."
- 	"Answer an instance of me whose center is centerPoint and width 
- 	by height is extentPoint.  "
  
+ 	^ self origin: centerPoint - (extentPoint // 2) extent: extentPoint!
- 	^self origin: centerPoint - (extentPoint//2) extent: extentPoint!

Item was changed:
  ----- Method: Rectangle class>>exactCenter:extent: (in category 'instance creation') -----
  exactCenter: centerPoint extent: extentPoint 
+ 	"Answer an instance of me whose center is exactly centerPoint and whose extent is extentPoint."
+ 
- 	"Answer an instance of me whose center is centerPoint and width 
- 	by height is extentPoint. "
  	^ self origin: centerPoint - (extentPoint / 2) extent: extentPoint
  !



More information about the Squeak-dev mailing list