Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rendering glitch: dashed borders in the parent are inherited to child #597

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/Bloc-Alexandrie-Tests/BlSpaceFixture.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,41 @@ BlSpaceFixture >> buildCapRoundDashedBorderOnClosedGeometry [

]

{ #category : #fixtures }
BlSpaceFixture >> buildChildDoesntInheritDashedBorder [

| outskirts |
builder spaceExtent: 90 @ 50.
builder space root layout: BlFlowLayout horizontal.

outskirts := {
BlOutskirts centered.
BlOutskirts inside.
BlOutskirts outside }.

#(true false) do: [ :childHasBorder |
outskirts do: [ :eachOutskirt |
| parent child |
parent := builder addToRoot
size: 25 @ 20;
margin: (BlInsets all: 2.5);
outskirts: eachOutskirt;
layout: BlFrameLayout new;
border: (BlBorder builder
paint: Color blue;
width: 2;
dashArray: #(2 2);
build).
child := (builder addTo: parent)
size: 12 asPoint;
constraintsDo: [ :c |
c frame horizontal alignCenter.
c frame vertical alignCenter ].
childHasBorder ifTrue: [
child border: (BlBorder paint: Color white width: 4) ] ] ]

]

{ #category : #fixtures }
BlSpaceFixture >> buildClippingAbsolutelyTransparentElement [
"Add 3 elements, where only the last one should be clipped by it's transparent parent.
Expand Down
6 changes: 3 additions & 3 deletions src/Bloc-Alexandrie/BlBorder.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ BlBorder >> aeApplyTo: aeCanvas element: aBlElement [
aeCanvas setBorderBlock: [
paint aeApplyTo: aeCanvas.

"No dashes is the default"
style dashArray ifNotEmpty: [ :da |
aeCanvas setDashes: da offset: style dashOffset ].
aeCanvas
setDashes: style dashArray
offset: style dashOffset.

aBlElement geometry hasJoins ifTrue: [
style lineJoin
Expand Down
7 changes: 3 additions & 4 deletions src/Bloc-Alexandrie/BlTextBorderAttribute.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ BlTextBorderAttribute >> aeDrawOn: aeCanvas span: aBASpan [
aeCanvas setBorderBlock: [
border paint aeApplyTo: aeCanvas.

border style dashArray ifNotEmpty: [ :da |
aeCanvas
setDashes: da
offset: border style dashOffset ].
aeCanvas
setDashes: border style dashArray
offset: border style dashOffset.

border style lineJoin
aeApplyTo: aeCanvas
Expand Down
Binary file added tests/hit/buildChildDoesntInheritDashedBorder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.