Open TomasPetrauskas opened 2 years ago
Example code being run:
Debugging the tool.js code:
Attaching some screenshots for more reference.
I think this would let you do what you want without making public api changes (below)?
public async startDefaultTool(): Promise
@TomasPetrauskas Agree? Not sure whether there is a prettier way to deal with defaultToolArgs allowing undefined...
Yes we can try this solution.
@TomasPetrauskas was @bbastings 's suggestion helpful? Can we close this issue?
I was actually suggesting that Tomas could create a PR to make this change if it was sufficient for their needs...I don't think what is there now for default args is very useful.
Describe the bug By passing an array of default tool arguments to IModelApp.toolAdmin.defaultToolArgs the arguments do not get parsed correctly. In the async run function line 821 of the tool.js file, the array does not get spread with the spread operator and instead becomes an array of an array. You will receive an error that the tool's viewport is not setup correctly as the viewport is at that point set as an array with the arguments.
To Reproduce Steps to reproduce the behaviour:
Expected behavior The arguments should be parsed separately not enclosed into another array.
Desktop (please complete the applicable information):
Additional context This should be an easy fix as the variables being passed in the function should not contain the spread operator (...args) as this is what breaks it. This issue can simply be recreated by running this piece of code:
If this code is run:
We receive the expected behaviour.