<commit_before>Extension { #name : #BlElementVectorGeometry }

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> buildPathOnSpartaCanvas: aCanvas [
	^ self subclassResponsibility
]

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> containsPoint: aPoint in: aBlElement [
	"Note: we have to pass BlElement in order to give geometry a chance to use element properties
	as as border during the testing process"

	^ aBlElement isAttachedToSceneGraph
		ifTrue: [
			aBlElement space containsPoint: aPoint in: aBlElement ]
		ifFalse: [
			self
				containsPoint: aPoint
				in: aBlElement
				onSpartaCanvas: Bloc preferableSpartaCanvas offscreen ]

]

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> containsPoint: aPoint in: anElement onSpartaCanvas: aSpartaCanvas [
	"Note: I am a fallback method to determine if a point lies within a geometry path
	when geometry is complex and it is mathematically difficult to compute manually"

	| aPath |
	aPath := pathCache pathOnSpartaCanvas: aSpartaCanvas.
	^ aSpartaCanvas fill
		path: aPath;
		containsPoint: aPoint
]

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> pathOnSpartaCanvas: aCanvas of: aBlElement [
	<return: #TSpartaPath>
	
	^ pathCache pathOnSpartaCanvas: aCanvas
]

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> strokedBounds: aBlBounds of: anElement on: aCanvas [
	"Return stroked bounds of a geometry if it would be stroked according to element's border configuration.
	Dispatch through outskirts first"
	<return: #BlBounds>

	^ aBlBounds rectangle: (pathCache strokedBounds: aBlBounds of: anElement on: aCanvas)
]

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> strokedBoundsCentered: aBlBounds of: anElement on: aCanvas [
	| spartaPath strokeOptions strokedBounds |

	spartaPath := anElement geometry pathOnSpartaCanvas: aCanvas of: anElement.
	strokeOptions := aCanvas stroke
		width: (anElement border width max: 1);
		in: [ :aPainter | anElement border style applyOn: aPainter ];
		strokeOptions.

	strokedBounds := spartaPath strokedBoundsOn: aCanvas with: strokeOptions.
	^ aBlBounds rectangle: strokedBounds
]

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> strokedBoundsInside: aBlBounds of: anElement on: aCanvas [
	"Stroked inside bounds property is equal to geometry bounds"
	<return: #BlBounds>

	^ self geometryBounds: aBlBounds
]

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> strokedBoundsOutside: aBlBounds of: anElement on: aCanvas [
	| spartaPath strokeOptions strokedBounds |

	spartaPath := anElement geometry pathOnSpartaCanvas: aCanvas of: anElement.
	strokeOptions := aCanvas stroke
		in: [ :aPainter | anElement border style applyOn: aPainter ];
		width: ((anElement border width * 2.0) max: 1);
		strokeOptions.

	strokedBounds := spartaPath strokedBoundsOn: aCanvas with: strokeOptions.
	^ aBlBounds rectangle: strokedBounds
]
<commit_msg>Fix containsPoint:in:<commit_after>Extension { #name : #BlElementVectorGeometry }

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> buildPathOnSpartaCanvas: aCanvas [
	^ self subclassResponsibility
]

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> containsPoint: aPoint in: aBlElement [
	"Note: we have to pass BlElement in order to give geometry a chance to use element properties
	as as border during the testing process"

	^ aBlElement isAttachedToSceneGraph
		ifTrue: [
			aBlElement space containsPoint: aPoint element: aBlElement geometry: self ]
		ifFalse: [
			self
				containsPoint: aPoint
				in: aBlElement
				onSpartaCanvas: Bloc preferableSpartaCanvas offscreen ]

]

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> containsPoint: aPoint in: anElement onSpartaCanvas: aSpartaCanvas [
	"Note: I am a fallback method to determine if a point lies within a geometry path
	when geometry is complex and it is mathematically difficult to compute manually"

	| aPath |
	aPath := pathCache pathOnSpartaCanvas: aSpartaCanvas.
	^ aSpartaCanvas fill
		path: aPath;
		containsPoint: aPoint
]

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> pathOnSpartaCanvas: aCanvas of: aBlElement [
	<return: #TSpartaPath>
	
	^ pathCache pathOnSpartaCanvas: aCanvas
]

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> strokedBounds: aBlBounds of: anElement on: aCanvas [
	"Return stroked bounds of a geometry if it would be stroked according to element's border configuration.
	Dispatch through outskirts first"
	<return: #BlBounds>

	^ aBlBounds rectangle: (pathCache strokedBounds: aBlBounds of: anElement on: aCanvas)
]

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> strokedBoundsCentered: aBlBounds of: anElement on: aCanvas [
	| spartaPath strokeOptions strokedBounds |

	spartaPath := anElement geometry pathOnSpartaCanvas: aCanvas of: anElement.
	strokeOptions := aCanvas stroke
		width: (anElement border width max: 1);
		in: [ :aPainter | anElement border style applyOn: aPainter ];
		strokeOptions.

	strokedBounds := spartaPath strokedBoundsOn: aCanvas with: strokeOptions.
	^ aBlBounds rectangle: strokedBounds
]

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> strokedBoundsInside: aBlBounds of: anElement on: aCanvas [
	"Stroked inside bounds property is equal to geometry bounds"
	<return: #BlBounds>

	^ self geometryBounds: aBlBounds
]

{ #category : #'*Bloc-Sparta' }
BlElementVectorGeometry >> strokedBoundsOutside: aBlBounds of: anElement on: aCanvas [
	| spartaPath strokeOptions strokedBounds |

	spartaPath := anElement geometry pathOnSpartaCanvas: aCanvas of: anElement.
	strokeOptions := aCanvas stroke
		in: [ :aPainter | anElement border style applyOn: aPainter ];
		width: ((anElement border width * 2.0) max: 1);
		strokeOptions.

	strokedBounds := spartaPath strokedBoundsOn: aCanvas with: strokeOptions.
	^ aBlBounds rectangle: strokedBounds
]

{'fraction_non_alphanumeric': 0.08657786885245902, 'fraction_numerical': 0.001366120218579235, 'mean_word_length': 5.3524945770065075, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4901255', 'n_tokens_mistral': 1907, 'n_tokens_neox': 1822, 'n_words': 551}