Skip to content

Commit

Permalink
added inverted method to attach points
Browse files Browse the repository at this point in the history
  • Loading branch information
akevalion committed Sep 27, 2022
1 parent 29f128c commit a341579
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Roassal3-Chart/RSAbstractPlot.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ c addDecoration: RSYMarkerDecoration new.
c
```
"
self assert: [ aCollection notNil ] description: 'Cannot be nil'.
self assert: [ aCollection2 notNil ] description: 'Cannot be nil'.
self assert: [ aCollection isCollection ] description: 'Should be a collection'.
self assert: [ aCollection2 isCollection ] description: 'Should be a collection'.
self assert: [ aCollection size = aCollection2 size ] description: 'The two collections must have the same size'.

xValues := aCollection.
Expand Down
20 changes: 20 additions & 0 deletions src/Roassal3-Global-Tests/RSAttachPointTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,26 @@ RSAttachPointTest >> testHorizontalAttachPoint [
self assert: (l attachPoint endingPointOf: l) equals: 50 @ 50
]

{ #category : #tests }
RSAttachPointTest >> testInverted [
| ap e1 e2 line |
ap := RSCenteredAttachPoint new.
ap straight.
self deny: ap isInverted.
e1 := RSEllipse new.
e2 := RSEllipse new.
e1 translateTo: 20 asPoint.
line := RSLine new.
line attachPoint: ap.
line from: e1.
line to: e2.
line update.
self assert: e1 position equals: line startPoint.
ap inverted.
line update.
self assert: e1 position equals: line endPoint.
]

{ #category : #tests }
RSAttachPointTest >> testVerticalAttachPoint [
| b1 b2 l c |
Expand Down
15 changes: 15 additions & 0 deletions src/Roassal3-Shapes/RSAttachPoint.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ RSAttachPoint >> initialize [
inverted := false.
]

{ #category : #public }
RSAttachPoint >> inverted [
inverted := true
]

{ #category : #testing }
RSAttachPoint >> isInverted [
^ inverted
]

{ #category : #private }
RSAttachPoint >> matrixFor: commonParents [
| matrix |
Expand Down Expand Up @@ -143,3 +153,8 @@ RSAttachPoint >> startingPointOf: aLine [
ifFalse: [ self basicStartingPointOf: aLine ]

]

{ #category : #public }
RSAttachPoint >> straight [
inverted := false
]

0 comments on commit a341579

Please sign in to comment.