Skip to content

Commit

Permalink
fixed showing elements dependent on others
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Jun 24, 2024
1 parent 4655942 commit 6ef4768
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand All @@ -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' }
Expand All @@ -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
]
13 changes: 5 additions & 8 deletions repository/OpenPonk-Core/OPElementController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down Expand Up @@ -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' }
Expand Down
14 changes: 8 additions & 6 deletions repository/OpenPonk-Roassal/OPRSSelectionDraggable.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 6ef4768

Please sign in to comment.