[squeak-dev] The Inbox: Graphics-kfr.537.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Sep 26 19:58:38 UTC 2022
A new version of Graphics was added to project The Inbox:
http://source.squeak.org/inbox/Graphics-kfr.537.mcz
==================== Summary ====================
Name: Graphics-kfr.537
Author: kfr
Time: 26 September 2022, 9:58:35.27649 pm
UUID: c934ad0f-ad3d-0b4d-a0f8-10af5613d3b3
Ancestors: Graphics-nice.536
Give Point same methods for printing limited decimal places as Number
=============== Diff against Graphics-nice.536 ===============
Item was added:
+ ----- Method: Point>>printOn:showingDecimalPlaces: (in category 'printing') -----
+ printOn: aStream showingDecimalPlaces: placesDesired
+ "The receiver prints on aStream in terms of infix notation."
+
+ x printOn: aStream showingDecimalPlaces: placesDesired.
+ aStream nextPut: $@.
+ (y isNumber and: [y negative]) ifTrue:
+ "Avoid ambiguous @- construct"
+ [aStream space].
+ y printOn: aStream showingDecimalPlaces: placesDesired.!
Item was added:
+ ----- Method: Point>>printShowingDecimalPlaces: (in category 'printing') -----
+ printShowingDecimalPlaces: placesDesired
+ "Print the receiver showing precisely the given number of places desired. If placesDesired is positive, a decimal point and that many digits after the decimal point will always be shown. If placesDesired is zero, a whole number will be shown, without a decimal point."
+
+ ^String new: placesDesired + 10 streamContents: [:aStream |
+ self printOn: aStream showingDecimalPlaces: placesDesired]!
More information about the Squeak-dev
mailing list
|