Skip to content

Commit

Permalink
improved settings names
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Oct 14, 2023
1 parent ebf35e9 commit f944ba1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 37 deletions.
58 changes: 29 additions & 29 deletions repository/OpenPonk-Roassal3/OPRSControlConfiguration.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,53 @@ Class {
#instVars : [
'hasZoomableAnimation',
'keepCameraOnContent',
'dragAttachmentComparisonsAmount',
'dragAttachmentMargin'
'dragSnapComparisonsAmount',
'dragSnapMargin'
],
#classInstVars : [
'keepCameraOnContent',
'dragAttachmentMargin',
'dragAttachmentComparisonsAmount'
'dragSnapComparisonsAmount'
],
#category : #'OpenPonk-Roassal3-Interactions'
}

{ #category : #accessing }
OPRSControlConfiguration class >> dragAttachmentComparisonsAmount [
OPRSControlConfiguration class >> dragSnapComparisonsAmount [

^ dragAttachmentComparisonsAmount ifNil: [
self dragAttachmentComparisonsAmountDefault ]
^ dragSnapComparisonsAmount ifNil: [
self dragSnapComparisonsAmountDefault ]
]

{ #category : #accessing }
OPRSControlConfiguration class >> dragAttachmentComparisonsAmount: anInteger [
OPRSControlConfiguration class >> dragSnapComparisonsAmount: anInteger [

self assert: anInteger isInteger.
self assert: anInteger >= 0.
dragAttachmentComparisonsAmount := anInteger
dragSnapComparisonsAmount := anInteger
]

{ #category : #accessing }
OPRSControlConfiguration class >> dragAttachmentComparisonsAmountDefault [
OPRSControlConfiguration class >> dragSnapComparisonsAmountDefault [

^ 10
]

{ #category : #accessing }
OPRSControlConfiguration class >> dragAttachmentMargin [
OPRSControlConfiguration class >> dragSnapMargin [

^ dragAttachmentMargin ifNil: [ self dragAttachmentMarginDefault ]
^ dragAttachmentMargin ifNil: [ self dragSnapMarginDefault ]
]

{ #category : #accessing }
OPRSControlConfiguration class >> dragAttachmentMargin: aNumber [
OPRSControlConfiguration class >> dragSnapMargin: aNumber [

self assert: aNumber >= 0.
dragAttachmentMargin := aNumber
]

{ #category : #accessing }
OPRSControlConfiguration class >> dragAttachmentMarginDefault [
OPRSControlConfiguration class >> dragSnapMarginDefault [

^ 5
]
Expand Down Expand Up @@ -79,46 +79,46 @@ OPRSControlConfiguration class >> settingsOn: aBuilder [
'When enabled, canvas tries to limit you from zooming/dragging away from area with existing shapes, so at least part of the existing diagram is usually always seen. Only affects newly displayed diagrams.';
order: 60.

(aBuilder setting: #dragAttachmentComparisonsAmount)
(aBuilder setting: #dragSnapComparisonsAmount)
parent: #openponk;
target: self;
label: 'Shapes checked for dragging attachments';
label: 'Shapes checked for drag snapping';
description:
'When dragging a shape, it is compared to this amount of closes shape in order to try to attach to it horizontally or vertically. The more amount of shapes, the more distant ones is it compared to and the slower dragging gets. Use 0 to turn the attaching feature off.';
'When dragging a shape, it is compared to this amount of closes shape in order to try to snap to it horizontally or vertically. The more amount of shapes, the more distant ones is it compared to and the slower dragging gets. Use 0 to turn the attaching feature off.';
order: 71;
default: self dragAttachmentComparisonsAmountDefault.
(aBuilder setting: #dragAttachmentMargin)
default: self dragSnapComparisonsAmountDefault.
(aBuilder setting: #dragSnapMargin)
parent: #openponk;
target: self;
label: 'Margin for dragging attachments';
label: 'Margin for srag snapping';
description:
'When dragging a shape, it attaches to a horizontally or vertically aligned shapes within this margin, ie. in case of horizontal attachment, how much below of above the shapes can be to still attach.';
'When dragging a shape, it snaps to a horizontally or vertically aligned shapes within this margin, ie. in case of horizontal snapping, how much below of above the shapes can be to still snap to it.';
order: 72;
default: self dragAttachmentMarginDefault
default: self dragSnapMarginDefault
]

{ #category : #accessing }
OPRSControlConfiguration >> dragAttachmentComparisonsAmount [
OPRSControlConfiguration >> dragSnapComparisonsAmount [

^ dragAttachmentComparisonsAmount ifNil: [ self class dragAttachmentComparisonsAmount ]
^ dragSnapComparisonsAmount ifNil: [ self class dragSnapComparisonsAmount ]
]

{ #category : #accessing }
OPRSControlConfiguration >> dragAttachmentComparisonsAmount: anObject [
OPRSControlConfiguration >> dragSnapComparisonsAmount: anObject [

dragAttachmentComparisonsAmount := anObject
dragSnapComparisonsAmount := anObject
]

{ #category : #accessing }
OPRSControlConfiguration >> dragAttachmentMargin [
OPRSControlConfiguration >> dragSnapMargin [

^ dragAttachmentMargin ifNil: [ self class dragAttachmentMargin ]
^ dragSnapMargin ifNil: [ self class dragSnapMargin ]
]

{ #category : #accessing }
OPRSControlConfiguration >> dragAttachmentMargin: anObject [
OPRSControlConfiguration >> dragSnapMargin: anObject [

dragAttachmentMargin := anObject
dragSnapMargin := anObject
]

{ #category : #accessing }
Expand Down
16 changes: 8 additions & 8 deletions repository/OpenPonk-Roassal3/OPRSSelectionDraggable.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,21 @@ OPRSSelectionDraggable >> dragNoInnerShapes [
{ #category : #events }
OPRSSelectionDraggable >> dragStepForEvent: evt [

| dragAttachmentShapeAmount originalDragStep dragStep primaryShapeRectangle primaryShapePosition closestShapes horizontalLineGroups verticalLineGroups attachmentMargin lineGroupsComparisonBlock configuration |
| dragSnapShapeAmount originalDragStep dragStep primaryShapeRectangle primaryShapePosition closestShapes horizontalLineGroups verticalLineGroups snapMargin lineGroupsComparisonBlock configuration |
configuration := evt canvas
propertyAt: RSCanvasController
ifPresent: #configuration
ifAbsent: [ OPRSControlConfiguration new ].
dragAttachmentShapeAmount := evt altKeyPressed
dragSnapShapeAmount := evt altKeyPressed
ifTrue: [ 0 ]
ifFalse: [
configuration
dragAttachmentComparisonsAmount ].
attachmentMargin := configuration dragAttachmentMargin.
dragSnapComparisonsAmount ].
snapMargin := configuration dragSnapMargin.
originalDragStep := (evt camera distanceFromPixelToSpace: evt step)
+ unusedStep.
unusedStep := 0 @ 0.
dragAttachmentShapeAmount isZero ifTrue: [ ^ originalDragStep ].
dragSnapShapeAmount isZero ifTrue: [ ^ originalDragStep ].
primaryShapeRectangle := evt shape encompassingRectangle
translateBy: originalDragStep.
primaryShapePosition := primaryShapeRectangle center.
Expand All @@ -109,7 +109,7 @@ OPRSSelectionDraggable >> dragStepForEvent: evt [
each isSelectionDraggable and: [ (draggedNodes includes: each) not ] ]
thenDo: [ :each |
closestShapes add: each.
closestShapes size > dragAttachmentShapeAmount ifTrue: [
closestShapes size > dragSnapShapeAmount ifTrue: [
closestShapes removeLast ] ].
horizontalLineGroups := SortedCollection sortBlock: [ :a :b |
a isNotEmpty and: [
Expand All @@ -120,10 +120,10 @@ OPRSSelectionDraggable >> dragStepForEvent: evt [
closestShapes do: [ :each |
horizontalLineGroups add: (primaryShapeRectangle
horizontalAlignmentLinesTo: each encompassingRectangle
margin: attachmentMargin).
margin: snapMargin).
verticalLineGroups add: (primaryShapeRectangle
verticalAlignmentLinesTo: each encompassingRectangle
margin: attachmentMargin) ].
margin: snapMargin) ].
dragStep := originalDragStep.
lineGroupsComparisonBlock := [ :groups |
groups select: [ :each |
Expand Down

0 comments on commit f944ba1

Please sign in to comment.