@jbrowse/render-core 4.3.0 → 5.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/RenderCanvas.d.ts +2 -2
- package/esm/RenderLifecycleMixin.d.ts +52 -20
- package/esm/RenderLifecycleMixin.js +89 -23
- package/esm/canvas2dUtils.d.ts +90 -23
- package/esm/canvas2dUtils.js +119 -36
- package/esm/colorRampLut.d.ts +5 -5
- package/esm/colorRampLut.js +6 -6
- package/esm/computePipeline.d.ts +14 -0
- package/esm/computePipeline.js +62 -0
- package/esm/contractReports.d.ts +54 -0
- package/esm/contractReports.js +112 -0
- package/esm/coverageBand.d.ts +13 -8
- package/esm/coverageBand.js +15 -5
- package/esm/coverageBandBuffers.d.ts +2 -9
- package/esm/coverageBandBuffers.js +1 -13
- package/esm/createRenderingBackend.d.ts +14 -18
- package/esm/createRenderingBackend.js +4 -2
- package/esm/displayPhase.d.ts +83 -104
- package/esm/displayPhase.js +42 -82
- package/esm/encodeMemo.d.ts +14 -0
- package/esm/encodeMemo.js +48 -0
- package/esm/gpuContextLostError.d.ts +30 -0
- package/esm/gpuContextLostError.js +40 -0
- package/esm/gpuDevice.d.ts +29 -10
- package/esm/gpuDevice.js +35 -16
- package/esm/graphicsCapabilities.d.ts +27 -19
- package/esm/graphicsCapabilities.js +40 -18
- package/esm/hal/createHal.d.ts +4 -5
- package/esm/hal/createHal.js +14 -4
- package/esm/hal/deviceGpuCache.d.ts +25 -30
- package/esm/hal/deviceGpuCache.js +88 -97
- package/esm/hal/gpuHalBase.d.ts +5 -4
- package/esm/hal/gpuHalBase.js +25 -14
- package/esm/hal/index.d.ts +2 -2
- package/esm/hal/index.js +1 -1
- package/esm/hal/mockHal.d.ts +15 -10
- package/esm/hal/mockHal.js +31 -18
- package/esm/hal/oomReporter.d.ts +7 -0
- package/esm/hal/oomReporter.js +10 -0
- package/esm/hal/passIds.d.ts +8 -7
- package/esm/hal/passIds.js +11 -10
- package/esm/hal/regionRegistry.d.ts +0 -1
- package/esm/hal/regionRegistry.js +3 -15
- package/esm/hal/types.d.ts +55 -18
- package/esm/hal/webgl2Hal.d.ts +23 -6
- package/esm/hal/webgl2Hal.js +161 -155
- package/esm/hal/webgpuHal.d.ts +29 -13
- package/esm/hal/webgpuHal.js +221 -153
- package/esm/installUpload.d.ts +16 -3
- package/esm/installUpload.js +13 -41
- package/esm/instanceCache.d.ts +10 -7
- package/esm/instanceCache.js +14 -15
- package/esm/instancePass.d.ts +2 -1
- package/esm/mapUploadSync.d.ts +2 -10
- package/esm/mapUploadSync.js +2 -3
- package/esm/marks/barMark.d.ts +30 -0
- package/esm/marks/barMark.js +149 -0
- package/esm/marks/colorFill.d.ts +17 -0
- package/esm/marks/colorFill.js +26 -0
- package/esm/marks/drawAgainstHit.d.ts +113 -0
- package/esm/marks/drawAgainstHit.js +407 -0
- package/esm/marks/ellipseDistance.d.ts +10 -0
- package/esm/marks/ellipseDistance.js +136 -0
- package/esm/marks/glyphPaint.d.ts +36 -0
- package/esm/marks/glyphPaint.js +77 -0
- package/esm/marks/index.d.ts +33 -0
- package/esm/marks/index.js +20 -0
- package/esm/marks/lineMark.d.ts +37 -0
- package/esm/marks/lineMark.js +416 -0
- package/esm/marks/linkMark.d.ts +76 -0
- package/esm/marks/linkMark.js +585 -0
- package/esm/marks/markBackend.d.ts +118 -0
- package/esm/marks/markBackend.js +196 -0
- package/esm/marks/markHit.d.ts +32 -0
- package/esm/marks/markHit.js +61 -0
- package/esm/marks/markInk.d.ts +18 -0
- package/esm/marks/markInk.js +71 -0
- package/esm/marks/markPaint.d.ts +14 -0
- package/esm/marks/markPaint.js +32 -0
- package/esm/marks/markPlan.d.ts +25 -0
- package/esm/marks/markPlan.js +20 -0
- package/esm/marks/markRamp.d.ts +72 -0
- package/esm/marks/markRamp.js +197 -0
- package/esm/marks/nearestMarkHit.d.ts +55 -0
- package/esm/marks/nearestMarkHit.js +158 -0
- package/esm/marks/pathRecorder.d.ts +14 -0
- package/esm/marks/pathRecorder.js +80 -0
- package/esm/marks/pointMark.d.ts +42 -0
- package/esm/marks/pointMark.js +125 -0
- package/esm/marks/rowLane.d.ts +39 -0
- package/esm/marks/rowLane.js +41 -0
- package/esm/marks/rowSpanIndex.d.ts +29 -0
- package/esm/marks/rowSpanIndex.js +141 -0
- package/esm/marks/rowTable.d.ts +41 -0
- package/esm/marks/rowTable.js +75 -0
- package/esm/marks/ruleMark.d.ts +21 -0
- package/esm/marks/ruleMark.js +91 -0
- package/esm/marks/spanMark.d.ts +42 -0
- package/esm/marks/spanMark.js +81 -0
- package/esm/marks/types.d.ts +261 -0
- package/esm/marks/types.js +175 -0
- package/esm/marks/valueScale.d.ts +23 -0
- package/esm/marks/valueScale.js +11 -0
- package/esm/namedReactions.d.ts +3 -4
- package/esm/namedReactions.js +3 -4
- package/esm/perRegionRenderingBackend.d.ts +21 -3
- package/esm/perRegionRenderingBackend.js +37 -3
- package/esm/regionDataMap.d.ts +2 -2
- package/esm/regionDataMap.js +25 -23
- package/esm/renderBlock.d.ts +14 -0
- package/esm/renderBlock.js +25 -0
- package/esm/renderingBackendBase.d.ts +20 -14
- package/esm/renderingBackendBase.js +12 -7
- package/esm/scoreScale.d.ts +27 -0
- package/esm/scoreScale.js +88 -0
- package/esm/shaders/barMark.generated.d.ts +3 -0
- package/esm/shaders/barMark.generated.js +7 -0
- package/esm/shaders/barMark.glsl.generated.d.ts +2 -0
- package/esm/shaders/barMark.glsl.generated.js +4 -0
- package/esm/shaders/barMark.iface.generated.d.ts +90 -0
- package/esm/shaders/barMark.iface.generated.js +205 -0
- package/esm/shaders/barMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/barMark.wgsl.generated.js +3 -0
- package/esm/shaders/capsule.js.generated.d.ts +1 -0
- package/esm/shaders/capsule.js.generated.js +11 -0
- package/esm/shaders/clipStrip.generated.d.ts +2 -0
- package/esm/shaders/clipStrip.generated.js +4 -0
- package/esm/shaders/clipStrip.js.generated.d.ts +1 -0
- package/esm/shaders/clipStrip.js.generated.js +21 -0
- package/esm/shaders/colorRampLut.js.generated.d.ts +1 -0
- package/esm/shaders/colorRampLut.js.generated.js +17 -0
- package/esm/shaders/coverageBar.generated.d.ts +2 -3
- package/esm/shaders/coverageBar.generated.js +4 -3
- package/esm/shaders/coverageBar.glsl.generated.d.ts +2 -0
- package/esm/shaders/coverageBar.glsl.generated.js +4 -0
- package/esm/shaders/coverageBar.iface.generated.js +1 -1
- package/esm/shaders/coverageBar.wgsl.generated.d.ts +1 -0
- package/esm/shaders/coverageBar.wgsl.generated.js +3 -0
- package/esm/shaders/coverageClip.generated.d.ts +3 -0
- package/esm/shaders/coverageClip.generated.js +7 -0
- package/esm/shaders/coverageClip.glsl.generated.d.ts +2 -0
- package/esm/shaders/coverageClip.glsl.generated.js +4 -0
- package/esm/shaders/coverageClip.iface.generated.d.ts +85 -0
- package/esm/shaders/coverageClip.iface.generated.js +114 -0
- package/esm/shaders/coverageClip.wgsl.generated.d.ts +1 -0
- package/esm/shaders/coverageClip.wgsl.generated.js +3 -0
- package/esm/shaders/coverageIndicator.generated.d.ts +2 -3
- package/esm/shaders/coverageIndicator.generated.js +4 -3
- package/esm/shaders/coverageIndicator.glsl.generated.d.ts +2 -0
- package/esm/shaders/coverageIndicator.glsl.generated.js +4 -0
- package/esm/shaders/coverageIndicator.iface.generated.js +1 -1
- package/esm/shaders/coverageIndicator.wgsl.generated.d.ts +1 -0
- package/esm/shaders/coverageIndicator.wgsl.generated.js +3 -0
- package/esm/shaders/coverageInterbase.generated.d.ts +2 -3
- package/esm/shaders/coverageInterbase.generated.js +4 -3
- package/esm/shaders/coverageInterbase.glsl.generated.d.ts +2 -0
- package/esm/shaders/coverageInterbase.glsl.generated.js +4 -0
- package/esm/shaders/coverageInterbase.iface.generated.js +1 -1
- package/esm/shaders/coverageInterbase.wgsl.generated.d.ts +1 -0
- package/esm/shaders/coverageInterbase.wgsl.generated.js +3 -0
- package/esm/shaders/coverageMod.generated.d.ts +2 -3
- package/esm/shaders/coverageMod.generated.js +4 -3
- package/esm/shaders/coverageMod.glsl.generated.d.ts +2 -0
- package/esm/shaders/coverageMod.glsl.generated.js +4 -0
- package/esm/shaders/coverageMod.iface.generated.js +1 -1
- package/esm/shaders/coverageMod.wgsl.generated.d.ts +1 -0
- package/esm/shaders/coverageMod.wgsl.generated.js +3 -0
- package/esm/shaders/coverageSnp.generated.d.ts +2 -3
- package/esm/shaders/coverageSnp.generated.js +4 -3
- package/esm/shaders/coverageSnp.glsl.generated.d.ts +2 -0
- package/esm/shaders/coverageSnp.glsl.generated.js +4 -0
- package/esm/shaders/coverageSnp.iface.generated.js +1 -1
- package/esm/shaders/coverageSnp.wgsl.generated.d.ts +1 -0
- package/esm/shaders/coverageSnp.wgsl.generated.js +3 -0
- package/esm/shaders/curveDistance.js.generated.d.ts +5 -0
- package/esm/shaders/curveDistance.js.generated.js +87 -0
- package/esm/shaders/hpmath.js.generated.d.ts +2 -1
- package/esm/shaders/hpmath.js.generated.js +5 -2
- package/esm/shaders/lineCenterMark.generated.d.ts +3 -0
- package/esm/shaders/lineCenterMark.generated.js +7 -0
- package/esm/shaders/lineCenterMark.glsl.generated.d.ts +2 -0
- package/esm/shaders/lineCenterMark.glsl.generated.js +4 -0
- package/esm/shaders/lineCenterMark.iface.generated.d.ts +104 -0
- package/esm/shaders/lineCenterMark.iface.generated.js +237 -0
- package/esm/shaders/lineCenterMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/lineCenterMark.wgsl.generated.js +3 -0
- package/esm/shaders/lineCommon.generated.d.ts +2 -0
- package/esm/shaders/lineCommon.generated.js +4 -0
- package/esm/shaders/lineStepMark.generated.d.ts +3 -0
- package/esm/shaders/lineStepMark.generated.js +7 -0
- package/esm/shaders/lineStepMark.glsl.generated.d.ts +2 -0
- package/esm/shaders/lineStepMark.glsl.generated.js +4 -0
- package/esm/shaders/lineStepMark.iface.generated.d.ts +98 -0
- package/esm/shaders/lineStepMark.iface.generated.js +225 -0
- package/esm/shaders/lineStepMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/lineStepMark.wgsl.generated.js +3 -0
- package/esm/shaders/linkMark.consts.generated.d.ts +14 -0
- package/esm/shaders/linkMark.consts.generated.js +16 -0
- package/esm/shaders/linkMark.generated.d.ts +4 -0
- package/esm/shaders/linkMark.generated.js +8 -0
- package/esm/shaders/linkMark.glsl.generated.d.ts +2 -0
- package/esm/shaders/linkMark.glsl.generated.js +4 -0
- package/esm/shaders/linkMark.iface.generated.d.ts +142 -0
- package/esm/shaders/linkMark.iface.generated.js +1829 -0
- package/esm/shaders/linkMark.js.generated.d.ts +7 -0
- package/esm/shaders/linkMark.js.generated.js +159 -0
- package/esm/shaders/linkMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/linkMark.wgsl.generated.js +3 -0
- package/esm/shaders/markColor.generated.d.ts +9 -0
- package/esm/shaders/markColor.generated.js +11 -0
- package/esm/shaders/pointGlyph.js.generated.d.ts +2 -0
- package/esm/shaders/pointGlyph.js.generated.js +15 -0
- package/esm/shaders/pointMark.consts.generated.d.ts +7 -0
- package/esm/shaders/pointMark.consts.generated.js +9 -0
- package/esm/shaders/pointMark.generated.d.ts +4 -0
- package/esm/shaders/pointMark.generated.js +8 -0
- package/esm/shaders/pointMark.glsl.generated.d.ts +2 -0
- package/esm/shaders/pointMark.glsl.generated.js +4 -0
- package/esm/shaders/pointMark.iface.generated.d.ts +98 -0
- package/esm/shaders/pointMark.iface.generated.js +219 -0
- package/esm/shaders/pointMark.js.generated.d.ts +3 -0
- package/esm/shaders/pointMark.js.generated.js +93 -0
- package/esm/shaders/pointMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/pointMark.wgsl.generated.js +3 -0
- package/esm/shaders/rowRect.generated.d.ts +0 -1
- package/esm/shaders/rowRect.generated.js +0 -1
- package/esm/shaders/rowTable.generated.d.ts +1 -0
- package/esm/shaders/rowTable.generated.js +3 -0
- package/esm/shaders/rowTable.js.generated.d.ts +5 -0
- package/esm/shaders/rowTable.js.generated.js +29 -0
- package/esm/shaders/scoreScale.generated.d.ts +2 -0
- package/esm/shaders/scoreScale.generated.js +4 -0
- package/esm/shaders/scoreScale.js.generated.d.ts +1 -0
- package/esm/shaders/scoreScale.js.generated.js +50 -23
- package/esm/shaders/spanMark.generated.d.ts +3 -0
- package/esm/shaders/spanMark.generated.js +7 -0
- package/esm/shaders/spanMark.glsl.generated.d.ts +2 -0
- package/esm/shaders/spanMark.glsl.generated.js +4 -0
- package/esm/shaders/spanMark.iface.generated.d.ts +81 -0
- package/esm/shaders/spanMark.iface.generated.js +215 -0
- package/esm/shaders/spanMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/spanMark.wgsl.generated.js +3 -0
- package/esm/sharedBackendKey.d.ts +18 -0
- package/esm/{keyedRenderingBackend.js → sharedBackendKey.js} +5 -0
- package/esm/slangPass.d.ts +18 -11
- package/esm/slangPass.js +12 -4
- package/esm/useGraphicsCapabilities.d.ts +1 -1
- package/esm/useGraphicsCapabilities.js +1 -1
- package/esm/useRenderingBackend.d.ts +13 -13
- package/esm/useRenderingBackend.js +58 -20
- package/esm/webgpuUtils.d.ts +3 -11
- package/esm/webgpuUtils.js +12 -33
- package/package.json +32 -7
- package/src/shaders/antialias.slang +46 -0
- package/src/shaders/arcHull.test.ts +267 -0
- package/src/shaders/barMark.generated.ts +11 -0
- package/src/shaders/barMark.glsl.generated.ts +6 -0
- package/src/shaders/barMark.iface.generated.ts +285 -0
- package/src/shaders/barMark.slang +167 -0
- package/src/shaders/barMark.wgsl.generated.ts +4 -0
- package/src/shaders/capsule.js.generated.ts +14 -0
- package/src/shaders/capsule.slang +12 -4
- package/src/shaders/clipStrip.generated.ts +6 -0
- package/src/shaders/clipStrip.js.generated.ts +22 -0
- package/src/shaders/clipStrip.slang +34 -0
- package/src/shaders/clipStrip.test.ts +39 -0
- package/src/shaders/colorPack.slang +5 -1
- package/src/shaders/colorRampLut.js.generated.ts +22 -0
- package/src/shaders/colorRampLut.slang +15 -1
- package/src/shaders/coverageBand.slang +64 -32
- package/src/shaders/coverageBar.generated.ts +6 -5
- package/src/shaders/coverageBar.glsl.generated.ts +6 -0
- package/src/shaders/coverageBar.iface.generated.ts +1 -1
- package/src/shaders/coverageBar.slang +10 -10
- package/src/shaders/coverageBar.wgsl.generated.ts +4 -0
- package/src/shaders/coverageClip.generated.ts +11 -0
- package/src/shaders/coverageClip.glsl.generated.ts +6 -0
- package/src/shaders/coverageClip.iface.generated.ts +172 -0
- package/src/shaders/coverageClip.slang +38 -0
- package/src/shaders/coverageClip.wgsl.generated.ts +4 -0
- package/src/shaders/coverageIndicator.generated.ts +6 -5
- package/src/shaders/coverageIndicator.glsl.generated.ts +6 -0
- package/src/shaders/coverageIndicator.iface.generated.ts +1 -1
- package/src/shaders/coverageIndicator.wgsl.generated.ts +4 -0
- package/src/shaders/coverageInterbase.generated.ts +6 -5
- package/src/shaders/coverageInterbase.glsl.generated.ts +6 -0
- package/src/shaders/coverageInterbase.iface.generated.ts +1 -1
- package/src/shaders/coverageInterbase.wgsl.generated.ts +4 -0
- package/src/shaders/coverageMod.generated.ts +6 -5
- package/src/shaders/coverageMod.glsl.generated.ts +6 -0
- package/src/shaders/coverageMod.iface.generated.ts +1 -1
- package/src/shaders/coverageMod.wgsl.generated.ts +4 -0
- package/src/shaders/coverageSnp.generated.ts +6 -5
- package/src/shaders/coverageSnp.glsl.generated.ts +6 -0
- package/src/shaders/coverageSnp.iface.generated.ts +1 -1
- package/src/shaders/coverageSnp.wgsl.generated.ts +4 -0
- package/src/shaders/curveDistance.js.generated.ts +91 -0
- package/src/shaders/curveDistance.slang +265 -0
- package/src/shaders/hpClampFloor.test.ts +87 -0
- package/src/shaders/hpmath.js.generated.ts +6 -2
- package/src/shaders/hpmath.slang +100 -48
- package/src/shaders/insetValueScale.test.ts +67 -0
- package/src/shaders/lineCenterMark.generated.ts +11 -0
- package/src/shaders/lineCenterMark.glsl.generated.ts +6 -0
- package/src/shaders/lineCenterMark.iface.generated.ts +328 -0
- package/src/shaders/lineCenterMark.slang +127 -0
- package/src/shaders/lineCenterMark.wgsl.generated.ts +4 -0
- package/src/shaders/lineCommon.generated.ts +6 -0
- package/src/shaders/lineCommon.slang +102 -0
- package/src/shaders/lineStepMark.generated.ts +11 -0
- package/src/shaders/lineStepMark.glsl.generated.ts +6 -0
- package/src/shaders/lineStepMark.iface.generated.ts +311 -0
- package/src/shaders/lineStepMark.slang +125 -0
- package/src/shaders/lineStepMark.wgsl.generated.ts +4 -0
- package/src/shaders/linkMark.consts.generated.ts +30 -0
- package/src/shaders/linkMark.generated.ts +12 -0
- package/src/shaders/linkMark.glsl.generated.ts +6 -0
- package/src/shaders/linkMark.iface.generated.ts +1954 -0
- package/src/shaders/linkMark.js.generated.ts +167 -0
- package/src/shaders/linkMark.slang +439 -0
- package/src/shaders/linkMark.wgsl.generated.ts +4 -0
- package/src/shaders/markColor.generated.ts +20 -0
- package/src/shaders/markColor.slang +128 -0
- package/src/shaders/pointGlyph.js.generated.ts +20 -0
- package/src/shaders/pointGlyph.slang +23 -7
- package/src/shaders/pointGlyphPad.test.ts +242 -0
- package/src/shaders/pointMark.consts.generated.ts +16 -0
- package/src/shaders/pointMark.generated.ts +12 -0
- package/src/shaders/pointMark.glsl.generated.ts +6 -0
- package/src/shaders/pointMark.iface.generated.ts +304 -0
- package/src/shaders/pointMark.js.generated.ts +99 -0
- package/src/shaders/pointMark.slang +227 -0
- package/src/shaders/pointMark.wgsl.generated.ts +4 -0
- package/src/shaders/rowRect.generated.ts +0 -2
- package/src/shaders/rowRect.slang +39 -58
- package/src/shaders/rowTable.generated.ts +4 -0
- package/src/shaders/rowTable.js.generated.ts +37 -0
- package/src/shaders/rowTable.slang +98 -0
- package/src/shaders/scoreScale.generated.ts +6 -0
- package/src/shaders/scoreScale.js.generated.ts +48 -23
- package/src/shaders/scoreScale.slang +49 -55
- package/src/shaders/sdEllipse.test.ts +211 -0
- package/src/shaders/spanMark.generated.ts +11 -0
- package/src/shaders/spanMark.glsl.generated.ts +6 -0
- package/src/shaders/spanMark.iface.generated.ts +289 -0
- package/src/shaders/spanMark.slang +77 -0
- package/src/shaders/spanMark.wgsl.generated.ts +4 -0
- package/src/shaders/valueScale.slang +26 -0
- package/src/shaders/wideCircleLeg.test.ts +85 -0
- package/esm/globalRenderingBackend.d.ts +0 -90
- package/esm/globalRenderingBackend.js +0 -53
- package/esm/keyedRenderingBackend.d.ts +0 -41
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { defineMark, withPassId } from './types.ts';
|
|
2
|
+
export { paintMarkBlocks } from './markPaint.ts';
|
|
3
|
+
export { planMarks } from './markPlan.ts';
|
|
4
|
+
export { inkOfInstances, shiftInk } from './markInk.ts';
|
|
5
|
+
export { backToFront, nearestMarkHit, valueWindow } from './nearestMarkHit.ts';
|
|
6
|
+
export { barMark } from './barMark.ts';
|
|
7
|
+
export { pointMark } from './pointMark.ts';
|
|
8
|
+
export { ruleMark } from './ruleMark.ts';
|
|
9
|
+
export { spanMark } from './spanMark.ts';
|
|
10
|
+
export { lineCenterMark, lineMarkOf, lineStepMark } from './lineMark.ts';
|
|
11
|
+
export { linkFeet, linkMark, LINK_ELSEWHERE, LINK_NO_REGION, } from './linkMark.ts';
|
|
12
|
+
export { ellipseDistance, ellipseNearest } from './ellipseDistance.ts';
|
|
13
|
+
export { appendGlyph, pointInsetPx } from './glyphPaint.ts';
|
|
14
|
+
export { recordPath } from './pathRecorder.ts';
|
|
15
|
+
export { abgrToCssRgba, makeAbgrFill } from './colorFill.ts';
|
|
16
|
+
export { RAMP_NOT_A_NUMBER_COLOR, RAMP_NO_VALUE_BITS, RAMP_NO_VALUE_COLOR, } from '../shaders/markColor.generated.ts';
|
|
17
|
+
export { instanceColor, isThreshold, keepRampValues, rampUniforms, rampValueBits, thresholdBandOf, } from './markRamp.ts';
|
|
18
|
+
export { HIDDEN_ROW, NO_ROW_COLOR, RowKeys, buildRowTable } from './rowTable.ts';
|
|
19
|
+
export { keySlot, rowColor, rowSlot } from './rowLane.ts';
|
|
20
|
+
export { rowSpanIndex, spansInRow } from './rowSpanIndex.ts';
|
|
21
|
+
export type { MarkPlan } from './markPlan.ts';
|
|
22
|
+
export type { MarkInstance } from './markInk.ts';
|
|
23
|
+
export type { HitWindow, NearestMarkHit } from './nearestMarkHit.ts';
|
|
24
|
+
export type { Mark, MarkBand, MarkContext2D, MarkFrame, MarkImage, MarkColorScale, MarkRamp, MarkTexels, MarkThreshold, MarkTexture, MarkValueScaleType, InkRect, MarkHit, MarkShape, PlannedPass, StagedUniforms, TextureBinder, } from './types.ts';
|
|
25
|
+
export type { BarChannels, BarParams } from './barMark.ts';
|
|
26
|
+
export type { PointChannels, PointParams } from './pointMark.ts';
|
|
27
|
+
export type { RuleChannels, RuleParams } from './ruleMark.ts';
|
|
28
|
+
export type { SpanChannels, SpanParams } from './spanMark.ts';
|
|
29
|
+
export type { LineChannels, LineInterpolate, LineParams } from './lineMark.ts';
|
|
30
|
+
export type { LinkChannels, LinkParams, LinkRegion, LinkSizeScale, } from './linkMark.ts';
|
|
31
|
+
export type { RowTable } from './rowTable.ts';
|
|
32
|
+
export type { RowSpanIndex } from './rowSpanIndex.ts';
|
|
33
|
+
export type { ColorChannel } from './markRamp.ts';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { defineMark, withPassId } from './types.js';
|
|
2
|
+
export { paintMarkBlocks } from './markPaint.js';
|
|
3
|
+
export { planMarks } from './markPlan.js';
|
|
4
|
+
export { inkOfInstances, shiftInk } from './markInk.js';
|
|
5
|
+
export { backToFront, nearestMarkHit, valueWindow } from './nearestMarkHit.js';
|
|
6
|
+
export { barMark } from './barMark.js';
|
|
7
|
+
export { pointMark } from './pointMark.js';
|
|
8
|
+
export { ruleMark } from './ruleMark.js';
|
|
9
|
+
export { spanMark } from './spanMark.js';
|
|
10
|
+
export { lineCenterMark, lineMarkOf, lineStepMark } from './lineMark.js';
|
|
11
|
+
export { linkFeet, linkMark, LINK_ELSEWHERE, LINK_NO_REGION, } from './linkMark.js';
|
|
12
|
+
export { ellipseDistance, ellipseNearest } from './ellipseDistance.js';
|
|
13
|
+
export { appendGlyph, pointInsetPx } from './glyphPaint.js';
|
|
14
|
+
export { recordPath } from './pathRecorder.js';
|
|
15
|
+
export { abgrToCssRgba, makeAbgrFill } from './colorFill.js';
|
|
16
|
+
export { RAMP_NOT_A_NUMBER_COLOR, RAMP_NO_VALUE_BITS, RAMP_NO_VALUE_COLOR, } from '../shaders/markColor.generated.js';
|
|
17
|
+
export { instanceColor, isThreshold, keepRampValues, rampUniforms, rampValueBits, thresholdBandOf, } from './markRamp.js';
|
|
18
|
+
export { HIDDEN_ROW, NO_ROW_COLOR, RowKeys, buildRowTable } from './rowTable.js';
|
|
19
|
+
export { keySlot, rowColor, rowSlot } from './rowLane.js';
|
|
20
|
+
export { rowSpanIndex, spansInRow } from './rowSpanIndex.js';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ColorChannel } from './markRamp.ts';
|
|
2
|
+
import type { RowChannel, RowParams } from './rowLane.ts';
|
|
3
|
+
import type { MarkColorScale, MarkShape } from './types.ts';
|
|
4
|
+
import type { MarkValueScale } from './valueScale.ts';
|
|
5
|
+
/**
|
|
6
|
+
* The `line` shape's channels: a stroke through consecutive instances of one
|
|
7
|
+
* row, in the order given, each instance a span from `x` to `x2` at `y` on the
|
|
8
|
+
* value scale. `gapBp` is the linear variant's break: a midpoint further than
|
|
9
|
+
* that from the previous one on its row starts a new run. It rides with the
|
|
10
|
+
* data, as the neighbour fields the packer derives from it do, so both
|
|
11
|
+
* backends break in the same place; absent, a row is one run.
|
|
12
|
+
*/
|
|
13
|
+
export interface LineChannels extends ColorChannel, RowChannel {
|
|
14
|
+
x: Uint32Array;
|
|
15
|
+
x2: Uint32Array;
|
|
16
|
+
y: Float32Array;
|
|
17
|
+
gapBp?: number;
|
|
18
|
+
count: number;
|
|
19
|
+
}
|
|
20
|
+
export interface LineParams extends RowParams, MarkValueScale {
|
|
21
|
+
/** The quantitative colour scale, for a line whose colour is a ramp or a threshold. */
|
|
22
|
+
colorScale?: MarkColorScale;
|
|
23
|
+
/** The value a step drops to across a gap. */
|
|
24
|
+
origin: number;
|
|
25
|
+
/** Stroke width in CSS px. */
|
|
26
|
+
lineWidth: number;
|
|
27
|
+
/** CSS px each row's value scale runs over; the row's own height when absent. */
|
|
28
|
+
rowBandPx?: number;
|
|
29
|
+
}
|
|
30
|
+
/** `step` holds each value across its span; `linear` joins the spans' midpoints. */
|
|
31
|
+
export type LineInterpolate = 'step' | 'linear';
|
|
32
|
+
/** The step variant: three square-capped quads an instance, flat filled. */
|
|
33
|
+
export declare const lineStepMark: MarkShape<LineChannels, LineParams>;
|
|
34
|
+
/** The linear variant: one round-capped capsule an instance, max blended. */
|
|
35
|
+
export declare const lineCenterMark: MarkShape<LineChannels, LineParams>;
|
|
36
|
+
/** The shape a line's `interpolate` draws with. */
|
|
37
|
+
export declare function lineMarkOf(interpolate: LineInterpolate): MarkShape<LineChannels, LineParams>;
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
import { bpRangeXTuple } from '../blockClipUtils.js';
|
|
2
|
+
import { CappedPath, getDpr, makeBpMapper } from '../canvas2dUtils.js';
|
|
3
|
+
import * as centerShader from '../shaders/lineCenterMark.generated.js';
|
|
4
|
+
import { GAP_Y, NO_PREV_X } from '../shaders/lineCommon.generated.js';
|
|
5
|
+
import * as stepShader from '../shaders/lineStepMark.generated.js';
|
|
6
|
+
import { valueToYPxScaled } from '../shaders/pointMark.js.generated.js';
|
|
7
|
+
import { rowBandTopPx } from '../shaders/rowTable.js.generated.js';
|
|
8
|
+
import { normalizeScoreUnclamped } from '../shaders/scoreScale.js.generated.js';
|
|
9
|
+
import { slangPass } from '../slangPass.js';
|
|
10
|
+
import { abgrToCssRgba } from './colorFill.js';
|
|
11
|
+
import { colorBits, isThreshold, paintColors, rampUniforms, } from './markRamp.js';
|
|
12
|
+
import { bandHeightPx, rowColor, rowLane, rowSlot, rowTableKeys, rowTableTextures, } from './rowLane.js';
|
|
13
|
+
import { valueScaleUniforms } from './valueScale.js';
|
|
14
|
+
const NO_GAP = Number.POSITIVE_INFINITY;
|
|
15
|
+
function sameRow(row, a, b) {
|
|
16
|
+
return row[a] === row[b];
|
|
17
|
+
}
|
|
18
|
+
// Whether instance `i` abuts the one before it on its row, so the step joins
|
|
19
|
+
// them at a shared corner.
|
|
20
|
+
function abutsBefore(c, row, i) {
|
|
21
|
+
return i > 0 && sameRow(row, i - 1, i) && c.x2[i - 1] === c.x[i];
|
|
22
|
+
}
|
|
23
|
+
// Whether the linear variant links instance `i` to the one before it: the same
|
|
24
|
+
// row, within `gapBp` midpoint to midpoint.
|
|
25
|
+
function linksBefore(c, row, i) {
|
|
26
|
+
if (i === 0 || !sameRow(row, i - 1, i)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
const gapBp = c.gapBp ?? NO_GAP;
|
|
30
|
+
return (c.x[i] + c.x2[i]) / 2 - (c.x[i - 1] + c.x2[i - 1]) / 2 <= gapBp;
|
|
31
|
+
}
|
|
32
|
+
function packStep(c) {
|
|
33
|
+
const { x, x2, y, count } = c;
|
|
34
|
+
const row = rowLane(c.row, count);
|
|
35
|
+
const prevY = new Float32Array(count);
|
|
36
|
+
const nextY = new Float32Array(count);
|
|
37
|
+
for (let i = 0; i < count; i++) {
|
|
38
|
+
prevY[i] = abutsBefore(c, row, i) ? y[i - 1] : GAP_Y;
|
|
39
|
+
// a joined next collapses the third quad onto the corner the next
|
|
40
|
+
// instance's first quad draws, so the seam is stroked once
|
|
41
|
+
nextY[i] = i < count - 1 && abutsBefore(c, row, i + 1) ? y[i] : GAP_Y;
|
|
42
|
+
}
|
|
43
|
+
return stepShader.packInstances({ x, x2, y, color: colorBits(c, count), row, prevY, nextY }, count);
|
|
44
|
+
}
|
|
45
|
+
function packCenter(c) {
|
|
46
|
+
const { x, x2, y, count } = c;
|
|
47
|
+
const row = rowLane(c.row, count);
|
|
48
|
+
const prevX = new Uint32Array(count);
|
|
49
|
+
const prevX2 = new Uint32Array(count);
|
|
50
|
+
const prevY = new Float32Array(count);
|
|
51
|
+
for (let i = 0; i < count; i++) {
|
|
52
|
+
const linked = linksBefore(c, row, i);
|
|
53
|
+
prevX[i] = linked ? x[i - 1] : NO_PREV_X;
|
|
54
|
+
prevX2[i] = linked ? x2[i - 1] : 0;
|
|
55
|
+
prevY[i] = linked ? y[i - 1] : 0;
|
|
56
|
+
}
|
|
57
|
+
return centerShader.packInstances({ x, x2, y, color: colorBits(c, count), row, prevX, prevX2, prevY }, count);
|
|
58
|
+
}
|
|
59
|
+
// The two modules share `lineCommon`'s uniform block, so either writer serves.
|
|
60
|
+
function writeLineUniforms(scratch, clip, block, frame, params) {
|
|
61
|
+
const rowHeight = bandHeightPx(params, frame.canvasHeight);
|
|
62
|
+
stepShader.writeUniforms(scratch, {
|
|
63
|
+
bpRangeX: bpRangeXTuple(clip, block.reversed),
|
|
64
|
+
canvasHeight: frame.canvasHeight,
|
|
65
|
+
domainMin: params.domain[0],
|
|
66
|
+
domainMax: params.domain[1],
|
|
67
|
+
...valueScaleUniforms(params),
|
|
68
|
+
...rampUniforms(params.colorScale),
|
|
69
|
+
rowHeight,
|
|
70
|
+
rowBandPx: params.rowBandPx ?? rowHeight,
|
|
71
|
+
rowOffsetPx: params.rowOffsetPx ?? 0,
|
|
72
|
+
origin: params.origin,
|
|
73
|
+
lineWidth: params.lineWidth,
|
|
74
|
+
zero: 0,
|
|
75
|
+
viewportWidth: clip.scissorW,
|
|
76
|
+
devicePixelRatio: getDpr(),
|
|
77
|
+
rowTableKeys: rowTableKeys(params),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function lineFrame(block, frame, params) {
|
|
81
|
+
const pitch = bandHeightPx(params, frame.canvasHeight);
|
|
82
|
+
const { valueScaleType, valueSymlogConstant } = valueScaleUniforms(params);
|
|
83
|
+
return {
|
|
84
|
+
bpToPx: makeBpMapper(block),
|
|
85
|
+
pitch,
|
|
86
|
+
band: params.rowBandPx ?? pitch,
|
|
87
|
+
rowOffsetPx: params.rowOffsetPx ?? 0,
|
|
88
|
+
domainMin: params.domain[0],
|
|
89
|
+
domainMax: params.domain[1],
|
|
90
|
+
scaleType: valueScaleType,
|
|
91
|
+
symlogConstant: valueSymlogConstant,
|
|
92
|
+
table: params.rowTable,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function valueYPx(g, value, slot) {
|
|
96
|
+
return (rowBandTopPx(g.rowOffsetPx, g.pitch, slot) +
|
|
97
|
+
valueToYPxScaled(value, g.domainMin, g.domainMax, g.band, g.scaleType, g.symlogConstant));
|
|
98
|
+
}
|
|
99
|
+
// A value's y in the band for the colour test, placed UNCLAMPED where
|
|
100
|
+
// `valueYPx` clamps it to draw: the cuts go through it, and so does the line a
|
|
101
|
+
// threshold colours along, as the shader's `lineColorYPx` does.
|
|
102
|
+
function colorYPx(g, value, slot) {
|
|
103
|
+
const norm = normalizeScoreUnclamped(value, g.domainMin, g.domainMax, g.scaleType, g.symlogConstant);
|
|
104
|
+
return rowBandTopPx(g.rowOffsetPx, g.pitch, slot) + (1 - norm) * g.band;
|
|
105
|
+
}
|
|
106
|
+
// One colour per instance: a change ends the stroke batch and reopens it from
|
|
107
|
+
// the pen, so a segment carries the colour of the instance it belongs to, as
|
|
108
|
+
// the shader's per-instance colour does.
|
|
109
|
+
class InstancePen {
|
|
110
|
+
ctx;
|
|
111
|
+
colorOf;
|
|
112
|
+
lastAbgr = -1;
|
|
113
|
+
x = 0;
|
|
114
|
+
y = 0;
|
|
115
|
+
inRun = false;
|
|
116
|
+
constructor(ctx, colorOf) {
|
|
117
|
+
this.ctx = ctx;
|
|
118
|
+
this.colorOf = colorOf;
|
|
119
|
+
ctx.beginPath();
|
|
120
|
+
}
|
|
121
|
+
instance(i) {
|
|
122
|
+
const abgr = this.colorOf(i);
|
|
123
|
+
if (abgr === this.lastAbgr) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
this.ctx.stroke();
|
|
127
|
+
this.ctx.beginPath();
|
|
128
|
+
if (this.inRun) {
|
|
129
|
+
this.ctx.moveTo(this.x, this.y);
|
|
130
|
+
}
|
|
131
|
+
this.ctx.strokeStyle = abgrToCssRgba(abgr);
|
|
132
|
+
this.lastAbgr = abgr;
|
|
133
|
+
}
|
|
134
|
+
moveTo(x, y) {
|
|
135
|
+
this.ctx.moveTo(x, y);
|
|
136
|
+
this.x = x;
|
|
137
|
+
this.y = y;
|
|
138
|
+
this.inRun = true;
|
|
139
|
+
}
|
|
140
|
+
lineTo(x, y) {
|
|
141
|
+
this.ctx.lineTo(x, y);
|
|
142
|
+
this.x = x;
|
|
143
|
+
this.y = y;
|
|
144
|
+
}
|
|
145
|
+
recolor() { }
|
|
146
|
+
endRun() {
|
|
147
|
+
this.inRun = false;
|
|
148
|
+
}
|
|
149
|
+
end() {
|
|
150
|
+
this.ctx.stroke();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// The part of the segment from y0 to y1, as a fraction of it, inside the band
|
|
154
|
+
// top < y <= bottom; undefined where it misses. A band owns its lower edge,
|
|
155
|
+
// so a line lying on a cut takes the colour above it, as the shader does.
|
|
156
|
+
function bandSpan(y0, y1, top, bottom) {
|
|
157
|
+
if (y0 === y1) {
|
|
158
|
+
return top < y0 && y0 <= bottom ? [0, 1] : undefined;
|
|
159
|
+
}
|
|
160
|
+
const tTop = (top - y0) / (y1 - y0);
|
|
161
|
+
const tBottom = (bottom - y0) / (y1 - y0);
|
|
162
|
+
const t0 = Math.max(0, Math.min(tTop, tBottom));
|
|
163
|
+
const t1 = Math.min(1, Math.max(tTop, tBottom));
|
|
164
|
+
return t0 < t1 || (t0 === t1 && y0 + (y1 - y0) * t0 !== top)
|
|
165
|
+
? [t0, t1]
|
|
166
|
+
: undefined;
|
|
167
|
+
}
|
|
168
|
+
// Keeps the part of each segment inside one threshold band, cut where it
|
|
169
|
+
// crosses the band's edges, so a line stroked once per band changes colour
|
|
170
|
+
// where the shader's fragments do. A point's colour y is where the band test
|
|
171
|
+
// reads it and its y where it draws, which part where the drawn y is clamped.
|
|
172
|
+
class BandPen {
|
|
173
|
+
ctx;
|
|
174
|
+
top;
|
|
175
|
+
bottom;
|
|
176
|
+
x = 0;
|
|
177
|
+
y = 0;
|
|
178
|
+
colorY = 0;
|
|
179
|
+
drawing = false;
|
|
180
|
+
path;
|
|
181
|
+
constructor(ctx, top, bottom) {
|
|
182
|
+
this.ctx = ctx;
|
|
183
|
+
this.top = top;
|
|
184
|
+
this.bottom = bottom;
|
|
185
|
+
this.path = new CappedPath(ctx, 'stroke');
|
|
186
|
+
}
|
|
187
|
+
instance() { }
|
|
188
|
+
moveTo(x, y, colorY = y) {
|
|
189
|
+
this.x = x;
|
|
190
|
+
this.y = y;
|
|
191
|
+
this.colorY = colorY;
|
|
192
|
+
this.drawing = false;
|
|
193
|
+
}
|
|
194
|
+
recolor(colorY) {
|
|
195
|
+
this.colorY = colorY;
|
|
196
|
+
}
|
|
197
|
+
lineTo(x, y, colorY = y) {
|
|
198
|
+
const span = bandSpan(this.colorY, colorY, this.top, this.bottom);
|
|
199
|
+
if (span) {
|
|
200
|
+
const [t0, t1] = span;
|
|
201
|
+
if (this.path.add()) {
|
|
202
|
+
this.drawing = false;
|
|
203
|
+
}
|
|
204
|
+
if (!this.drawing || t0 > 0) {
|
|
205
|
+
this.ctx.moveTo(this.x + (x - this.x) * t0, this.y + (y - this.y) * t0);
|
|
206
|
+
}
|
|
207
|
+
if (t0 < t1 || (t0 === 0 && t1 === 1)) {
|
|
208
|
+
this.ctx.lineTo(this.x + (x - this.x) * t1, this.y + (y - this.y) * t1);
|
|
209
|
+
}
|
|
210
|
+
this.drawing = t1 === 1;
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
this.drawing = false;
|
|
214
|
+
}
|
|
215
|
+
this.x = x;
|
|
216
|
+
this.y = y;
|
|
217
|
+
this.colorY = colorY;
|
|
218
|
+
}
|
|
219
|
+
endRun() {
|
|
220
|
+
this.drawing = false;
|
|
221
|
+
}
|
|
222
|
+
end() {
|
|
223
|
+
this.path.flush();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// The step polyline over `indices`, in order: a rise from the origin, the top
|
|
227
|
+
// across the span, the step at each joint and a drop to the origin at a gap.
|
|
228
|
+
// A rise is coloured along the y it is drawn at, a level run by its value's
|
|
229
|
+
// colour y, as the shader reads them.
|
|
230
|
+
function traceStep(pen, c, g, rows, indices, origin) {
|
|
231
|
+
const { x, x2, y, row, count } = c;
|
|
232
|
+
let inRun = false;
|
|
233
|
+
for (const i of indices) {
|
|
234
|
+
const slot = rowSlot(row, i, g.table);
|
|
235
|
+
if (slot === undefined) {
|
|
236
|
+
if (inRun) {
|
|
237
|
+
pen.endRun();
|
|
238
|
+
inRun = false;
|
|
239
|
+
}
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
pen.instance(i);
|
|
243
|
+
const x1 = g.bpToPx(x[i]);
|
|
244
|
+
const xb = g.bpToPx(x2[i]);
|
|
245
|
+
const top = valueYPx(g, y[i], slot);
|
|
246
|
+
const originY = valueYPx(g, origin, slot);
|
|
247
|
+
const colorTop = colorYPx(g, y[i], slot);
|
|
248
|
+
if (!inRun) {
|
|
249
|
+
pen.moveTo(x1, originY);
|
|
250
|
+
inRun = true;
|
|
251
|
+
}
|
|
252
|
+
pen.lineTo(x1, top);
|
|
253
|
+
pen.recolor(colorTop);
|
|
254
|
+
pen.lineTo(xb, top, colorTop);
|
|
255
|
+
pen.recolor(top);
|
|
256
|
+
if (!(i < count - 1 && abutsBefore(c, rows, i + 1))) {
|
|
257
|
+
pen.lineTo(xb, originY);
|
|
258
|
+
pen.endRun();
|
|
259
|
+
inRun = false;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
// The linear polyline over `indices`: one run per stretch of linked midpoints
|
|
264
|
+
// on a row, a break opening a new subpath with a zero-length segment, which
|
|
265
|
+
// paints the dot the shader's collapsed capsule draws.
|
|
266
|
+
function traceCenter(pen, c, g, rows, indices) {
|
|
267
|
+
const { x, x2, y, row } = c;
|
|
268
|
+
for (const i of indices) {
|
|
269
|
+
const slot = rowSlot(row, i, g.table);
|
|
270
|
+
if (slot === undefined) {
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
pen.instance(i);
|
|
274
|
+
const cx = (g.bpToPx(x[i]) + g.bpToPx(x2[i])) / 2;
|
|
275
|
+
const cy = valueYPx(g, y[i], slot);
|
|
276
|
+
const colorY = colorYPx(g, y[i], slot);
|
|
277
|
+
const linked = linksBefore(c, rows, i) && rowSlot(row, i - 1, g.table) !== undefined;
|
|
278
|
+
if (!linked) {
|
|
279
|
+
pen.moveTo(cx, cy, colorY);
|
|
280
|
+
}
|
|
281
|
+
pen.lineTo(cx, cy, colorY);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
// Under a threshold the line is stroked once per band per row, each pass
|
|
285
|
+
// keeping the parts of the polyline inside its band; otherwise once, in each
|
|
286
|
+
// instance's own colour.
|
|
287
|
+
function paintLine(ctx, c, g, params, trace) {
|
|
288
|
+
const { row, count } = c;
|
|
289
|
+
const scale = params.colorScale;
|
|
290
|
+
if (scale && isThreshold(scale) && c.colorValue) {
|
|
291
|
+
const bySlot = new Map();
|
|
292
|
+
for (let i = 0; i < count; i++) {
|
|
293
|
+
const slot = rowSlot(row, i, g.table);
|
|
294
|
+
if (slot !== undefined) {
|
|
295
|
+
const held = bySlot.get(slot);
|
|
296
|
+
if (held) {
|
|
297
|
+
held.push(i);
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
bySlot.set(slot, [i]);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
const { cuts, colors } = scale;
|
|
305
|
+
for (const [slot, indices] of bySlot) {
|
|
306
|
+
const cutYs = cuts.map(cut => colorYPx(g, cut, slot));
|
|
307
|
+
for (let k = 0; k <= cuts.length; k++) {
|
|
308
|
+
ctx.strokeStyle = abgrToCssRgba(colors[k] ?? 0);
|
|
309
|
+
const pen = new BandPen(ctx, k < cuts.length ? cutYs[k] : Number.NEGATIVE_INFINITY, k > 0 ? cutYs[k - 1] : Number.POSITIVE_INFINITY);
|
|
310
|
+
trace(pen, indices);
|
|
311
|
+
pen.end();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const color = paintColors(c, count, scale);
|
|
317
|
+
const pen = new InstancePen(ctx, i => rowColor(color[i], row, i, g.table));
|
|
318
|
+
trace(pen, Array.from({ length: count }, (_, i) => i));
|
|
319
|
+
pen.end();
|
|
320
|
+
}
|
|
321
|
+
function paintStep(ctx, c, block, frame, params) {
|
|
322
|
+
if (c.count === 0) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
const g = lineFrame(block, frame, params);
|
|
326
|
+
const rows = rowLane(c.row, c.count);
|
|
327
|
+
ctx.lineWidth = params.lineWidth;
|
|
328
|
+
paintLine(ctx, c, g, params, (pen, indices) => {
|
|
329
|
+
traceStep(pen, c, g, rows, indices, params.origin);
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
function paintCenter(ctx, c, block, frame, params) {
|
|
333
|
+
if (c.count === 0) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const g = lineFrame(block, frame, params);
|
|
337
|
+
const rows = rowLane(c.row, c.count);
|
|
338
|
+
ctx.lineWidth = params.lineWidth;
|
|
339
|
+
// Round joins and caps match the GPU capsule so sharp bends do not nick.
|
|
340
|
+
ctx.lineJoin = 'round';
|
|
341
|
+
ctx.lineCap = 'round';
|
|
342
|
+
paintLine(ctx, c, g, params, (pen, indices) => {
|
|
343
|
+
traceCenter(pen, c, g, rows, indices);
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
function box(x0, x1, y0, y1, half) {
|
|
347
|
+
const left = Math.min(x0, x1) - half;
|
|
348
|
+
const top = Math.min(y0, y1) - half;
|
|
349
|
+
return {
|
|
350
|
+
left,
|
|
351
|
+
top,
|
|
352
|
+
width: Math.max(x0, x1) + half - left,
|
|
353
|
+
height: Math.max(y0, y1) + half - top,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
// The step's ink for one instance: its rise, its top and, where nothing abuts
|
|
357
|
+
// it, its drop, each stroked `lineWidth` wide.
|
|
358
|
+
function stepInk(c, block, frame, params, i) {
|
|
359
|
+
const { x, x2, y, row, count } = c;
|
|
360
|
+
const slot = rowSlot(row, i, params.rowTable);
|
|
361
|
+
if (slot === undefined) {
|
|
362
|
+
return undefined;
|
|
363
|
+
}
|
|
364
|
+
const g = lineFrame(block, frame, params);
|
|
365
|
+
const rows = rowLane(row, count);
|
|
366
|
+
const top = valueYPx(g, y[i], slot);
|
|
367
|
+
const originY = valueYPx(g, params.origin, slot);
|
|
368
|
+
const riseFrom = abutsBefore(c, rows, i)
|
|
369
|
+
? valueYPx(g, y[i - 1], slot)
|
|
370
|
+
: originY;
|
|
371
|
+
const dropTo = i < count - 1 && abutsBefore(c, rows, i + 1) ? top : originY;
|
|
372
|
+
return box(g.bpToPx(x[i]), g.bpToPx(x2[i]), Math.min(top, riseFrom, dropTo), Math.max(top, riseFrom, dropTo), params.lineWidth / 2);
|
|
373
|
+
}
|
|
374
|
+
// The linear variant's ink for one instance: the segment from the previous
|
|
375
|
+
// midpoint to its own, or its dot at a run start.
|
|
376
|
+
function centerInk(c, block, frame, params, i) {
|
|
377
|
+
const { x, x2, y, row, count } = c;
|
|
378
|
+
const slot = rowSlot(row, i, params.rowTable);
|
|
379
|
+
if (slot === undefined) {
|
|
380
|
+
return undefined;
|
|
381
|
+
}
|
|
382
|
+
const g = lineFrame(block, frame, params);
|
|
383
|
+
const rows = rowLane(row, count);
|
|
384
|
+
const cx = (g.bpToPx(x[i]) + g.bpToPx(x2[i])) / 2;
|
|
385
|
+
const cy = valueYPx(g, y[i], slot);
|
|
386
|
+
const linked = linksBefore(c, rows, i) &&
|
|
387
|
+
rowSlot(row, i - 1, params.rowTable) !== undefined;
|
|
388
|
+
const px = linked ? (g.bpToPx(x[i - 1]) + g.bpToPx(x2[i - 1])) / 2 : cx;
|
|
389
|
+
const py = linked ? valueYPx(g, y[i - 1], slot) : cy;
|
|
390
|
+
return box(px, cx, py, cy, params.lineWidth / 2);
|
|
391
|
+
}
|
|
392
|
+
/** The step variant: three square-capped quads an instance, flat filled. */
|
|
393
|
+
export const lineStepMark = {
|
|
394
|
+
id: 'lineStep',
|
|
395
|
+
pass: { ...slangPass({ id: 'lineStep', mod: stepShader }), pack: packStep },
|
|
396
|
+
writeUniforms: writeLineUniforms,
|
|
397
|
+
textures: rowTableTextures,
|
|
398
|
+
paintBlock: paintStep,
|
|
399
|
+
ink: stepInk,
|
|
400
|
+
};
|
|
401
|
+
/** The linear variant: one round-capped capsule an instance, max blended. */
|
|
402
|
+
export const lineCenterMark = {
|
|
403
|
+
id: 'lineCenter',
|
|
404
|
+
pass: {
|
|
405
|
+
...slangPass({ id: 'lineCenter', mod: centerShader }),
|
|
406
|
+
pack: packCenter,
|
|
407
|
+
},
|
|
408
|
+
writeUniforms: writeLineUniforms,
|
|
409
|
+
textures: rowTableTextures,
|
|
410
|
+
paintBlock: paintCenter,
|
|
411
|
+
ink: centerInk,
|
|
412
|
+
};
|
|
413
|
+
/** The shape a line's `interpolate` draws with. */
|
|
414
|
+
export function lineMarkOf(interpolate) {
|
|
415
|
+
return interpolate === 'linear' ? lineCenterMark : lineStepMark;
|
|
416
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { LINK_ELSEWHERE, LINK_NO_REGION } from '../shaders/linkMark.consts.generated.ts';
|
|
2
|
+
import type { ColorChannel } from './markRamp.ts';
|
|
3
|
+
import type { RowChannel, RowParams } from './rowLane.ts';
|
|
4
|
+
import type { MarkColorScale, MarkShape } from './types.ts';
|
|
5
|
+
import type { MarkValueScale } from './valueScale.ts';
|
|
6
|
+
/**
|
|
7
|
+
* The `link` shape's channels: a stroked curve from `x`, on the displayed
|
|
8
|
+
* region whose payload holds it, to `x2` on the displayed region `x2Region`
|
|
9
|
+
* names, {@link LINK_NO_REGION} where the far end lies on none and
|
|
10
|
+
* {@link LINK_ELSEWHERE} where another payload draws the curve. `y` is the
|
|
11
|
+
* apex's value on the band's scale where the mark names one, and `size` the
|
|
12
|
+
* raw value the stroke width reads through the size scale.
|
|
13
|
+
*/
|
|
14
|
+
export interface LinkChannels extends ColorChannel, RowChannel {
|
|
15
|
+
x: Uint32Array;
|
|
16
|
+
x2: Uint32Array;
|
|
17
|
+
x2Region: Uint32Array;
|
|
18
|
+
y?: Float32Array;
|
|
19
|
+
size?: Float32Array;
|
|
20
|
+
/**
|
|
21
|
+
* The breakend ticks each instance carries: two bits per foot, 1 pointing
|
|
22
|
+
* forward along the genome and 2 back, the `x` foot in the low pair.
|
|
23
|
+
*/
|
|
24
|
+
feet?: Uint8Array;
|
|
25
|
+
count: number;
|
|
26
|
+
}
|
|
27
|
+
export declare const LINK_FOOT_FORWARD = 1;
|
|
28
|
+
export declare const LINK_FOOT_REVERSE = 2;
|
|
29
|
+
/** The `feet` lane's value for a tick at each foot, by genomic direction. */
|
|
30
|
+
export declare function linkFeet(xDir: number, x2Dir: number): number;
|
|
31
|
+
/**
|
|
32
|
+
* One displayed region as a foot places through it: the canvas px of an
|
|
33
|
+
* anchor bp chosen near the view, so a foot's offset from it stays inside
|
|
34
|
+
* float32 on the GPU, and the signed px per bp, negative on a reversed
|
|
35
|
+
* region.
|
|
36
|
+
*/
|
|
37
|
+
export interface LinkRegion {
|
|
38
|
+
anchorPx: number;
|
|
39
|
+
anchorBp: number;
|
|
40
|
+
signedPxPerBp: number;
|
|
41
|
+
/** The region's screen extent, which a foot stops at; unbounded when absent. */
|
|
42
|
+
leftPx?: number;
|
|
43
|
+
rightPx?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface LinkSizeScale {
|
|
46
|
+
domain: [number, number];
|
|
47
|
+
scale: 'linear' | 'log';
|
|
48
|
+
range: [number, number];
|
|
49
|
+
}
|
|
50
|
+
export type LinkShape = 'dome' | 'arc' | 'line';
|
|
51
|
+
export interface LinkParams extends RowParams, MarkValueScale {
|
|
52
|
+
/** The quantitative colour scale, for a link whose colour is a ramp or a threshold. */
|
|
53
|
+
colorScale?: MarkColorScale;
|
|
54
|
+
/** The view's displayed regions, indexed as `x2Region` and the block's own index are. */
|
|
55
|
+
regions: readonly LinkRegion[];
|
|
56
|
+
/**
|
|
57
|
+
* `dome` clamps the apex to the band; `arc` is a true semicircle; `line` is
|
|
58
|
+
* a straight segment at the apex height.
|
|
59
|
+
*/
|
|
60
|
+
linkShape: LinkShape;
|
|
61
|
+
/** How far a stem rises from a foot whose mate lies on no displayed region. */
|
|
62
|
+
stemPx?: number;
|
|
63
|
+
/** A straight segment's `[dash, gap]` in CSS px, starting on a dash. */
|
|
64
|
+
strokeDash?: readonly [number, number];
|
|
65
|
+
/** How long a breakend foot runs where its region has the room. */
|
|
66
|
+
footPx?: number;
|
|
67
|
+
/** Whether the mark names a `y`, which then places the apex. */
|
|
68
|
+
valued: boolean;
|
|
69
|
+
/** The stroke width where no `size` channel is read. */
|
|
70
|
+
sizePx: number;
|
|
71
|
+
sizeScale?: LinkSizeScale;
|
|
72
|
+
/** How far inside the band the value range ends, the axis's own. */
|
|
73
|
+
insetPx?: number;
|
|
74
|
+
}
|
|
75
|
+
export declare const linkMark: MarkShape<LinkChannels, LinkParams>;
|
|
76
|
+
export { LINK_ELSEWHERE, LINK_NO_REGION };
|