-
Notifications
You must be signed in to change notification settings - Fork 105
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
Customize Node size #19
Comments
@acrisci this is just the starting size... you can set it on shape with |
Thanks. I just tried this approach but it only resizes the outermost element (the diff --git a/src/demo/app/renderer.ts b/src/demo/app/renderer.ts
index 0d38c3d..66cc6e4 100644
--- a/src/demo/app/renderer.ts
+++ b/src/demo/app/renderer.ts
@@ -58,7 +58,9 @@ export class Renderer implements Flo.Renderer {
}
createNode(metadata : Flo.ElementMetadata, props : Map<string, any>): dia.Element {
- return new joint.shapes.flo.Node();
+ let node = new joint.shapes.flo.Node();
+ node.set('size', {width:300, height:80});
+ return node;
}
initializeNewNode(node : dia.Element, viewerDescriptor : Flo.ViewerDescriptor) { |
@acrisci you're probably right (i haven't tried it yet, I'll try it out a bit later), I see that example shape consists of a number of SVG elements where offsets are are all in terms of fixed size. However, you can create your own shape using JointJS and set all those offsets for ports labels etc relative to parent shape dimensions. See this: https://resources.jointjs.com/docs/jointjs/v2.0/joint.html#dia.attributes.ref |
Ok, that's definitely an option. Do you see any path to framework support for this feature? |
Support |
Do you think it would be possible to move the default width/height for new node creation to the Another option might be to add the width/height as a parameter to the constructor. I'm also going to modify the label. It might be good to add something like this to the demo: diff --git a/src/demo/app/renderer.ts b/src/demo/app/renderer.ts
index 0d38c3d..dea484b 100644
--- a/src/demo/app/renderer.ts
+++ b/src/demo/app/renderer.ts
@@ -64,7 +64,9 @@ export class Renderer implements Flo.Renderer {
initializeNewNode(node : dia.Element, viewerDescriptor : Flo.ViewerDescriptor) {
let metadata : Flo.ElementMetadata = node.attr('metadata');
if (metadata) {
- node.attr('.label/text', node.attr('metadata/name'));
+ let name = node.attr('metadata/name');
+ name = joint.util.breakText(name, {width:120}, node.attr('.label'));
+ node.attr('.label/text', name);
let group = node.attr('metadata/group');
if (group === 'source') {
node.attr('.input-port/display','none'); |
@acrisci you mean |
Some of the names of my nodes are kind of long and they don't fit in the boxes properly. They overflow the edges which doesn't look good.
Node size is currently hardcoded in
shared/shapes.ts
asIMAGE_H
andIMAGE_W
. I would like to configure this to be something slightly larger to accommodate my longest name.In the future, I would like to make the nodes size themselves dynamically based on the width of the label.
The text was updated successfully, but these errors were encountered: