-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flowchart Orientation #2251
base: main
Are you sure you want to change the base?
Flowchart Orientation #2251
Changes from all commits
8abae8d
2cfb895
dc8aae6
abcb7d5
df900b1
e74e3fe
e55e8c2
1b44896
5955b99
e0b7677
c1bff65
20114ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,15 +70,22 @@ export const drawLayers = function () { | |
* Render layer name labels | ||
*/ | ||
export const drawLayerNames = function () { | ||
const { | ||
chartSize: { sidebarWidth = 0 }, | ||
layers, | ||
} = this.props; | ||
const { chartSize, layers, orientation } = this.props; | ||
|
||
const layerNamePosition = | ||
orientation === 'vertical' ? chartSize.sidebarWidth || 0 : 100 || 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will it be possible to add some comments on these calculations for future ref ? Thank you |
||
|
||
const transformValue = | ||
orientation === 'vertical' | ||
? // In vertical mode, layer names are positioned along the X-axis at sidebarWidth | ||
`translateX(${layerNamePosition}px)` | ||
: // In horizontal mode, layer names are positioned at a fixed Y = 100px | ||
`translateY(${layerNamePosition}px)`; | ||
|
||
this.el.layerNameGroup | ||
.transition('layer-names-sidebar-width') | ||
.duration(this.DURATION) | ||
.style('transform', `translateX(${sidebarWidth}px)`); | ||
.style('transform', transformValue); | ||
|
||
this.el.layerNames = this.el.layerNameGroup | ||
.selectAll('.pipeline-layer-name') | ||
|
@@ -126,12 +133,20 @@ const updateNodeRects = (nodeRects) => | |
return node.height / 2; | ||
}); | ||
|
||
const updateParameterRect = (nodeRects) => | ||
const updateParameterRect = (nodeRects, orientation) => | ||
nodeRects | ||
.attr('width', 12) | ||
.attr('height', 12) | ||
.attr('x', (node) => (node.width + 20) / -2) | ||
.attr('y', -6); | ||
.attr('x', (node) => | ||
// Position parameter icon on the left side of the node in vertical mode | ||
// Position it slightly inside the node in horizontal mode | ||
orientation === 'vertical' | ||
? (node.width + 20) / -2 | ||
: -(node.width / 2) + 10 | ||
) | ||
// Center parameter icon vertically on the left side of the node (12px parameter icon height, so -6 for centering) | ||
// Place parameter icon on top of the node (12px parameter icon height) | ||
.attr('y', (node) => (orientation === 'vertical' ? -6 : -node.height + 12)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will it be possible to add some comments on these calculations for future ref ? Thank you |
||
|
||
/** | ||
* Render node icons and name labels | ||
|
@@ -150,6 +165,7 @@ export const drawNodes = function (changed) { | |
focusMode, | ||
hoveredFocusMode, | ||
isSlicingPipelineApplied, | ||
orientation, | ||
} = this.props; | ||
const { | ||
from: slicedPipelineFromId, | ||
|
@@ -223,7 +239,7 @@ export const drawNodes = function (changed) { | |
.append('rect') | ||
.attr('class', 'pipeline-node__parameter-indicator') | ||
.on('mouseover', this.handleParamsIndicatorMouseOver) | ||
.call(updateParameterRect); | ||
.call(updateParameterRect, orientation); | ||
|
||
// Performance: use a single path per icon | ||
enterNodes | ||
|
@@ -344,7 +360,7 @@ export const drawNodes = function (changed) { | |
) | ||
.transition('node-rect') | ||
.duration((node) => (node.showText ? 200 : 600)) | ||
.call(updateParameterRect); | ||
.call(updateParameterRect, orientation); | ||
|
||
// Performance: icon transitions with CSS on GPU | ||
allNodes | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be opposite ? Like when vertical we show LeftRightIcon to change, similar to expand/collapse pipelines ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a very good point. i am not sure; once @stephkaiser is back; let's ask her.