Skip to content

Commit

Permalink
Fix position computing and refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
LabordePierre committed Oct 26, 2024
1 parent d24e3c3 commit d72a2af
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
11 changes: 5 additions & 6 deletions src/GeoView/DShapeGeoViewProcessData.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@ DShapeGeoViewProcessData class >> isAbstract [
{ #category : #computing }
DShapeGeoViewProcessData >> computePositionFor: aDShape context: aContext [

| offset isDeviceCoordinates |
| offset |
aDShape coordinates ifNil: [ ^ aDShape coordinatesDeviceOffset ].
self processor ifNil: [ ^ nil ].

offset := aDShape coordinatesDeviceOffset ifNil: [ 0 @ 0 ].

isDeviceCoordinates := aDShape coordinates isPoint.
(aDShape isComposite not and: [ aDShape isDrawModeDevice and:[ isDeviceCoordinates ] ] ) ifTrue: [
^ aDShape coordinates + offset
].
"Return device coordinates only for draw mode device and position not managed by the parent"
(aDShape isDrawModeDevice and: [ aDShape isTranslatedByParent ])
ifTrue: [ ^ aDShape coordinates + offset ].

^ (self processor projection projCartToPixel: (aDShape coordinates))
^ (self processor projection projCartToPixel: aDShape coordinates)
+ offset
]

Expand Down
5 changes: 1 addition & 4 deletions src/GeoView/GeoViewDShapesLayer.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,7 @@ GeoViewDShapesLayer >> updateModel: aContext [

| dShapes |
self userDataChangesMutex critical: [
dShapes := self userModel select: [ :e |
e isComposite
ifTrue: [ e isDrawModeUser or:[ e hasDrawModeUserChildren ] ]
ifFalse: [ e isDrawModeUser ] ].
dShapes := self userModel select: [ :e | e hasUserComputing ].

super updateDShapes: dShapes ]
]
Expand Down
4 changes: 1 addition & 3 deletions src/GeoView/GeoViewDomainObjectsLayer.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,7 @@ GeoViewDomainObjectsLayer >> updateModel: aContext [
| dShapes |
self userDataChangesMutex critical: [
dShapes := self displayModel getDatas select: [ :e |
e isComposite
ifTrue: [ e isDrawModeUser or:[ e hasDrawModeUserChildren ] ]
ifFalse: [ e isDrawModeUser ] ].
e hasUserComputing ].

self updateDShapes: dShapes ]
]
Expand Down

0 comments on commit d72a2af

Please sign in to comment.