Drop the vtk.js ambient shims and treat a parallel crop plane as a miss - #928
Draft
PaulHax wants to merge 2 commits into
Draft
Drop the vtk.js ambient shims and treat a parallel crop plane as a miss#928PaulHax wants to merge 2 commits into
PaulHax wants to merge 2 commits into
Conversation
src/shims-vtk.d.ts existed because vtk.js shipped no declarations for these entry points. Upstream now declares all of them, so the file is removed entirely and the code uses the real types. Some of the shim was also stale and was quietly hiding drift: - vtkWidgetManager declared updateSelectionFromXY, updateSelectionFromMouseEvent and useSvgLayer, none of which still exist upstream - the reslice cursor state claimed setColor3/setScale1/setOpacity on the root state, but those live on the individual handle states; the casts in ResliceCursorTool now name the mixin state types they really are - a non-generic addWidget signature masked that our own vtkPaintWidget and vtkCrosshairsWidget declarations extended the factory's value type rather than its interface Preset metadata specific to VolView (OpacityPoints, AbsoluteRange, EffectiveRange) moves to a local ColorMapPreset type extending vtk.js's IColorMapPreset, instead of a shim redeclaring the whole module.
intersectMouseEventWithPlane returned whatever vtkPlane.intersectWithLine put in its `x` field, which is an empty array when the line is parallel to the plane and no intersection was computed. An empty array is truthy, so the caller's `if (!coord)` guard never fired and the coordinates read back as undefined, which propagated as NaN into the crop bounds. Return null for that case, matching how the function already reports its other failures, so the existing guard covers it.
❌ Deploy Preview for volview-dev failed.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deletes
src/shims-vtk.d.tsnow that vtk.js declares the modules it stubbed, and fixesintersectMouseEventWithPlanereturning a truthy empty array on a parallel plane, which read back as NaN crop bounds — draft because it needs the vtk.js declaration sync released first.