From d72a2afdc86ac4f2091da312fbb2da8206c8b3c4 Mon Sep 17 00:00:00 2001 From: Pierre Laborde Date: Sat, 26 Oct 2024 22:35:32 +0200 Subject: [PATCH] Fix position computing and refactoring --- src/GeoView/DShapeGeoViewProcessData.class.st | 11 +++++------ src/GeoView/GeoViewDShapesLayer.class.st | 5 +---- src/GeoView/GeoViewDomainObjectsLayer.class.st | 4 +--- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/GeoView/DShapeGeoViewProcessData.class.st b/src/GeoView/DShapeGeoViewProcessData.class.st index f76c511..7950362 100644 --- a/src/GeoView/DShapeGeoViewProcessData.class.st +++ b/src/GeoView/DShapeGeoViewProcessData.class.st @@ -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 ] diff --git a/src/GeoView/GeoViewDShapesLayer.class.st b/src/GeoView/GeoViewDShapesLayer.class.st index 7fab369..25876be 100644 --- a/src/GeoView/GeoViewDShapesLayer.class.st +++ b/src/GeoView/GeoViewDShapesLayer.class.st @@ -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 ] ] diff --git a/src/GeoView/GeoViewDomainObjectsLayer.class.st b/src/GeoView/GeoViewDomainObjectsLayer.class.st index e897159..ac81372 100644 --- a/src/GeoView/GeoViewDomainObjectsLayer.class.st +++ b/src/GeoView/GeoViewDomainObjectsLayer.class.st @@ -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 ] ]