xeokit-sdk icon indicating copy to clipboard operation
xeokit-sdk copied to clipboard

Incorrect types for `.colorize`, `.opacity` and their batch functions

Open NiklasPor opened this issue 2 months ago • 0 comments

Is this bug fix critical for your commercial enterprise? No

Version "@xeokit/xeokit-sdk": "^2.6.91",

Describe the bug I couldn't figure out how to reset the colorize and opacity values back to their initial values Turns out you can set the values to undefined to reset them to their initial values. The TS types only show that setting them to number[] is possible and the comments don't say anything about resetting them.

Suggested fix Document the behavior on the colorize and opacity properties or provide reset methods for the properties. Same for the batch functions setObjectsColorized and setObjectsOpacity.

Workaround for now Just cast the parameters as any.

    // Reset opacity and colorize values
    viewer.scene.setObjectsColorized(resetIds, undefined as any);
    viewer.scene.setObjectsOpacity(resetIds, undefined as any);

NiklasPor avatar Oct 21 '25 16:10 NiklasPor