The Inbox: Graphics-ct.426.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Graphics-ct.426.mcz

commits-2
A new version of Graphics was added to project The Inbox:
http://source.squeak.org/inbox/Graphics-ct.426.mcz

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

Name: Graphics-ct.426
Author: ct
Time: 17 February 2020, 3:51:55.266432 pm
UUID: caf55267-3502-f54f-920f-08579194a5fd
Ancestors: Graphics-pre.424

Repairs LayoutFrame>>printOn:

Fractions are expected to be nil in certain situations. It would not be correct to treat every nil as zero, see #minWidthFrom: as an example. This commit also hides zero offsets.

=============== Diff against Graphics-pre.424 ===============

Item was changed:
  ----- Method: LayoutFrame>>printOn: (in category 'printing') -----
  printOn: aStream
 
  super printOn: aStream.
-
  aStream nextPutAll: '( '.
+ { {'l'. self leftFraction. self leftOffset}. {'t'. self topFraction. self topOffset}. {'r'. self rightFraction. self rightOffset}. {'b'. self bottomFraction. self bottomOffset} }
+ do: [ :spec |
+ aStream nextPutAll: spec first; space.
+ spec second
+ ifNil: [aStream print: nil]
+ ifNotNil: [:fraction | aStream print: fraction maxDecimalPlaces: 2].
+ spec third ifNotNil: [:offset |
+ offset isZero ifFalse: [
+ aStream
+ nextPutAll: (offset positive ifTrue: ['+'] ifFalse: ['-']);
+ print: offset abs maxDecimalPlaces: 0]] ]
+ separatedBy: [ aStream space ].
-
- { {'l'. self leftFraction. self leftOffset}. {'t'. self topFraction. self topOffset}. {'r'. self rightFraction. self rightOffset}. {'b'. self bottomFraction. self bottomOffset} } do: [:spec |
- aStream nextPutAll: spec first; space.
-
- spec second printOn: aStream maxDecimalPlaces: 2.
-
- aStream nextPutAll: ((spec third ifNil: [0]) >= 0 ifTrue: ['+'] ifFalse: ['-']).
- (spec third ifNil: [0]) abs printOn: aStream maxDecimalPlaces: 0]
- separatedBy: [aStream space].
-
  aStream nextPutAll: ' )'.!