From 6ef47686b5e1fcab7b4dbf56259afd5682f4902c Mon Sep 17 00:00:00 2001 From: Jan Bliznicenko Date: Mon, 24 Jun 2024 17:12:24 +0200 Subject: [PATCH] fixed showing elements dependent on others --- ...DirectionalRelationshipController.class.st | 55 ++++++++++++++----- .../OPElementController.class.st | 13 ++--- .../OPRSSelectionDraggable.class.st | 14 +++-- 3 files changed, 54 insertions(+), 28 deletions(-) diff --git a/repository/OpenPonk-Core/OPDirectionalRelationshipController.class.st b/repository/OpenPonk-Core/OPDirectionalRelationshipController.class.st index 750918e1..8a60b42a 100644 --- a/repository/OpenPonk-Core/OPDirectionalRelationshipController.class.st +++ b/repository/OpenPonk-Core/OPDirectionalRelationshipController.class.st @@ -15,13 +15,14 @@ Class { #tag : 'Controllers' } -{ #category : 'figures' } +{ #category : 'construction' } OPDirectionalRelationshipController >> createDiagramElement [ super createDiagramElement. - self diagramElement - source: self source ensureDiagramElement; - target: self target ensureDiagramElement + ^ self diagramElement + source: self source ensureDiagramElement; + target: self target ensureDiagramElement; + yourself ] { #category : 'hooks' } @@ -47,16 +48,34 @@ OPDirectionalRelationshipController >> edgeBuilder [ 'Depracated without replacement - use Roassal directly or define own figures' ] +{ #category : 'accessing' } +OPDirectionalRelationshipController >> ensureSourceIn: aDiagramController [ + + ^ source ifNil: [ + self source: + (aDiagramController showWithoutDependentInDiagramModel: + self modelSource) ] +] + +{ #category : 'accessing' } +OPDirectionalRelationshipController >> ensureTargetIn: aDiagramController [ + + ^ target ifNil: [ + self target: + (aDiagramController showWithoutDependentInDiagramModel: + self modelTarget) ] +] + { #category : 'accessing' } OPDirectionalRelationshipController >> modelSource [ - ^ self model source + ^ model source ] { #category : 'accessing' } OPDirectionalRelationshipController >> modelTarget [ - ^ self model target + ^ model target ] { #category : 'rendering' } @@ -65,28 +84,36 @@ OPDirectionalRelationshipController >> renderSimplified [ diagramElement := self diagramElementClass renderSimplifiedForController: self. ] +{ #category : 'construction' } +OPDirectionalRelationshipController >> showWithoutDependentInDiagram: aDiagramController [ + + self ensureSourceIn: aDiagramController. + self ensureTargetIn: aDiagramController. + ^ super showWithoutDependentInDiagram: aDiagramController +] + { #category : 'accessing' } OPDirectionalRelationshipController >> source [ - ^ source ifNil: [ - (diagramController ifNil: [ self target diagramController ]) - ensureControllerFor: self modelSource ] + ^ self ensureSourceIn: + (self diagramController ifNil: [ self target diagramController ]) ] { #category : 'accessing' } OPDirectionalRelationshipController >> source: aSourceController [ - source := aSourceController + + ^ source := aSourceController ] { #category : 'accessing' } OPDirectionalRelationshipController >> target [ - ^ target ifNil: [ - (diagramController ifNil: [ self source diagramController ]) - ensureControllerFor: self modelTarget ] + ^ self ensureTargetIn: + (self diagramController ifNil: [ self source diagramController ]) ] { #category : 'accessing' } OPDirectionalRelationshipController >> target: aTargetController [ - target := aTargetController + + ^ target := aTargetController ] diff --git a/repository/OpenPonk-Core/OPElementController.class.st b/repository/OpenPonk-Core/OPElementController.class.st index eb654d63..6c70301b 100644 --- a/repository/OpenPonk-Core/OPElementController.class.st +++ b/repository/OpenPonk-Core/OPElementController.class.st @@ -44,9 +44,9 @@ OPElementController >> attachTo: aDiagramController [ { #category : 'construction' } OPElementController >> createDiagramElement [ - diagramElement := self diagramElementClass - in: self diagramElementOwner - forModelElement: self model + ^ diagramElement := self diagramElementClass + in: self diagramElementOwner + forModelElement: self model ] { #category : 'deprecated' } @@ -189,11 +189,8 @@ OPElementController >> renderFigureIn: aCanvas [ { #category : 'construction' } OPElementController >> showInDiagram: aDiagramController [ - aDiagramController addController: self. - self ensureDiagramElement. - self renderDiagramElement. - self dependentElements do: [ :each | - aDiagramController showInDiagramModel: each ] + self showWithoutDependentInDiagram: aDiagramController. + super showInDiagram: aDiagramController ] { #category : 'construction' } diff --git a/repository/OpenPonk-Roassal/OPRSSelectionDraggable.class.st b/repository/OpenPonk-Roassal/OPRSSelectionDraggable.class.st index fd099f53..5271c768 100644 --- a/repository/OpenPonk-Roassal/OPRSSelectionDraggable.class.st +++ b/repository/OpenPonk-Roassal/OPRSSelectionDraggable.class.st @@ -90,15 +90,17 @@ OPRSSelectionDraggable >> dragStepForEvent: evt [ ifPresent: #configuration ifAbsent: [ OPRSControlConfiguration new ]. dragSnapShapeAmount := evt altKeyPressed - ifTrue: [ 0 ] - ifFalse: [ - configuration - dragSnapComparisonsAmount ]. - snapMargin := configuration dragSnapMargin. + ifTrue: [ 0 ] + ifFalse: [ + configuration dragSnapComparisonsAmount ]. originalDragStep := (evt camera distanceFromPixelToSpace: evt step) + unusedStep. unusedStep := 0 @ 0. - dragSnapShapeAmount isZero ifTrue: [ ^ originalDragStep ]. + dragSnapShapeAmount isZero ifTrue: [ + self replaceAlignmentLinesWith: #( ). + ^ originalDragStep ]. + + snapMargin := configuration dragSnapMargin. primaryShapeRectangle := evt shape encompassingRectangle translateBy: originalDragStep. primaryShapePosition := primaryShapeRectangle center.