diff --git a/Pharo/OpenPonk-ERD/OPErdAbstractNodeShape.class.st b/Pharo/OpenPonk-ERD/OPErdAbstractNodeShape.class.st index e86b363..55fea8a 100644 --- a/Pharo/OpenPonk-ERD/OPErdAbstractNodeShape.class.st +++ b/Pharo/OpenPonk-ERD/OPErdAbstractNodeShape.class.st @@ -1,6 +1,6 @@ Class { #name : #OPErdAbstractNodeShape, - #superclass : #OPShape, + #superclass : #OPBoundNode, #instVars : [ 'adornmentCreationBlock' ], @@ -13,30 +13,32 @@ OPErdAbstractNodeShape >> adornmentCreationBlock: aBlock [ adornmentCreationBlock := aBlock ] -{ #category : #rendering } -OPErdAbstractNodeShape >> renderShapeDetails [ - - | selectable | - selectable := OPRSSelectable new. - self setupHighlight: selectable. - self roassalShape @ selectable. - self roassalShape @ OPRSSelectionDraggable. - self roassalShape @ OPRSResizable. - self roassalShape - when: RSPositionChangedEvent do: [ self updateRenderFromModel ]; - when: RSExtentChangedEvent do: [ self updateRenderFromModel ] -] - -{ #category : #hooks } -OPErdAbstractNodeShape >> setupHighlight: aHighlightable [ +{ #category : #interactions } +OPErdAbstractNodeShape >> selectableInteraction [ - aHighlightable highlightAdornments: [ :builder | + | selectableInteraction | + selectableInteraction := OPRSSelectable highlightBorderColorBlue. + adornmentCreationBlock ifNil: [ ^ selectableInteraction ]. + selectableInteraction highlightAdornments: [ :builder | builder horizontalLocation outer; right. builder verticalLocation inner; - middle. + top. builder directionDown. - adornmentCreationBlock value: builder ] + adornmentCreationBlock value: builder ]. + ^ selectableInteraction +] + +{ #category : #interactions } +OPErdAbstractNodeShape >> shouldBePositionableByUser [ + + ^ true +] + +{ #category : #interactions } +OPErdAbstractNodeShape >> shouldBeResizableByUser [ + + ^ true ] diff --git a/Pharo/OpenPonk-ERD/OPErdAttributeShape.class.st b/Pharo/OpenPonk-ERD/OPErdAttributeShape.class.st index 4e9fd56..084bea6 100644 --- a/Pharo/OpenPonk-ERD/OPErdAttributeShape.class.st +++ b/Pharo/OpenPonk-ERD/OPErdAttributeShape.class.st @@ -31,48 +31,44 @@ OPErdAttributeShape >> renderShapeDetails [ label := RSLabel new color: Color black; height: 11; - width: 10; + width: 10; model: self; yourself. RSLocation new stick: label on: self roassalShape. border := RSEllipse new - radius: (self roassalShape radius); - width: (self roassalShape width); - height: (self roassalShape height); - color: Color transparent; - border: (RSBorder new - dashArray: #(10 10); - width: 1.5; - yourself); - model: self; - yourself. + radius: self roassalShape radius; + width: self roassalShape width; + height: self roassalShape height; + color: Color transparent; + border: (RSBorder new + dashArray: #( 10 10 ); + width: 1.5; + yourself); + model: self; + yourself. RSLocation new stick: border on: self roassalShape. innerEllipse := RSEllipse new - radius: (self roassalShape radius - 3); - width: (self roassalShape width - 7); - height: (self roassalShape height - 7); - color: Color transparent; - border: (RSBorder new - color: Color transparent; - width: 1.5; - yourself); - yourself. + radius: self roassalShape radius - 3; + width: self roassalShape width - 7; + height: self roassalShape height - 7; + color: Color transparent; + border: (RSBorder new + color: Color transparent; + width: 1.5; + yourself); + yourself. RSLocation new stick: innerEllipse on: self roassalShape. self canvas - add: border; - add: label; - add: innerEllipse. - self roassalShape when: RSShapeRemovedEvent do: [ - label remove. - border remove. - innerEllipse remove ] -] - -{ #category : #rendering } -OPErdAttributeShape >> setupHighlight: aHighlightable [ - - super setupHighlight: aHighlightable. - aHighlightable highlightBorderColor: Color blue + add: border; + add: label; + add: innerEllipse. + self roassalShape + when: RSShapeRemovedEvent + do: [ + label remove. + border remove. + innerEllipse remove ] + for: self ] { #category : #'as yet unclassified' } diff --git a/Pharo/OpenPonk-ERD/OPErdEntityShape.class.st b/Pharo/OpenPonk-ERD/OPErdEntityShape.class.st index edacf3c..cb2eb1c 100644 --- a/Pharo/OpenPonk-ERD/OPErdEntityShape.class.st +++ b/Pharo/OpenPonk-ERD/OPErdEntityShape.class.st @@ -32,29 +32,29 @@ OPErdEntityShape >> renderShapeDetails [ yourself. RSLocation new stick: label on: self roassalShape. weak := RSBox new - "Size changing according to main shape" - height: (self roassalShape height - 7); - width: (self roassalShape width - 7); - color: Color transparent; - border: (RSBorder new - color: Color transparent; - width: 1.5; - yourself); - yourself. + height: self roassalShape height - 7; + width: self roassalShape width - 7; + color: Color transparent; + border: (RSBorder new + color: Color transparent; + width: 1.5; + yourself); + yourself. + + self addEventForwardingFrom: weak to: self roassalShape. + self addEventForwardingFrom: label to: self roassalShape. + + "Size changing according to main shape" RSLocation new stick: weak on: self roassalShape. self canvas add: label; add: weak. - self roassalShape when: RSShapeRemovedEvent do: [ - label remove. - weak remove ] -] - -{ #category : #rendering } -OPErdEntityShape >> setupHighlight: aHighlightable [ - - super setupHighlight: aHighlightable. - aHighlightable highlightBorderColor: Color blue + self roassalShape + when: RSShapeRemovedEvent + do: [ + label remove. + weak remove ] + for: self ] { #category : #rendering } diff --git a/Pharo/OpenPonk-ERD/OPErdExtensionsShape.class.st b/Pharo/OpenPonk-ERD/OPErdExtensionsShape.class.st index 0ced460..b87f2c3 100644 --- a/Pharo/OpenPonk-ERD/OPErdExtensionsShape.class.st +++ b/Pharo/OpenPonk-ERD/OPErdExtensionsShape.class.st @@ -42,13 +42,6 @@ OPErdExtensionsShape >> renderShapeDetails [ label remove] ] -{ #category : #hooks } -OPErdExtensionsShape >> setupHighlight: aHighlightable [ - - super setupHighlight: aHighlightable. - aHighlightable highlightBorderColor: Color blue -] - { #category : #'as yet unclassified' } OPErdExtensionsShape >> updateDetails [ self updateLabel diff --git a/Pharo/OpenPonk-ERD/OPErdRelationShape.class.st b/Pharo/OpenPonk-ERD/OPErdRelationShape.class.st index 1c02387..3a065b0 100644 --- a/Pharo/OpenPonk-ERD/OPErdRelationShape.class.st +++ b/Pharo/OpenPonk-ERD/OPErdRelationShape.class.st @@ -30,32 +30,31 @@ OPErdRelationShape >> renderShapeDetails [ yourself. RSLocation new stick: label on: self roassalShape. identifying := RSPolygon new - points: "{ 0@21. 31@0. 0@(-21). -31@0. }" - { ((self roassalShape points at: 1) asPoint x) - @((self roassalShape points at: 1) asPoint y - 3). - ((self roassalShape points at: 2) asPoint x - 4) - @((self roassalShape points at: 2) asPoint y). - ((self roassalShape points at: 3) asPoint x) - @((self roassalShape points at: 3) asPoint y + 3). - ((self roassalShape points at: 4) asPoint x + 4) - @((self roassalShape points at: 4) asPoint y).}; - color: Color transparent; - borderColor: Color transparent; - yourself. + points: { + ((self roassalShape points at: 1) asPoint x + @ ((self roassalShape points at: 1) asPoint y - 3)). + ((self roassalShape points at: 2) asPoint x - 4 + @ (self roassalShape points at: 2) asPoint y). + ((self roassalShape points at: 3) asPoint x + @ ((self roassalShape points at: 3) asPoint y + 3)). + ((self roassalShape points at: 4) asPoint x + 4 + @ (self roassalShape points at: 4) asPoint y) }; + color: Color transparent; + borderColor: Color transparent; + yourself. "{ 0@21. 31@0. 0@(-21). -31@0. }" + + self addEventForwardingFrom: identifying to: self roassalShape. + RSLocation new stick: identifying on: self roassalShape. self canvas add: label; add: identifying. - self roassalShape when: RSShapeRemovedEvent do: [ - label remove. - identifying remove ] -] - -{ #category : #rendering } -OPErdRelationShape >> setupHighlight: aHighlightable [ - - super setupHighlight: aHighlightable. - aHighlightable highlightBorderColor: Color blue + self roassalShape + when: RSShapeRemovedEvent + do: [ + label remove. + identifying remove ] + for: self ] { #category : #rendering }