Skip to content
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

SVGLandmarkRepresentation are shared amongst every instance #1751

Closed
agirault opened this issue Feb 24, 2021 · 6 comments
Closed

SVGLandmarkRepresentation are shared amongst every instance #1751

agirault opened this issue Feb 24, 2021 · 6 comments
Assignees
Labels
released Automated label

Comments

@agirault
Copy link
Contributor

When using LineWidget, all the text svg representations use the same position.

https://github.com/Kitware/vtk-js/blob/master/Sources/Widgets/SVG/SVGLandmarkRepresentation/index.js#L84

Might occur on other SVG representations.

@jourdain
Copy link
Collaborator

Indeed that is the issue

@jourdain
Copy link
Collaborator

Objects share their references... You need a function to create object or put them into the model at the execution of vtkSVGLandmarkRepresentation() function.

@finetjul
Copy link
Member

Objects share their references... You need a function to create object or put them into the model at the execution of vtkSVGLandmarkRepresentation() function.

It seems that it is a recurring error. How about changing DEFAULT_VALUES into a function ? e.g.

const defaultValues = () => {...};
...
Object.assign(model, defaultValues(), initialValues);

@jourdain
Copy link
Collaborator

I wanted to do that but I was worried to do the refactor work everywhere. But this could be done on case by case...

@jourdain
Copy link
Collaborator

jourdain commented Feb 24, 2021

at that point you can also just define it as (no need to create a lambda)

function defaultValues(initialValues) {
   return {
       a, b, c, 
       ...initialValues,
   };
}

@github-actions
Copy link

github-actions bot commented Mar 3, 2021

🎉 This issue has been resolved in version 16.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Automated label
Projects
None yet
Development

No branches or pull requests

4 participants