[squeak-dev] The Trunk: Morphic-ct.1909.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Feb 25 15:34:02 UTC 2022


Christoph Thiede uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ct.1909.mcz

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

Name: Morphic-ct.1909
Author: ct
Time: 25 February 2022, 4:33:31.520129 pm
UUID: 99e9076d-aa95-0a46-9dad-9269468c3948
Ancestors: Morphic-mt.1908

Fine-tunes the appearance of Morphic text cursors for different scale factors and restores anti-aliasing. Thanks to Marcel for the feedback! Follow-up of Morphic-ct.1899.

=============== Diff against Morphic-mt.1908 ===============

Item was changed:
  ----- Method: NewParagraph>>displayDumbbellCursorOn:at:in: (in category 'display') -----
  displayDumbbellCursorOn: aCanvas at: leftX in: line
  
  	| w |
+ 	w := (2 "pixels" * (RealEstateAgent scaleFactor max: 1)) truncated.
- 	w := (3 "pixels" * (RealEstateAgent scaleFactor max: 1)) truncated.
  	self focused ifFalse: [^ w].
  	
  	1 to: w
  		do: 
  			[:i | 
  			"Draw caret triangles at top and bottom"
  
  			aCanvas fillRectangle: ((leftX - w + i - 1) @ (line top + i - 1) 
  						extent: ((w - i) * 2 + 3) @ 1)
  				color: self caretColor.
  			aCanvas fillRectangle: ((leftX - w + i - 1) @ (line bottom - i) 
  						extent: ((w - i) * 2 + 3) @ 1)
  				color: self caretColor].
  	
  	aCanvas
+ 		fillRectangle: (leftX - (w // 4) @ line top rect: leftX + (w + 1 / 2) ceiling @ line bottom - 1)
- 		fillRectangle: (leftX - (w // 4) @ line top rect: leftX + (w + 1 // 2) @ line bottom - 1)
  		color: self caretColor.
  	
  	^ w!

Item was changed:
  ----- Method: NewParagraph>>displaySimpleCursorOn:at:in: (in category 'display') -----
  displaySimpleCursorOn: aCanvas at: leftX in: line
  
+ 	| scale width |
- 	| width |
  	self focused ifFalse: [^ 1].
  	
+ 	scale := RealEstateAgent scaleFactor.
+ 	width := 1.7 "pixels" * (scale max: 1).
- 	width := (2 "pixels" * (RealEstateAgent scaleFactor max: 1)) truncated.
  	
  	aCanvas
+ 		fillRectangle: (leftX @ (line top + 1) rect: leftX + width truncated @ (line bottom - 1))
- 		fillRectangle: (leftX @ (line top + 1) rect: leftX + width @ line bottom - 1)
  		color: self caretColor.
+ 	"Manual anti-aliasing for smaller scales"
+ 	(width < 3
+ 		and: [scale >= 1 "but not for tiny scales where every pixel counts"]
+ 		and: [width fractionPart > 0])
+ 			ifTrue: [
+ 				aCanvas
+ 					line: leftX + width truncated @ (line top + 1)
+ 					to: leftX + width truncated @ (line bottom - 2)
+ 					color: (self caretColor alpha: 1 - width fractionPart)].
+ 	
+ 	^ width ceiling!
- 		
- 	^ width!



More information about the Squeak-dev mailing list