@jbrowse/render-core 5.0.0-beta.13 → 5.0.0-beta.14

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.
Files changed (153) hide show
  1. package/esm/OverlayCanvas.d.ts +3 -2
  2. package/esm/OverlayCanvas.js +4 -2
  3. package/esm/RenderCanvas.d.ts +4 -3
  4. package/esm/RenderCanvas.js +4 -2
  5. package/esm/ScrollLockedOverlay.d.ts +2 -2
  6. package/esm/ScrollLockedOverlay.js +3 -2
  7. package/esm/blockClipUtils.d.ts +5 -5
  8. package/esm/blockClipUtils.js +4 -3
  9. package/esm/canvas2dUtils.d.ts +15 -21
  10. package/esm/canvas2dUtils.js +25 -55
  11. package/esm/colorRampLut.d.ts +2 -2
  12. package/esm/colorRampLut.js +2 -2
  13. package/esm/coverageBand.d.ts +0 -1
  14. package/esm/coverageBand.js +0 -5
  15. package/esm/coverageBandBuffers.d.ts +8 -5
  16. package/esm/createRenderingBackend.d.ts +1 -1
  17. package/esm/displayPhase.d.ts +5 -9
  18. package/esm/displayPhase.js +2 -2
  19. package/esm/hal/mockHal.d.ts +3 -4
  20. package/esm/hal/mockHal.js +5 -4
  21. package/esm/hal/types.d.ts +5 -5
  22. package/esm/hal/webgl2Hal.d.ts +4 -1
  23. package/esm/hal/webgl2Hal.js +15 -6
  24. package/esm/hal/webgpuHal.js +2 -2
  25. package/esm/linkFeet.d.ts +4 -0
  26. package/esm/linkFeet.js +7 -0
  27. package/esm/marks/barMark.d.ts +1 -1
  28. package/esm/marks/colorFill.d.ts +4 -4
  29. package/esm/marks/colorFill.js +4 -4
  30. package/esm/marks/connectorMark.d.ts +48 -0
  31. package/esm/marks/connectorMark.js +285 -0
  32. package/esm/marks/drawAgainstHit.d.ts +1 -1
  33. package/esm/marks/drawAgainstHit.js +4 -4
  34. package/esm/marks/glyphPaint.d.ts +5 -4
  35. package/esm/marks/glyphPaint.js +17 -7
  36. package/esm/marks/index.d.ts +6 -3
  37. package/esm/marks/index.js +5 -3
  38. package/esm/marks/lineMark.d.ts +44 -10
  39. package/esm/marks/lineMark.js +20 -19
  40. package/esm/marks/linkMark.d.ts +22 -5
  41. package/esm/marks/linkMark.js +103 -25
  42. package/esm/marks/markBackend.d.ts +1 -1
  43. package/esm/marks/markBackend.js +1 -1
  44. package/esm/marks/markRamp.d.ts +11 -11
  45. package/esm/marks/markRamp.js +9 -9
  46. package/esm/marks/pointMark.d.ts +11 -5
  47. package/esm/marks/pointMark.js +34 -9
  48. package/esm/marks/rowLane.d.ts +3 -3
  49. package/esm/marks/rowLane.js +2 -2
  50. package/esm/marks/rowTable.d.ts +5 -5
  51. package/esm/marks/rowTable.js +4 -4
  52. package/esm/marks/ruleMark.js +1 -0
  53. package/esm/marks/spanMark.d.ts +4 -4
  54. package/esm/marks/types.d.ts +4 -4
  55. package/esm/marks/types.js +5 -0
  56. package/esm/perRegionRenderingBackend.d.ts +1 -1
  57. package/esm/perRegionRenderingBackend.js +1 -1
  58. package/esm/regionDataMap.d.ts +2 -2
  59. package/esm/regionDataMap.js +2 -2
  60. package/esm/shaders/capsule.js.generated.d.ts +1 -1
  61. package/esm/shaders/capsule.js.generated.js +2 -2
  62. package/esm/shaders/connectorMark.consts.generated.d.ts +11 -0
  63. package/esm/shaders/connectorMark.consts.generated.js +13 -0
  64. package/esm/shaders/{coverageIndicator.generated.d.ts → connectorMark.generated.d.ts} +2 -1
  65. package/esm/shaders/connectorMark.generated.js +8 -0
  66. package/esm/shaders/connectorMark.glsl.generated.d.ts +2 -0
  67. package/esm/shaders/connectorMark.glsl.generated.js +4 -0
  68. package/esm/shaders/connectorMark.iface.generated.d.ts +88 -0
  69. package/esm/shaders/connectorMark.iface.generated.js +1194 -0
  70. package/esm/shaders/connectorMark.js.generated.d.ts +5 -0
  71. package/esm/shaders/connectorMark.js.generated.js +47 -0
  72. package/esm/shaders/connectorMark.wgsl.generated.d.ts +1 -0
  73. package/esm/shaders/connectorMark.wgsl.generated.js +3 -0
  74. package/esm/shaders/coverageInterbase.glsl.generated.d.ts +1 -1
  75. package/esm/shaders/coverageInterbase.glsl.generated.js +1 -1
  76. package/esm/shaders/coverageInterbase.wgsl.generated.d.ts +1 -1
  77. package/esm/shaders/coverageInterbase.wgsl.generated.js +1 -1
  78. package/esm/shaders/curveDistance.js.generated.d.ts +3 -0
  79. package/esm/shaders/curveDistance.js.generated.js +104 -0
  80. package/esm/shaders/lineCenterMark.glsl.generated.d.ts +2 -2
  81. package/esm/shaders/lineCenterMark.glsl.generated.js +2 -2
  82. package/esm/shaders/lineCenterMark.wgsl.generated.d.ts +1 -1
  83. package/esm/shaders/lineCenterMark.wgsl.generated.js +1 -1
  84. package/esm/shaders/linkMark.consts.generated.d.ts +1 -0
  85. package/esm/shaders/linkMark.consts.generated.js +1 -0
  86. package/esm/shaders/linkMark.glsl.generated.d.ts +2 -2
  87. package/esm/shaders/linkMark.glsl.generated.js +2 -2
  88. package/esm/shaders/linkMark.js.generated.d.ts +2 -1
  89. package/esm/shaders/linkMark.js.generated.js +30 -1
  90. package/esm/shaders/linkMark.wgsl.generated.d.ts +1 -1
  91. package/esm/shaders/linkMark.wgsl.generated.js +1 -1
  92. package/esm/shaders/pointMark.glsl.generated.d.ts +1 -1
  93. package/esm/shaders/pointMark.glsl.generated.js +1 -1
  94. package/esm/shaders/pointMark.iface.generated.d.ts +10 -8
  95. package/esm/shaders/pointMark.iface.generated.js +18 -16
  96. package/esm/shaders/pointMark.wgsl.generated.d.ts +1 -1
  97. package/esm/shaders/pointMark.wgsl.generated.js +1 -1
  98. package/package.json +7 -4
  99. package/src/shaders/arcHull.test.ts +87 -0
  100. package/src/shaders/barMark.slang +2 -2
  101. package/src/shaders/capsule.js.generated.ts +2 -2
  102. package/src/shaders/capsule.slang +69 -24
  103. package/src/shaders/clipStrip.slang +1 -1
  104. package/src/shaders/colorPack.slang +2 -2
  105. package/src/shaders/colorRampLut.slang +7 -7
  106. package/src/shaders/connectorMark.consts.generated.ts +24 -0
  107. package/src/shaders/connectorMark.generated.ts +12 -0
  108. package/src/shaders/connectorMark.glsl.generated.ts +6 -0
  109. package/src/shaders/connectorMark.iface.generated.ts +1270 -0
  110. package/src/shaders/connectorMark.js.generated.ts +52 -0
  111. package/src/shaders/connectorMark.slang +287 -0
  112. package/src/shaders/connectorMark.wgsl.generated.ts +4 -0
  113. package/src/shaders/coverageBand.slang +10 -12
  114. package/src/shaders/coverageInterbase.glsl.generated.ts +1 -1
  115. package/src/shaders/coverageInterbase.slang +24 -21
  116. package/src/shaders/coverageInterbase.wgsl.generated.ts +1 -1
  117. package/src/shaders/coverageSnp.slang +1 -1
  118. package/src/shaders/curveDistance.js.generated.ts +100 -0
  119. package/src/shaders/curveDistance.slang +104 -1
  120. package/src/shaders/farDome.test.ts +117 -0
  121. package/src/shaders/hpClampFloor.test.ts +0 -4
  122. package/src/shaders/lineCenterMark.glsl.generated.ts +2 -2
  123. package/src/shaders/lineCenterMark.slang +14 -22
  124. package/src/shaders/lineCenterMark.wgsl.generated.ts +1 -1
  125. package/src/shaders/lineCommon.slang +10 -10
  126. package/src/shaders/lineStepMark.slang +5 -5
  127. package/src/shaders/linkMark.consts.generated.ts +2 -0
  128. package/src/shaders/linkMark.glsl.generated.ts +2 -2
  129. package/src/shaders/linkMark.js.generated.ts +27 -1
  130. package/src/shaders/linkMark.slang +58 -18
  131. package/src/shaders/linkMark.wgsl.generated.ts +1 -1
  132. package/src/shaders/markColor.slang +10 -10
  133. package/src/shaders/pointMark.glsl.generated.ts +1 -1
  134. package/src/shaders/pointMark.iface.generated.ts +19 -16
  135. package/src/shaders/pointMark.slang +12 -8
  136. package/src/shaders/pointMark.wgsl.generated.ts +1 -1
  137. package/src/shaders/rowRect.slang +3 -3
  138. package/src/shaders/rowTable.slang +7 -7
  139. package/src/shaders/scoreScale.slang +1 -1
  140. package/src/shaders/spanMark.slang +5 -5
  141. package/src/shaders/viewRegion.slang +13 -0
  142. package/esm/shaders/coverageIndicator.generated.js +0 -7
  143. package/esm/shaders/coverageIndicator.glsl.generated.d.ts +0 -2
  144. package/esm/shaders/coverageIndicator.glsl.generated.js +0 -4
  145. package/esm/shaders/coverageIndicator.iface.generated.d.ts +0 -85
  146. package/esm/shaders/coverageIndicator.iface.generated.js +0 -114
  147. package/esm/shaders/coverageIndicator.wgsl.generated.d.ts +0 -1
  148. package/esm/shaders/coverageIndicator.wgsl.generated.js +0 -3
  149. package/src/shaders/coverageIndicator.generated.ts +0 -11
  150. package/src/shaders/coverageIndicator.glsl.generated.ts +0 -6
  151. package/src/shaders/coverageIndicator.iface.generated.ts +0 -172
  152. package/src/shaders/coverageIndicator.slang +0 -61
  153. package/src/shaders/coverageIndicator.wgsl.generated.ts +0 -4
@@ -34,19 +34,19 @@ public struct Uniforms {
34
34
  public int valueScaleType;
35
35
  // Already resolved from the domain (`resolveSymlogConstant`); read by symlog alone.
36
36
  public float valueSymlogConstant;
37
- // `markColor`'s: 0 packs the instance's colour, 1 and 2 read its slot as a
37
+ // `markColor`'s: 0 packs the instance's color, 1 and 2 read its slot as a
38
38
  // value through the ramp.
39
39
  public int rampMode;
40
40
  public float rampMin;
41
41
  public float rampMax;
42
42
  public float rampMidNorm;
43
43
  // `markColor`'s threshold: how many cuts are in use, the cuts four to a
44
- // vector, and the colour of each interval between them.
44
+ // vector, and the color of each interval between them.
45
45
  public int colorCutCount;
46
46
  public float4 colorCuts[2];
47
47
  public float4 colorBands[MAX_COLOR_BANDS];
48
- // 1 where the colour field is the plotted `y`, so a threshold's cuts sit on
49
- // the y scale and the line changes colour where it crosses one.
48
+ // 1 where the color field is the plotted `y`, so a threshold's cuts sit on
49
+ // the y scale and the line changes color where it crosses one.
50
50
  public int colorFromY;
51
51
  // CSS px per row band; the canvas height where every instance is on row 0.
52
52
  public float rowHeight;
@@ -73,9 +73,9 @@ public float lineValueYPx(float value, float bandTop, Uniforms u) {
73
73
  return bandTop + valueToYPxScaled(value, u.domainMin, u.domainMax, u.rowBandPx, u.valueScaleType, u.valueSymlogConstant);
74
74
  }
75
75
 
76
- // A value's y in the band for the colour test, placed UNCLAMPED where
76
+ // A value's y in the band for the color test, placed UNCLAMPED where
77
77
  // `lineValueYPx` clamps it to draw: the cuts go through it, and so does the
78
- // line a threshold colours along. Clamped, a cut outside the domain landed on
78
+ // line a threshold colors along. Clamped, a cut outside the domain landed on
79
79
  // the band edge out-of-domain values are clamped onto too, and a value past
80
80
  // the domain took the side of that edge rather than its own.
81
81
  public float lineColorYPx(float value, float bandTop, Uniforms u) {
@@ -96,14 +96,14 @@ public float4 lineCutYsPx(int from, float bandTop, Uniforms u) {
96
96
  return ys;
97
97
  }
98
98
 
99
- // Whether a line reads its colour along y: under a threshold over the plotted
100
- // value, on a row the table does not recolour. The painter asks it too.
99
+ // Whether a line reads its color along y: under a threshold over the plotted
100
+ // value, on a row the table does not recolor. The painter asks it too.
101
101
  public bool lineColorAlongY(int rampMode, int colorFromY, bool overridden) {
102
102
  return rampMode == RAMP_THRESHOLD && colorFromY != 0 && !overridden;
103
103
  }
104
104
 
105
- // A line fragment's colour: along y, the interval the colour y it is read at
106
- // falls in; otherwise the colour its vertex resolved.
105
+ // A line fragment's color: along y, the interval the color y it is read at
106
+ // falls in; otherwise the color its vertex resolved.
107
107
  public float4 lineFragmentColor(float colorYPx, float4 cutYsLo, float4 cutYsHi, float4 own, float alongY, Uniforms u) {
108
108
  if (alongY < 0.5) {
109
109
  return own;
@@ -13,7 +13,7 @@
13
13
  // is `lineCenterMark.slang`, whose capsules union under a max blend.
14
14
  //
15
15
  // The band is the instance's `row`, read through the bound row table as
16
- // `barMark` reads it: a key resolved to its slot and colour, or dropped off
16
+ // `barMark` reads it: a key resolved to its slot and color, or dropped off
17
17
  // clip space where the table hides it. A pass binding none (`rowTableKeys` −1)
18
18
  // draws `row` as the band.
19
19
  //! targets: wgsl, glsl
@@ -48,7 +48,7 @@ struct LineStepInstance {
48
48
  struct VsOut {
49
49
  float4 position : SV_Position;
50
50
  nointerpolation float4 color : COLOR0;
51
- // the y range the fragment's colour is read in: a rise's own span, or a
51
+ // the y range the fragment's color is read in: a rise's own span, or a
52
52
  // level run's value placed unclamped
53
53
  nointerpolation float2 colorLine : TEXCOORD0;
54
54
  nointerpolation float4 cutYsLo : TEXCOORD1;
@@ -118,10 +118,10 @@ VsOut vs_main(LineStepInstance inst, uint vid : SV_VertexID) {
118
118
 
119
119
  // The quads stay flat fills: a feature's three quads overlap at the joints so
120
120
  // corners fill with no gaps, and per-fragment coverage on an edge two quads
121
- // both cover would double-blend there. Under a threshold the colour is read at
122
- // the fragment's own y along a rise, so a step across a cut changes colour at
121
+ // both cover would double-blend there. Under a threshold the color is read at
122
+ // the fragment's own y along a rise, so a step across a cut changes color at
123
123
  // the cut, and at the value's y along a level run so a thick line lying on a
124
- // cut stays one colour.
124
+ // cut stays one color.
125
125
  [shader("fragment")]
126
126
  float4 fs_main(VsOut v) : SV_Target {
127
127
  return lineFragmentColor(
@@ -21,6 +21,8 @@ export const LINK_FOOT_PX = 20
21
21
 
22
22
  export const LINK_FAR_SCREEN_WIDTHS = 3
23
23
 
24
+ export const LINK_FAR_FLAT_RATIO = 0.25
25
+
24
26
  export const LINK_SIZE_CONSTANT = 0
25
27
 
26
28
  export const LINK_SIZE_SCALED = 1
@@ -1,6 +1,6 @@
1
1
  // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from linkMark.slang.
2
2
  // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
3
 
4
- export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n float canvasHeight_0;\n float devicePixelRatio_0;\n float rowHeight_0;\n float rowOffsetPx_0;\n int reverse_0;\n float stemPx_0;\n float dashPx_0;\n float gapPx_0;\n float footPx_0;\n uint curveSegments_0;\n float insetPx_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n float valueSymlogConstant_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n int valued_0;\n int linkShape_0;\n int sizeMode_0;\n float sizeConstantPx_0;\n float sizeDomainMin_0;\n float sizeDomainMax_0;\n int sizeScaleType_0;\n float sizeRangeMin_0;\n float sizeRangeMax_0;\n float canvasWidth_0;\n uint regionCount_0;\n float zero_0;\n vec4 ownEntry_0;\n vec4 ownSpan_0;\n vec4 regionTable_0[256];\n vec4 regionSpan_0[128];\n int rowTableKeys_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\n\n\nvec4 unpackRGBA_0(uint c_0)\n{\n\n return vec4(float((c_0 >> 0U) & 255U), float((c_0 >> 8U) & 255U), float((c_0 >> 16U) & 255U), float((c_0 >> 24U) & 255U)) / 255.0;\n}\n\n\nfloat rampMidT_0(float t_0, float mid_0)\n{\n\n float _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\n}\n\n\nint thresholdBand_0(float value_0, int cutCount_0, vec4 cutsLo_1, vec4 cutsHi_1)\n{\n\n int band_0 = 0;\n\n int i_1 = 0;\n\n for(;;)\n {\n\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n\n break;\n }\n\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n\n band_0 = i_1 + 1;\n\n }\n\n i_1 = i_1 + 1;\n\n }\n\n return band_0;\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_1 = 1.0 + x_0;\n\n float _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\n}\n\nfloat symlogTransform_0(float x_1, float c_1)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\n\nfloat normalizeScoreUnclamped_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_1;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_1 > 0.0)\n {\n\n tMax_0 = domainMin_1;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_1;\n\n tMin_0 = domainMin_1;\n\n t_1 = score_0;\n\n }\n\n }\n\n float tRange_0 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n if(t_1 > tMin_0)\n {\n\n tMax_0 = 1.0;\n\n }\n else\n {\n\n tMax_0 = 0.0;\n\n }\n\n return tMax_0;\n }\n return (t_1 - tMin_0) / tRange_0;\n}\n\nfloat normalizeScore_0(float score_1, float domainMin_2, float domainMax_2, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_2, domainMax_2, scaleType_1, symlogConstant_1), 0.0, 1.0);\n}\n\n\nuint rowTableWidth_0(uint keys_0)\n{\n\n return max(min(keys_0, 2048U), 1U);\n}\n\nuint rowTablePlaneHeight_0(uint keys_1)\n{\n\n uint w_0 = rowTableWidth_0(keys_1);\n uint _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\n}\n\n\nuint byteOf_0(float channel_0)\n{\n\n return uint(channel_0 * 255.0 + 0.5);\n}\n\n\nfloat linkStrokeWidthPx_0(float raw_0, int sizeMode_1, float constantPx_0, float domainMin_3, float domainMax_3, int scaleType_2, float rangeMin_0, float rangeMax_0, float dpr_0)\n{\n\n float w_1;\n\n if(sizeMode_1 == 1)\n {\n if(raw_0 > -1.00000001504746622e+29)\n {\n\n w_1 = rangeMin_0 + normalizeScore_0(raw_0, domainMin_3, domainMax_3, scaleType_2, 1.0) * (rangeMax_0 - rangeMin_0);\n\n }\n else\n {\n\n w_1 = rangeMin_0;\n\n }\n\n }\n else\n {\n\n w_1 = constantPx_0;\n\n }\n\n return max(w_1, 1.5 / dpr_0);\n}\n\n\nfloat aaPx_0(float dpr_1)\n{\n\n return 1.0 / max(dpr_1, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_2)\n{\n\n return 0.5 * aaPx_0(dpr_2);\n}\n\n\nfloat rowBandTopPx_0(float rowOffsetPx_1, float rowHeight_1, uint slot_0)\n{\n\n return rowOffsetPx_1 + rowHeight_1 * float(slot_0);\n}\n\n\nfloat linkBaseYPx_0(float rowOffsetPx_2, float rowHeight_2, uint row_0, int reverse_1)\n{\n\n float _S11 = rowBandTopPx_0(rowOffsetPx_2, rowHeight_2, row_0);\n\n float _S12;\n\n if(reverse_1 != 0)\n {\n\n _S12 = 0.0;\n\n }\n else\n {\n\n _S12 = rowHeight_2;\n\n }\n\n return _S11 + _S12;\n}\n\n\nvec2 hpSplitUint_0(uint value_1)\n{\n\n uint lo_0 = value_1 & 4095U;\n\n return vec2(float(value_1 - lo_0), float(lo_0));\n}\n\n\nfloat hpViewportOffsetBp_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n\n\n return max(bpRange_0.x - splitPos_0.x, floorBp_0) + max(bpRange_0.y - splitPos_0.y, floorBp_0);\n}\n\n\nfloat entryPx_0(uint bp_0, vec4 r_0, float hpZero_1)\n{\n\n return r_0.x - hpViewportOffsetBp_0(hpSplitUint_0(bp_0), vec3(r_0.y, r_0.z, 0.0), hpZero_1) * r_0.w;\n}\n\n\nfloat valueToYPxScaled_0(float value_2, float domainMin_4, float domainMax_4, float h_0, int scaleType_3, float symlogConstant_2)\n{\n\n return (1.0 - normalizeScore_0(value_2, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_0;\n}\n\n\nfloat insetValueYPx_0(float value_3, float domainMin_5, float domainMax_5, float h_1, int scaleType_4, float insetPx_1, float symlogConstant_3)\n{\n\n float _S13 = min(insetPx_1, h_1 * 0.5);\n return _S13 + valueToYPxScaled_0(value_3, domainMin_5, domainMax_5, h_1 - 2.0 * _S13, scaleType_4, symlogConstant_3);\n}\n\n\nfloat linkValuePx_0(float value_4, float domainMin_6, float domainMax_6, float h_2, int scaleType_5, float insetPx_2, float symlogConstant_4)\n{\n\n return h_2 - insetValueYPx_0(value_4, domainMin_6, domainMax_6, h_2, scaleType_5, insetPx_2, symlogConstant_4);\n}\n\n\n\n\nfloat linkApexPx_0(float halfWidthPx_0, float reachPx_0, float strokeHalfPx_0, int linkShape_1, int valued_1, float valuePx_0)\n{\n\n if(valued_1 != 0)\n {\n\n return valuePx_0;\n }\n\n if(linkShape_1 == 2)\n {\n\n return 0.0;\n }\n\n if(linkShape_1 == 1)\n {\n\n return halfWidthPx_0;\n }\n\n return min(halfWidthPx_0, max(reachPx_0 - strokeHalfPx_0, 0.0));\n}\n\n\nbool linkIsFar_0(float halfWidthPx_1, float screenWidthPx_0)\n{\n\n return (2.0 * halfWidthPx_1) > (3.0 * screenWidthPx_0);\n}\n\n\nvec2 linkRadiiPx_0(float halfWidthPx_2, float apexPx_0, float screenWidthPx_1)\n{\n\n if(linkIsFar_0(halfWidthPx_2, screenWidthPx_1))\n {\n\n return vec2(halfWidthPx_2, halfWidthPx_2);\n }\n return vec2(halfWidthPx_2, apexPx_0);\n}\n\n\nfloat legSweepAngle_0(float radiusPx_0, float yReachPx_0)\n{\n\n return asin(clamp(yReachPx_0 / max(radiusPx_0, 9.99999997475242708e-07), 0.0, 1.0));\n}\n\n\nvec2 wideCircleLeg_0(uint seg_0, uint segments_0, float legSweep_0)\n{\n\n uint half_0 = segments_0 / 2U;\n if(seg_0 <= half_0)\n {\n\n return vec2(1.0, float(seg_0) / float(half_0) * legSweep_0);\n }\n return vec2(-1.0, float(segments_0 - seg_0) / float(segments_0 - half_0 - 1U) * legSweep_0);\n}\n\n\n\n\nfloat wideCircleLegStep_0(uint seg_1, uint segments_1, float legSweep_1)\n{\n\n uint half_1 = segments_1 / 2U;\n\n uint _S14;\n if(seg_1 <= half_1)\n {\n\n _S14 = half_1;\n\n }\n else\n {\n\n _S14 = segments_1 - half_1 - 1U;\n\n }\n\n return legSweep_1 / float(_S14);\n}\n\n\nvec2 wideCircleHullPoint_0(float sinB_0, float sinHalfB_0, float cosHalf_0, float radiusPx_1, float padPx_0)\n{\n\n float sec_0;\n if(padPx_0 > 0.0)\n {\n\n sec_0 = 1.0 / max(cosHalf_0, 9.99999997475242708e-07);\n\n }\n else\n {\n\n sec_0 = 1.0;\n\n }\n float grow_0 = radiusPx_1 * (sec_0 - 1.0) + sec_0 * padPx_0;\n float sh2_0 = sinHalfB_0 * sinHalfB_0;\n return vec2(grow_0 * (1.0 - 2.0 * sh2_0) - 2.0 * radiusPx_1 * sh2_0, (radiusPx_1 + grow_0) * sinB_0);\n}\n\n\nvec2 ellipseHullPoint_0(float cosA_0, float sinA_0, float cosHalf_1, float sinHalf_0, float rx_0, float ry_0, float padPx_1)\n{\n float px_0 = cosA_0 * rx_0;\n float py_0 = sinA_0 * ry_0;\n if(padPx_1 <= 0.0)\n {\n\n float d_0 = - padPx_1;\n float gx_0 = ry_0 * cosA_0;\n float gy_0 = rx_0 * sinA_0;\n float glen_0 = sqrt(gx_0 * gx_0 + gy_0 * gy_0);\n bool acrossX_0 = (ry_0 * glen_0) < (d_0 * rx_0);\n bool acrossY_0 = (rx_0 * glen_0) < (d_0 * ry_0);\n\n bool _S15;\n if(acrossX_0)\n {\n\n _S15 = acrossY_0;\n\n }\n else\n {\n\n _S15 = false;\n\n }\n\n if(_S15)\n {\n\n return vec2(0.0, 0.0);\n }\n\n if(acrossX_0)\n {\n\n float _S16 = ry_0 * ry_0;\n return vec2(float((int(sign((cosA_0))))) * sqrt(max(_S16 - d_0 * d_0, 0.0) * max(rx_0 * rx_0 - _S16, 0.0)) / max(ry_0, 9.99999997475242708e-07), 0.0);\n }\n if(acrossY_0)\n {\n\n float _S17 = rx_0 * rx_0;\n return vec2(0.0, float((int(sign((sinA_0))))) * sqrt(max(_S17 - d_0 * d_0, 0.0) * max(ry_0 * ry_0 - _S17, 0.0)) / max(rx_0, 9.99999997475242708e-07));\n }\n float k_0 = d_0 / max(glen_0, 9.99999997475242708e-07);\n return vec2(px_0 - gx_0 * k_0, py_0 - gy_0 * k_0);\n }\n float _S18 = cosA_0 * cosHalf_1;\n\n float _S19 = sinA_0 * sinHalf_0;\n\n float ax_0 = ry_0 * (_S18 + _S19);\n float _S20 = sinA_0 * cosHalf_1;\n\n float _S21 = cosA_0 * sinHalf_0;\n\n float ay_0 = rx_0 * (_S20 - _S21);\n float bx_0 = ry_0 * (_S18 - _S19);\n float by_0 = rx_0 * (_S20 + _S21);\n float _S22 = max(sqrt(ax_0 * ax_0 + ay_0 * ay_0), 9.99999968265522539e-21);\n float _S23 = max(sqrt(bx_0 * bx_0 + by_0 * by_0), 9.99999968265522539e-21);\n float nx_0 = ax_0 / _S22 + bx_0 / _S23;\n float ny_0 = ay_0 / _S22 + by_0 / _S23;\n float m_0 = 2.0 * padPx_1 / max(nx_0 * nx_0 + ny_0 * ny_0, 0.00019999999494758);\n return vec2(px_0 / cosHalf_1 + nx_0 * m_0, py_0 / cosHalf_1 + ny_0 * m_0);\n}\n\n\nstruct LinkVertex_0\n{\n vec2 screen_0;\n vec2 local_0;\n vec2 radii_0;\n float kind_0;\n float legSide_0;\n};\n\n\nstruct LinkInstance_0\n{\n uint x_2;\n uint x2_0;\n uint x2Region_0;\n float y_0;\n float size_0;\n uint color_0;\n uint row_1;\n uint feet_0;\n};\n\n\nstruct LinkEnv_0\n{\n float strokeHalf_0;\n float hw_0;\n float baseY_0;\n float ySign_0;\n float reach_0;\n float xPx_0;\n float x2Px_0;\n bool placed_0;\n};\n\n\nLinkVertex_0 curveVertex_0(LinkInstance_0 inst_0, LinkEnv_0 e_0, uint seg_2, float side_0)\n{\n\n float t_2 = float(seg_2) / float(u_0.curveSegments_0);\n\n float pad_0 = side_0 * e_0.hw_0;\n\n\n LinkVertex_0 v_0;\n v_0.legSide_0 = 1.0;\n\n float legDir_0;\n\n vec2 origin_0;\n if(!e_0.placed_0)\n {\n\n v_0.kind_0 = 2.0;\n v_0.radii_0 = vec2(0.0, u_0.stemPx_0);\n\n\n v_0.local_0 = vec2(pad_0, - t_2 * (u_0.stemPx_0 + e_0.hw_0));\n\n origin_0 = vec2(e_0.xPx_0, e_0.baseY_0);\n\n legDir_0 = 1.0;\n\n }\n else\n {\n\n float pairHalf_0 = abs(e_0.x2Px_0 - e_0.xPx_0) * 0.5;\n\n\n float apex_0 = linkApexPx_0(pairHalf_0, e_0.reach_0, e_0.strokeHalf_0, u_0.linkShape_0, u_0.valued_0, linkValuePx_0(inst_0.y_0, u_0.domainMin_0, u_0.domainMax_0, u_0.rowHeight_0, u_0.valueScaleType_0, u_0.insetPx_0, u_0.valueSymlogConstant_0));\n v_0.radii_0 = linkRadiiPx_0(pairHalf_0, apex_0, u_0.canvasWidth_0);\n float _S24 = min(e_0.xPx_0, e_0.x2Px_0);\n\n float _S25 = max(e_0.xPx_0, e_0.x2Px_0);\n if((u_0.linkShape_0) == 2)\n {\n\n v_0.kind_0 = 3.0;\n float _S26 = max(2.0 * pairHalf_0, 2.5);\n v_0.radii_0 = vec2(_S26, 0.0);\n v_0.local_0 = vec2(t_2 * _S26, pad_0);\n\n origin_0 = vec2((e_0.xPx_0 + e_0.x2Px_0) * 0.5 - _S26 * 0.5, e_0.baseY_0 - apex_0 * e_0.ySign_0);\n\n legDir_0 = 1.0;\n\n }\n else\n {\n\n\n\n if(linkIsFar_0(pairHalf_0, u_0.canvasWidth_0))\n {\n\n v_0.kind_0 = 1.0;\n float legSweep_2 = legSweepAngle_0(v_0.radii_0.x, e_0.reach_0 + e_0.hw_0);\n\n\n vec2 leg_0 = wideCircleLeg_0(seg_2, u_0.curveSegments_0, legSweep_2);\n float b_0 = leg_0.y;\n\n\n vec2 _S27 = wideCircleHullPoint_0(sin(b_0), sin(b_0 * 0.5), cos(0.5 * wideCircleLegStep_0(seg_2, u_0.curveSegments_0, legSweep_2)), v_0.radii_0.x, pad_0);\n\n v_0.local_0 = _S27;\n\n v_0.local_0[1] = - _S27.y;\n float _S28 = leg_0.x;\n\n if(_S28 > 0.0)\n {\n\n legDir_0 = _S25;\n\n }\n else\n {\n\n legDir_0 = _S24;\n\n }\n\n vec2 _S29 = vec2(legDir_0, e_0.baseY_0);\n\n v_0.legSide_0 = _S28;\n\n origin_0 = _S29;\n\n legDir_0 = _S28;\n\n }\n else\n {\n\n v_0.kind_0 = 0.0;\n float a_0 = t_2 * 3.14159274101257324;\n float halfStep_0 = 3.14159274101257324 / (2.0 * float(u_0.curveSegments_0));\n vec2 _S30 = ellipseHullPoint_0(cos(a_0), sin(a_0), cos(halfStep_0), sin(halfStep_0), v_0.radii_0.x, v_0.radii_0.y, pad_0);\n\n v_0.local_0 = _S30;\n\n v_0.local_0[1] = - _S30.y;\n\n origin_0 = vec2((e_0.xPx_0 + e_0.x2Px_0) * 0.5, e_0.baseY_0);\n\n legDir_0 = 1.0;\n\n }\n\n }\n\n }\n\n v_0.screen_0 = origin_0 + vec2(legDir_0 * v_0.local_0.x, v_0.local_0.y * e_0.ySign_0);\n return v_0;\n}\n\n\nvec2 regionSpanPx_0(uint region_0)\n{\n\n vec4 s_0 = u_0.regionSpan_0[region_0 / 2U];\n\n vec2 _S31;\n if((region_0 % 2U) == 0U)\n {\n\n _S31 = s_0.xy;\n\n }\n else\n {\n\n _S31 = s_0.zw;\n\n }\n\n return _S31;\n}\n\n\nfloat linkFootDir_0(uint feet_1, uint shift_0)\n{\n\n uint d_1 = (feet_1 >> shift_0) & 3U;\n\n float _S32;\n if(d_1 == 1U)\n {\n\n _S32 = 1.0;\n\n }\n else\n {\n\n if(d_1 == 2U)\n {\n\n _S32 = -1.0;\n\n }\n else\n {\n\n _S32 = 0.0;\n\n }\n\n }\n\n return _S32;\n}\n\n\nfloat linkFootLenPx_0(float x_3, float dir_0, float leftPx_0, float rightPx_0, float footPx_1)\n{\n\n float _S33;\n if(dir_0 > 0.0)\n {\n\n _S33 = rightPx_0 - x_3;\n\n }\n else\n {\n\n _S33 = x_3 - leftPx_0;\n\n }\n\n return max(0.0, min(footPx_1, _S33));\n}\n\n\nLinkVertex_0 footCorner_0(LinkInstance_0 inst_1, LinkEnv_0 e_1, uint f_0, uint c_2, out bool present_0)\n{\n\n bool _S34 = f_0 == 0U;\n\n float x_4;\n\n if(_S34)\n {\n\n x_4 = e_1.xPx_0;\n\n }\n else\n {\n\n x_4 = e_1.x2Px_0;\n\n }\n uint _S35 = min(inst_1.x2Region_0, 255U);\n\n vec4 entry_0;\n if(_S34)\n {\n\n entry_0 = u_0.ownEntry_0;\n\n }\n else\n {\n\n entry_0 = u_0.regionTable_0[_S35];\n\n }\n\n vec2 span_0;\n if(_S34)\n {\n\n span_0 = u_0.ownSpan_0.xy;\n\n }\n else\n {\n\n span_0 = regionSpanPx_0(_S35);\n\n }\n float dir_1 = linkFootDir_0(inst_1.feet_0, f_0 * 2U) * float((int(sign((entry_0.w)))));\n float len_0 = linkFootLenPx_0(x_4, dir_1, span_0.x, span_0.y, u_0.footPx_0);\n\n bool _S36;\n if(dir_1 != 0.0)\n {\n\n _S36 = len_0 > 0.0;\n\n }\n else\n {\n\n _S36 = false;\n\n }\n\n if(_S36)\n {\n\n if(_S34)\n {\n\n _S36 = true;\n\n }\n else\n {\n\n _S36 = e_1.placed_0;\n\n }\n\n }\n else\n {\n\n _S36 = false;\n\n }\n\n present_0 = _S36;\n\n float along_0;\n if(c_2 >= 2U)\n {\n\n along_0 = len_0;\n\n }\n else\n {\n\n along_0 = 0.0;\n\n }\n\n float across_0;\n if((c_2 % 2U) == 0U)\n {\n\n across_0 = - e_1.hw_0;\n\n }\n else\n {\n\n across_0 = e_1.hw_0;\n\n }\n LinkVertex_0 v_1;\n v_1.kind_0 = 4.0;\n v_1.radii_0 = vec2(len_0, 0.0);\n v_1.legSide_0 = 1.0;\n v_1.local_0 = vec2(along_0, across_0);\n v_1.screen_0 = vec2(x_4 + dir_1 * along_0, e_1.baseY_0 - e_1.ySign_0 * e_1.strokeHalf_0 + across_0);\n return v_1;\n}\n\n\n\nLinkVertex_0 footBlockStart_0(LinkInstance_0 inst_2, LinkEnv_0 e_2, uint f_1)\n{\n\n LinkVertex_0 tail_0 = curveVertex_0(inst_2, e_2, u_0.curveSegments_0, 1.0);\n if(f_1 == 0U)\n {\n\n return tail_0;\n }\n\n bool first_0;\n LinkVertex_0 last_0 = footCorner_0(inst_2, e_2, 0U, 3U, first_0);\n\n LinkVertex_0 _S37;\n if(first_0)\n {\n\n _S37 = last_0;\n\n }\n else\n {\n\n _S37 = tail_0;\n\n }\n\n return _S37;\n}\n\n\n\nLinkVertex_0 footVertex_0(LinkInstance_0 inst_3, LinkEnv_0 e_3, uint f_2, uint k_1)\n{\n\n LinkVertex_0 start_0 = footBlockStart_0(inst_3, e_3, f_2);\n if(k_1 == 0U)\n {\n\n return start_0;\n }\n\n bool present_1;\n\n uint _S38;\n if(k_1 <= 2U)\n {\n\n _S38 = 0U;\n\n }\n else\n {\n\n _S38 = k_1 - 2U;\n\n }\n\n LinkVertex_0 v_2 = footCorner_0(inst_3, e_3, f_2, _S38, present_1);\n\n LinkVertex_0 _S39;\n if(present_1)\n {\n\n _S39 = v_2;\n\n }\n else\n {\n\n _S39 = start_0;\n\n }\n\n return _S39;\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_local;\n\n\nflat out vec2 v_radii;\n\n\nflat out float v_kind;\n\n\nflat out float v_halfWidthPx;\n\n\nout float v_legSide;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin uint a_x2Region;\n\n\nlayout(location = 3)\nin float a_y;\n\n\nlayout(location = 4)\nin float a_size;\n\n\nlayout(location = 5)\nin uint a_color;\n\n\nlayout(location = 6)\nin uint a_row;\n\n\nlayout(location = 7)\nin uint a_feet;\n\n\nvec4 rampColor_0(float _S40)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S40, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S41, int _S42, float _S43, float _S44, float _S45, int _S46, vec4 _S47, vec4 _S48)\n{\n\n if(_S42 == 0)\n {\n\n return unpackRGBA_0(_S41);\n }\n if(_S41 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_6;\n\n if((_S41 & 2139095040U) == 2139095040U)\n {\n\n if((_S41 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S41 & 2147483648U) != 0U;\n if(_S42 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_6 = 0;\n\n }\n else\n {\n\n scaleType_6 = _S46;\n\n }\n\n return u_0.colorBands_0[scaleType_6];\n }\n\n float _S49;\n\n if(negative_0)\n {\n\n _S49 = 0.0;\n\n }\n else\n {\n\n _S49 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S49, _S45));\n }\n float value_5 = uintBitsToFloat(_S41);\n if(_S42 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_5, _S46, _S47, _S48)];\n }\n if(_S42 == 2)\n {\n\n scaleType_6 = 1;\n\n }\n else\n {\n\n scaleType_6 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_5, _S43, _S44, scaleType_6, 1.0), _S45));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_1;\n vec4 color_1;\n bool overridden_0;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S50, int _S51, vec4 _S52)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_1 = _S50;\n p_0.color_1 = _S52;\n p_0.overridden_0 = false;\n if(_S51 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S51);\n if(_S50 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_3 = rowTablePlaneHeight_0(n_0);\n uint _S53 = rowTableTexelX_0(_S50, n_0);\n\n float u_2 = (float(_S53) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_3);\n uint y_1 = rowTableTexelY_0(_S50, n_0);\n vec4 s_1 = (textureLod((u_rowTable), (vec2(u_2, (float(y_1) + 0.5) / rows_0)), (0.0)));\n if((s_1.w) < 0.5)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_1 = ((byteOf_0(s_1.x)) | ((byteOf_0(s_1.y)) << 8)) | ((byteOf_0(s_1.z)) << 16);\n vec4 c_3 = (textureLod((u_rowTable), (vec2(u_2, (float(y_1 + h_3) + 0.5) / rows_0)), (0.0)));\n bool _S54 = (c_3.w) > 0.0;\n\n p_0.overridden_0 = _S54;\n\n vec4 _S55;\n if(_S54)\n {\n\n _S55 = c_3;\n\n }\n else\n {\n\n _S55 = _S52;\n\n }\n\n p_0.color_1 = _S55;\n return p_0;\n}\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_2;\n vec2 local_1;\n vec2 radii_1;\n float kind_1;\n float halfWidthPx_3;\n float legSide_1;\n};\n\n\nvoid main()\n{\n\n RowPlacement_0 _S56 = rowTableLookup_0(a_row, u_0.rowTableKeys_0, markScaleColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[0], u_0.colorCuts_0[1]));\n\n\n LinkEnv_0 e_4;\n float _S57 = 0.5 * linkStrokeWidthPx_0(a_size, u_0.sizeMode_0, u_0.sizeConstantPx_0, u_0.sizeDomainMin_0, u_0.sizeDomainMax_0, u_0.sizeScaleType_0, u_0.sizeRangeMin_0, u_0.sizeRangeMax_0, u_0.devicePixelRatio_0);\n\n e_4.strokeHalf_0 = _S57;\n\n\n e_4.hw_0 = _S57 + aaHalfPx_0(u_0.devicePixelRatio_0);\n e_4.baseY_0 = linkBaseYPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S56.slot_1, u_0.reverse_0);\n\n float _S58;\n if((u_0.reverse_0) != 0)\n {\n\n _S58 = -1.0;\n\n }\n else\n {\n\n _S58 = 1.0;\n\n }\n\n e_4.ySign_0 = _S58;\n e_4.reach_0 = max(u_0.rowHeight_0 - u_0.insetPx_0, 0.0);\n e_4.xPx_0 = entryPx_0(a_x, u_0.ownEntry_0, u_0.zero_0);\n bool _S59 = a_x2Region < (u_0.regionCount_0);\n\n e_4.placed_0 = _S59;\n if(_S59)\n {\n\n _S58 = entryPx_0(a_x2, u_0.regionTable_0[a_x2Region], u_0.zero_0);\n\n }\n else\n {\n\n _S58 = e_4.xPx_0;\n\n }\n\n e_4.x2Px_0 = _S58;\n\n uint curveVerts_0 = (u_0.curveSegments_0 + 1U) * 2U;\n\n LinkVertex_0 v_3;\n\n if(uint(gl_VertexID) < curveVerts_0)\n {\n\n LinkEnv_0 _S60 = e_4;\n\n uint _S61 = uint(gl_VertexID) / 2U;\n\n if((uint(gl_VertexID) % 2U) == 0U)\n {\n\n _S58 = -1.0;\n\n }\n else\n {\n\n _S58 = 1.0;\n\n }\n\n LinkInstance_0 _S62 = LinkInstance_0(a_x, a_x2, a_x2Region, a_y, a_size, a_color, a_row, a_feet);\n\n v_3 = curveVertex_0(_S62, _S60, _S61, _S58);\n\n }\n else\n {\n uint j_0 = uint(gl_VertexID) - curveVerts_0;\n\n LinkInstance_0 _S63 = LinkInstance_0(a_x, a_x2, a_x2Region, a_y, a_size, a_color, a_row, a_feet);\n\n v_3 = footVertex_0(_S63, e_4, j_0 / 6U, j_0 % 6U);\n\n }\n\n VsOut_0 o_0;\n\n bool _S64;\n if(a_x2Region == 4294967294U)\n {\n\n _S64 = true;\n\n }\n else\n {\n\n _S64 = _S56.hidden_0;\n\n }\n\n vec4 _S65;\n if(_S64)\n {\n\n _S65 = vec4(-2.0, -2.0, 0.0, 1.0);\n\n }\n else\n {\n\n _S65 = vec4(v_3.screen_0.x / u_0.canvasWidth_0 * 2.0 - 1.0, yPxToClipY_0(v_3.screen_0.y, u_0.canvasHeight_0), 0.0, 1.0);\n\n }\n\n o_0.position_0 = _S65;\n\n o_0.color_2 = _S56.color_1;\n o_0.local_1 = v_3.local_0;\n o_0.radii_1 = v_3.radii_0;\n o_0.kind_1 = v_3.kind_0;\n o_0.halfWidthPx_3 = e_4.strokeHalf_0;\n o_0.legSide_1 = v_3.legSide_0;\n VsOut_0 _S66 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S66.color_2;\n\n v_local = _S66.local_1;\n\n v_radii = _S66.radii_1;\n\n v_kind = _S66.kind_1;\n\n v_halfWidthPx = _S66.halfWidthPx_3;\n\n v_legSide = _S66.legSide_1;\n\n return;\n}\n\n"
4
+ export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n float canvasHeight_0;\n float devicePixelRatio_0;\n float rowHeight_0;\n float rowOffsetPx_0;\n int reverse_0;\n float stemPx_0;\n float dashPx_0;\n float gapPx_0;\n float footPx_0;\n uint curveSegments_0;\n float insetPx_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n float valueSymlogConstant_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n int valued_0;\n int linkShape_0;\n int sizeMode_0;\n float sizeConstantPx_0;\n float sizeDomainMin_0;\n float sizeDomainMax_0;\n int sizeScaleType_0;\n float sizeRangeMin_0;\n float sizeRangeMax_0;\n float canvasWidth_0;\n uint regionCount_0;\n float zero_0;\n vec4 ownEntry_0;\n vec4 ownSpan_0;\n vec4 regionTable_0[256];\n vec4 regionSpan_0[128];\n int rowTableKeys_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\n\n\nvec4 unpackRGBA_0(uint c_0)\n{\n\n return vec4(float((c_0 >> 0U) & 255U), float((c_0 >> 8U) & 255U), float((c_0 >> 16U) & 255U), float((c_0 >> 24U) & 255U)) / 255.0;\n}\n\n\nfloat rampMidT_0(float t_0, float mid_0)\n{\n\n float _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\n}\n\n\nint thresholdBand_0(float value_0, int cutCount_0, vec4 cutsLo_1, vec4 cutsHi_1)\n{\n\n int band_0 = 0;\n\n int i_1 = 0;\n\n for(;;)\n {\n\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n\n break;\n }\n\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n\n band_0 = i_1 + 1;\n\n }\n\n i_1 = i_1 + 1;\n\n }\n\n return band_0;\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_1 = 1.0 + x_0;\n\n float _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\n}\n\nfloat symlogTransform_0(float x_1, float c_1)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\n\nfloat normalizeScoreUnclamped_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_1;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_1 > 0.0)\n {\n\n tMax_0 = domainMin_1;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_1;\n\n tMin_0 = domainMin_1;\n\n t_1 = score_0;\n\n }\n\n }\n\n float tRange_0 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n if(t_1 > tMin_0)\n {\n\n tMax_0 = 1.0;\n\n }\n else\n {\n\n tMax_0 = 0.0;\n\n }\n\n return tMax_0;\n }\n return (t_1 - tMin_0) / tRange_0;\n}\n\nfloat normalizeScore_0(float score_1, float domainMin_2, float domainMax_2, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_2, domainMax_2, scaleType_1, symlogConstant_1), 0.0, 1.0);\n}\n\n\nuint rowTableWidth_0(uint keys_0)\n{\n\n return max(min(keys_0, 2048U), 1U);\n}\n\nuint rowTablePlaneHeight_0(uint keys_1)\n{\n\n uint w_0 = rowTableWidth_0(keys_1);\n uint _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\n}\n\n\nuint byteOf_0(float channel_0)\n{\n\n return uint(channel_0 * 255.0 + 0.5);\n}\n\n\nfloat linkStrokeWidthPx_0(float raw_0, int sizeMode_1, float constantPx_0, float domainMin_3, float domainMax_3, int scaleType_2, float rangeMin_0, float rangeMax_0, float dpr_0)\n{\n\n float w_1;\n\n if(sizeMode_1 == 1)\n {\n if(raw_0 > -1.00000001504746622e+29)\n {\n\n w_1 = rangeMin_0 + normalizeScore_0(raw_0, domainMin_3, domainMax_3, scaleType_2, 1.0) * (rangeMax_0 - rangeMin_0);\n\n }\n else\n {\n\n w_1 = rangeMin_0;\n\n }\n\n }\n else\n {\n\n w_1 = constantPx_0;\n\n }\n\n return max(w_1, 1.5 / dpr_0);\n}\n\n\nfloat aaPx_0(float dpr_1)\n{\n\n return 1.0 / max(dpr_1, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_2)\n{\n\n return 0.5 * aaPx_0(dpr_2);\n}\n\n\nfloat rowBandTopPx_0(float rowOffsetPx_1, float rowHeight_1, uint slot_0)\n{\n\n return rowOffsetPx_1 + rowHeight_1 * float(slot_0);\n}\n\n\nfloat linkBaseYPx_0(float rowOffsetPx_2, float rowHeight_2, uint row_0, int reverse_1)\n{\n\n float _S11 = rowBandTopPx_0(rowOffsetPx_2, rowHeight_2, row_0);\n\n float _S12;\n\n if(reverse_1 != 0)\n {\n\n _S12 = 0.0;\n\n }\n else\n {\n\n _S12 = rowHeight_2;\n\n }\n\n return _S11 + _S12;\n}\n\n\nvec2 hpSplitUint_0(uint value_1)\n{\n\n uint lo_0 = value_1 & 4095U;\n\n return vec2(float(value_1 - lo_0), float(lo_0));\n}\n\n\nfloat hpViewportOffsetBp_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n\n\n return max(bpRange_0.x - splitPos_0.x, floorBp_0) + max(bpRange_0.y - splitPos_0.y, floorBp_0);\n}\n\n\nfloat viewRegionPx_0(uint bp_0, vec4 r_0, float hpZero_1)\n{\n\n return r_0.x - hpViewportOffsetBp_0(hpSplitUint_0(bp_0), vec3(r_0.y, r_0.z, 0.0), hpZero_1) * r_0.w;\n}\n\n\nfloat valueToYPxScaled_0(float value_2, float domainMin_4, float domainMax_4, float h_0, int scaleType_3, float symlogConstant_2)\n{\n\n return (1.0 - normalizeScore_0(value_2, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_0;\n}\n\n\nfloat insetValueYPx_0(float value_3, float domainMin_5, float domainMax_5, float h_1, int scaleType_4, float insetPx_1, float symlogConstant_3)\n{\n\n float _S13 = min(insetPx_1, h_1 * 0.5);\n return _S13 + valueToYPxScaled_0(value_3, domainMin_5, domainMax_5, h_1 - 2.0 * _S13, scaleType_4, symlogConstant_3);\n}\n\n\nfloat linkValuePx_0(float value_4, float domainMin_6, float domainMax_6, float h_2, int scaleType_5, float insetPx_2, float symlogConstant_4)\n{\n\n return h_2 - insetValueYPx_0(value_4, domainMin_6, domainMax_6, h_2, scaleType_5, insetPx_2, symlogConstant_4);\n}\n\n\n\n\nfloat linkApexPx_0(float halfWidthPx_0, float reachPx_0, float strokeHalfPx_0, int linkShape_1, int valued_1, float valuePx_0)\n{\n\n if(valued_1 != 0)\n {\n\n return valuePx_0;\n }\n\n if(linkShape_1 == 2)\n {\n\n return 0.0;\n }\n\n if(linkShape_1 == 1)\n {\n\n return halfWidthPx_0;\n }\n\n return min(halfWidthPx_0, max(reachPx_0 - strokeHalfPx_0, 0.0));\n}\n\n\nint linkApexHeld_0(int valued_2, float value_5, float domainMax_7)\n{\n\n bool _S14;\n if(valued_2 != 0)\n {\n\n _S14 = value_5 < domainMax_7;\n\n }\n else\n {\n\n _S14 = false;\n\n }\n\n int _S15;\n\n if(_S14)\n {\n\n _S15 = 1;\n\n }\n else\n {\n\n _S15 = 0;\n\n }\n\n return _S15;\n}\n\n\nbool linkIsFar_0(float halfWidthPx_1, float screenWidthPx_0)\n{\n\n return (2.0 * halfWidthPx_1) > (3.0 * screenWidthPx_0);\n}\n\n\nvec2 linkRadiiPx_0(float halfWidthPx_2, float apexPx_0, float screenWidthPx_1, int held_0)\n{\n\n bool _S16;\n\n if(linkIsFar_0(halfWidthPx_2, screenWidthPx_1))\n {\n\n if(held_0 == 0)\n {\n\n _S16 = true;\n\n }\n else\n {\n\n _S16 = apexPx_0 >= (0.25 * halfWidthPx_2);\n\n }\n\n }\n else\n {\n\n _S16 = false;\n\n }\n\n if(_S16)\n {\n return vec2(halfWidthPx_2, halfWidthPx_2);\n }\n return vec2(halfWidthPx_2, apexPx_0);\n}\n\n\nfloat farDomeParam_0(float dPx_0, float rxPx_0)\n{\n\n return sqrt(clamp(dPx_0 / (2.0 * max(rxPx_0, 9.99999997475242708e-07)), 0.0, 0.8399999737739563));\n}\n\n\nvec2 farDomeHullPoint_0(float u_2, float stepU_0, float rxPx_1, float ryPx_0, float padPx_0)\n{\n\n float _S17 = max(ryPx_0, 9.99999997475242708e-07);\n float _S18 = max(u_2, 0.5 * stepU_0);\n float nx_0 = - _S17 * (1.0 - 2.0 * _S18 * _S18);\n float _S19 = 2.0 * rxPx_1;\n\n float ny_0 = _S19 * _S18 * sqrt(1.0 - _S18 * _S18);\n float _S20 = max(nx_0 * nx_0 + ny_0 * ny_0, 9.99999968265522539e-21);\n float reach_0 = padPx_0 + float((int(sign((padPx_0))))) * 0.5 * rxPx_1 * stepU_0 * stepU_0;\n float _S21 = sqrt(_S20);\n\n float along_0 = reach_0 / _S21;\n float d_0 = _S19 * u_2 * u_2;\n float _S22 = u_2 * u_2;\n\n float h_3 = 2.0 * _S17 * u_2 * sqrt(1.0 - _S22);\n\n bool folded_0;\n\n if(padPx_0 < 0.0)\n {\n\n folded_0 = _S22 < 0.5;\n\n }\n else\n {\n\n folded_0 = false;\n\n }\n if(folded_0)\n {\n\n folded_0 = (_S20 * _S21) < (-2.0 * reach_0 * rxPx_1 * _S17);\n\n }\n else\n {\n\n folded_0 = false;\n\n }\n\n float _S23;\n if(folded_0)\n {\n\n if(u_2 > 0.0)\n {\n\n _S23 = d_0 - reach_0;\n\n }\n else\n {\n\n _S23 = d_0;\n\n }\n\n }\n else\n {\n\n _S23 = d_0 + nx_0 * along_0;\n\n }\n\n float _S24;\n if(folded_0)\n {\n\n _S24 = h_3 + reach_0;\n\n }\n else\n {\n\n _S24 = h_3 + ny_0 * along_0;\n\n }\n\n return vec2(_S23, _S24);\n}\n\n\nfloat legSweepAngle_0(float radiusPx_0, float yReachPx_0)\n{\n\n return asin(clamp(yReachPx_0 / max(radiusPx_0, 9.99999997475242708e-07), 0.0, 1.0));\n}\n\n\nvec2 wideCircleLeg_0(uint seg_0, uint segments_0, float legSweep_0)\n{\n\n uint half_0 = segments_0 / 2U;\n if(seg_0 <= half_0)\n {\n\n return vec2(1.0, float(seg_0) / float(half_0) * legSweep_0);\n }\n return vec2(-1.0, float(segments_0 - seg_0) / float(segments_0 - half_0 - 1U) * legSweep_0);\n}\n\n\n\n\nfloat wideCircleLegStep_0(uint seg_1, uint segments_1, float legSweep_1)\n{\n\n uint half_1 = segments_1 / 2U;\n\n uint _S25;\n if(seg_1 <= half_1)\n {\n\n _S25 = half_1;\n\n }\n else\n {\n\n _S25 = segments_1 - half_1 - 1U;\n\n }\n\n return legSweep_1 / float(_S25);\n}\n\n\nvec2 wideCircleHullPoint_0(float sinB_0, float sinHalfB_0, float cosHalf_0, float radiusPx_1, float padPx_1)\n{\n\n float sec_0;\n if(padPx_1 > 0.0)\n {\n\n sec_0 = 1.0 / max(cosHalf_0, 9.99999997475242708e-07);\n\n }\n else\n {\n\n sec_0 = 1.0;\n\n }\n float grow_0 = radiusPx_1 * (sec_0 - 1.0) + sec_0 * padPx_1;\n float sh2_0 = sinHalfB_0 * sinHalfB_0;\n return vec2(grow_0 * (1.0 - 2.0 * sh2_0) - 2.0 * radiusPx_1 * sh2_0, (radiusPx_1 + grow_0) * sinB_0);\n}\n\n\nvec2 ellipseHullPoint_0(float cosA_0, float sinA_0, float cosHalf_1, float sinHalf_0, float rx_0, float ry_0, float padPx_2)\n{\n float px_0 = cosA_0 * rx_0;\n float py_0 = sinA_0 * ry_0;\n if(padPx_2 <= 0.0)\n {\n\n float d_1 = - padPx_2;\n float gx_0 = ry_0 * cosA_0;\n float gy_0 = rx_0 * sinA_0;\n float glen_0 = sqrt(gx_0 * gx_0 + gy_0 * gy_0);\n bool acrossX_0 = (ry_0 * glen_0) < (d_1 * rx_0);\n bool acrossY_0 = (rx_0 * glen_0) < (d_1 * ry_0);\n\n bool _S26;\n if(acrossX_0)\n {\n\n _S26 = acrossY_0;\n\n }\n else\n {\n\n _S26 = false;\n\n }\n\n if(_S26)\n {\n\n return vec2(0.0, 0.0);\n }\n\n if(acrossX_0)\n {\n\n float _S27 = ry_0 * ry_0;\n return vec2(float((int(sign((cosA_0))))) * sqrt(max(_S27 - d_1 * d_1, 0.0) * max(rx_0 * rx_0 - _S27, 0.0)) / max(ry_0, 9.99999997475242708e-07), 0.0);\n }\n if(acrossY_0)\n {\n\n float _S28 = rx_0 * rx_0;\n return vec2(0.0, float((int(sign((sinA_0))))) * sqrt(max(_S28 - d_1 * d_1, 0.0) * max(ry_0 * ry_0 - _S28, 0.0)) / max(rx_0, 9.99999997475242708e-07));\n }\n float k_0 = d_1 / max(glen_0, 9.99999997475242708e-07);\n return vec2(px_0 - gx_0 * k_0, py_0 - gy_0 * k_0);\n }\n float _S29 = cosA_0 * cosHalf_1;\n\n float _S30 = sinA_0 * sinHalf_0;\n\n float ax_0 = ry_0 * (_S29 + _S30);\n float _S31 = sinA_0 * cosHalf_1;\n\n float _S32 = cosA_0 * sinHalf_0;\n\n float ay_0 = rx_0 * (_S31 - _S32);\n float bx_0 = ry_0 * (_S29 - _S30);\n float by_0 = rx_0 * (_S31 + _S32);\n float _S33 = max(sqrt(ax_0 * ax_0 + ay_0 * ay_0), 9.99999968265522539e-21);\n float _S34 = max(sqrt(bx_0 * bx_0 + by_0 * by_0), 9.99999968265522539e-21);\n float nx_1 = ax_0 / _S33 + bx_0 / _S34;\n float ny_1 = ay_0 / _S33 + by_0 / _S34;\n float m_0 = 2.0 * padPx_2 / max(nx_1 * nx_1 + ny_1 * ny_1, 0.00019999999494758);\n return vec2(px_0 / cosHalf_1 + nx_1 * m_0, py_0 / cosHalf_1 + ny_1 * m_0);\n}\n\n\nstruct LinkVertex_0\n{\n vec2 screen_0;\n vec2 local_0;\n vec2 radii_0;\n float kind_0;\n float legSide_0;\n};\n\n\nstruct LinkInstance_0\n{\n uint x_2;\n uint x2_0;\n uint x2Region_0;\n float y_0;\n float size_0;\n uint color_0;\n uint row_1;\n uint feet_0;\n};\n\n\nstruct LinkEnv_0\n{\n float strokeHalf_0;\n float hw_0;\n float baseY_0;\n float ySign_0;\n float reach_1;\n float xPx_0;\n float x2Px_0;\n bool placed_0;\n};\n\n\nLinkVertex_0 curveVertex_0(LinkInstance_0 inst_0, LinkEnv_0 e_0, uint seg_2, float side_0)\n{\n\n float _S35 = float(seg_2);\n\n float t_2 = _S35 / float(u_0.curveSegments_0);\n\n float pad_0 = side_0 * e_0.hw_0;\n\n\n LinkVertex_0 v_0;\n v_0.legSide_0 = 1.0;\n\n float legDir_0;\n\n vec2 origin_0;\n if(!e_0.placed_0)\n {\n\n v_0.kind_0 = 2.0;\n v_0.radii_0 = vec2(0.0, u_0.stemPx_0);\n\n\n v_0.local_0 = vec2(pad_0, - t_2 * (u_0.stemPx_0 + e_0.hw_0));\n\n origin_0 = vec2(e_0.xPx_0, e_0.baseY_0);\n\n legDir_0 = 1.0;\n\n }\n else\n {\n\n float pairHalf_0 = abs(e_0.x2Px_0 - e_0.xPx_0) * 0.5;\n\n\n float apex_0 = linkApexPx_0(pairHalf_0, e_0.reach_1, e_0.strokeHalf_0, u_0.linkShape_0, u_0.valued_0, linkValuePx_0(inst_0.y_0, u_0.domainMin_0, u_0.domainMax_0, u_0.rowHeight_0, u_0.valueScaleType_0, u_0.insetPx_0, u_0.valueSymlogConstant_0));\n v_0.radii_0 = linkRadiiPx_0(pairHalf_0, apex_0, u_0.canvasWidth_0, linkApexHeld_0(u_0.valued_0, inst_0.y_0, u_0.domainMax_0));\n\n float _S36 = min(e_0.xPx_0, e_0.x2Px_0);\n\n float _S37 = max(e_0.xPx_0, e_0.x2Px_0);\n if((u_0.linkShape_0) == 2)\n {\n\n v_0.kind_0 = 3.0;\n float _S38 = max(2.0 * pairHalf_0, 2.5);\n v_0.radii_0 = vec2(_S38, 0.0);\n v_0.local_0 = vec2(t_2 * _S38, pad_0);\n\n origin_0 = vec2((e_0.xPx_0 + e_0.x2Px_0) * 0.5 - _S38 * 0.5, e_0.baseY_0 - apex_0 * e_0.ySign_0);\n\n legDir_0 = 1.0;\n\n }\n else\n {\n\n bool _S39;\n\n if(linkIsFar_0(pairHalf_0, u_0.canvasWidth_0))\n {\n\n _S39 = (v_0.radii_0.y) < (v_0.radii_0.x);\n\n }\n else\n {\n\n _S39 = false;\n\n }\n\n if(_S39)\n {\n\n v_0.kind_0 = 1.0;\n float rx_1 = v_0.radii_0.x;\n bool fromRight_0 = (u_0.canvasWidth_0 * 0.5 - _S36) > rx_1;\n if(fromRight_0)\n {\n\n legDir_0 = _S37;\n\n }\n else\n {\n\n legDir_0 = _S36;\n\n }\n float margin_0 = e_0.hw_0 + 2.0;\n\n float nearD_0;\n if(fromRight_0)\n {\n\n nearD_0 = legDir_0 - u_0.canvasWidth_0 - margin_0;\n\n }\n else\n {\n\n nearD_0 = - margin_0 - legDir_0;\n\n }\n\n float farD_0;\n if(fromRight_0)\n {\n\n farD_0 = legDir_0 + margin_0;\n\n }\n else\n {\n\n farD_0 = u_0.canvasWidth_0 + margin_0 - legDir_0;\n\n }\n float u0_0 = farDomeParam_0(nearD_0, rx_1);\n float step_0 = (max(farDomeParam_0(farD_0, rx_1), u0_0) - u0_0) / float(u_0.curveSegments_0);\n v_0.local_0 = - farDomeHullPoint_0(u0_0 + _S35 * step_0, step_0, rx_1, v_0.radii_0.y, pad_0);\n vec2 _S40 = vec2(legDir_0, e_0.baseY_0);\n if(fromRight_0)\n {\n\n legDir_0 = 1.0;\n\n }\n else\n {\n\n legDir_0 = -1.0;\n\n }\n\n origin_0 = _S40;\n\n }\n else\n {\n\n if(linkIsFar_0(pairHalf_0, u_0.canvasWidth_0))\n {\n\n v_0.kind_0 = 1.0;\n float legSweep_2 = legSweepAngle_0(v_0.radii_0.x, e_0.reach_1 + e_0.hw_0);\n\n\n vec2 leg_0 = wideCircleLeg_0(seg_2, u_0.curveSegments_0, legSweep_2);\n float b_0 = leg_0.y;\n\n\n vec2 _S41 = wideCircleHullPoint_0(sin(b_0), sin(b_0 * 0.5), cos(0.5 * wideCircleLegStep_0(seg_2, u_0.curveSegments_0, legSweep_2)), v_0.radii_0.x, pad_0);\n\n v_0.local_0 = _S41;\n\n v_0.local_0[1] = - _S41.y;\n float _S42 = leg_0.x;\n\n if(_S42 > 0.0)\n {\n\n legDir_0 = _S37;\n\n }\n else\n {\n\n legDir_0 = _S36;\n\n }\n\n vec2 _S43 = vec2(legDir_0, e_0.baseY_0);\n\n v_0.legSide_0 = _S42;\n\n origin_0 = _S43;\n\n legDir_0 = _S42;\n\n }\n else\n {\n\n v_0.kind_0 = 0.0;\n float a_0 = t_2 * 3.14159274101257324;\n float halfStep_0 = 3.14159274101257324 / (2.0 * float(u_0.curveSegments_0));\n vec2 _S44 = ellipseHullPoint_0(cos(a_0), sin(a_0), cos(halfStep_0), sin(halfStep_0), v_0.radii_0.x, v_0.radii_0.y, pad_0);\n\n v_0.local_0 = _S44;\n\n v_0.local_0[1] = - _S44.y;\n\n origin_0 = vec2((e_0.xPx_0 + e_0.x2Px_0) * 0.5, e_0.baseY_0);\n\n legDir_0 = 1.0;\n\n }\n\n }\n\n }\n\n }\n\n v_0.screen_0 = origin_0 + vec2(legDir_0 * v_0.local_0.x, v_0.local_0.y * e_0.ySign_0);\n return v_0;\n}\n\n\nvec2 regionSpanPx_0(uint region_0)\n{\n\n vec4 s_0 = u_0.regionSpan_0[region_0 / 2U];\n\n vec2 _S45;\n if((region_0 % 2U) == 0U)\n {\n\n _S45 = s_0.xy;\n\n }\n else\n {\n\n _S45 = s_0.zw;\n\n }\n\n return _S45;\n}\n\n\nfloat linkFootDir_0(uint feet_1, uint shift_0)\n{\n\n uint d_2 = (feet_1 >> shift_0) & 3U;\n\n float _S46;\n if(d_2 == 1U)\n {\n\n _S46 = 1.0;\n\n }\n else\n {\n\n if(d_2 == 2U)\n {\n\n _S46 = -1.0;\n\n }\n else\n {\n\n _S46 = 0.0;\n\n }\n\n }\n\n return _S46;\n}\n\n\nfloat linkFootLenPx_0(float x_3, float dir_0, float leftPx_0, float rightPx_0, float footPx_1)\n{\n\n float _S47;\n if(dir_0 > 0.0)\n {\n\n _S47 = rightPx_0 - x_3;\n\n }\n else\n {\n\n _S47 = x_3 - leftPx_0;\n\n }\n\n return max(0.0, min(footPx_1, _S47));\n}\n\n\nLinkVertex_0 footCorner_0(LinkInstance_0 inst_1, LinkEnv_0 e_1, uint f_0, uint c_2, out bool present_0)\n{\n\n bool _S48 = f_0 == 0U;\n\n float x_4;\n\n if(_S48)\n {\n\n x_4 = e_1.xPx_0;\n\n }\n else\n {\n\n x_4 = e_1.x2Px_0;\n\n }\n uint _S49 = min(inst_1.x2Region_0, 255U);\n\n vec4 entry_0;\n if(_S48)\n {\n\n entry_0 = u_0.ownEntry_0;\n\n }\n else\n {\n\n entry_0 = u_0.regionTable_0[_S49];\n\n }\n\n vec2 span_0;\n if(_S48)\n {\n\n span_0 = u_0.ownSpan_0.xy;\n\n }\n else\n {\n\n span_0 = regionSpanPx_0(_S49);\n\n }\n float dir_1 = linkFootDir_0(inst_1.feet_0, f_0 * 2U) * float((int(sign((entry_0.w)))));\n float len_0 = linkFootLenPx_0(x_4, dir_1, span_0.x, span_0.y, u_0.footPx_0);\n\n bool _S50;\n if(dir_1 != 0.0)\n {\n\n _S50 = len_0 > 0.0;\n\n }\n else\n {\n\n _S50 = false;\n\n }\n\n if(_S50)\n {\n\n if(_S48)\n {\n\n _S50 = true;\n\n }\n else\n {\n\n _S50 = e_1.placed_0;\n\n }\n\n }\n else\n {\n\n _S50 = false;\n\n }\n\n present_0 = _S50;\n\n float along_1;\n if(c_2 >= 2U)\n {\n\n along_1 = len_0;\n\n }\n else\n {\n\n along_1 = 0.0;\n\n }\n\n float across_0;\n if((c_2 % 2U) == 0U)\n {\n\n across_0 = - e_1.hw_0;\n\n }\n else\n {\n\n across_0 = e_1.hw_0;\n\n }\n LinkVertex_0 v_1;\n v_1.kind_0 = 4.0;\n v_1.radii_0 = vec2(len_0, 0.0);\n v_1.legSide_0 = 1.0;\n v_1.local_0 = vec2(along_1, across_0);\n v_1.screen_0 = vec2(x_4 + dir_1 * along_1, e_1.baseY_0 - e_1.ySign_0 * e_1.strokeHalf_0 + across_0);\n return v_1;\n}\n\n\n\nLinkVertex_0 footBlockStart_0(LinkInstance_0 inst_2, LinkEnv_0 e_2, uint f_1)\n{\n\n LinkVertex_0 tail_0 = curveVertex_0(inst_2, e_2, u_0.curveSegments_0, 1.0);\n if(f_1 == 0U)\n {\n\n return tail_0;\n }\n\n bool first_0;\n LinkVertex_0 last_0 = footCorner_0(inst_2, e_2, 0U, 3U, first_0);\n\n LinkVertex_0 _S51;\n if(first_0)\n {\n\n _S51 = last_0;\n\n }\n else\n {\n\n _S51 = tail_0;\n\n }\n\n return _S51;\n}\n\n\n\nLinkVertex_0 footVertex_0(LinkInstance_0 inst_3, LinkEnv_0 e_3, uint f_2, uint k_1)\n{\n\n LinkVertex_0 start_0 = footBlockStart_0(inst_3, e_3, f_2);\n if(k_1 == 0U)\n {\n\n return start_0;\n }\n\n bool present_1;\n\n uint _S52;\n if(k_1 <= 2U)\n {\n\n _S52 = 0U;\n\n }\n else\n {\n\n _S52 = k_1 - 2U;\n\n }\n\n LinkVertex_0 v_2 = footCorner_0(inst_3, e_3, f_2, _S52, present_1);\n\n LinkVertex_0 _S53;\n if(present_1)\n {\n\n _S53 = v_2;\n\n }\n else\n {\n\n _S53 = start_0;\n\n }\n\n return _S53;\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_local;\n\n\nflat out vec2 v_radii;\n\n\nflat out float v_kind;\n\n\nflat out float v_halfWidthPx;\n\n\nout float v_legSide;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin uint a_x2Region;\n\n\nlayout(location = 3)\nin float a_y;\n\n\nlayout(location = 4)\nin float a_size;\n\n\nlayout(location = 5)\nin uint a_color;\n\n\nlayout(location = 6)\nin uint a_row;\n\n\nlayout(location = 7)\nin uint a_feet;\n\n\nvec4 rampColor_0(float _S54)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S54, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S55, int _S56, float _S57, float _S58, float _S59, int _S60, vec4 _S61, vec4 _S62)\n{\n\n if(_S56 == 0)\n {\n\n return unpackRGBA_0(_S55);\n }\n if(_S55 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_6;\n\n if((_S55 & 2139095040U) == 2139095040U)\n {\n\n if((_S55 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S55 & 2147483648U) != 0U;\n if(_S56 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_6 = 0;\n\n }\n else\n {\n\n scaleType_6 = _S60;\n\n }\n\n return u_0.colorBands_0[scaleType_6];\n }\n\n float _S63;\n\n if(negative_0)\n {\n\n _S63 = 0.0;\n\n }\n else\n {\n\n _S63 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S63, _S59));\n }\n float value_6 = uintBitsToFloat(_S55);\n if(_S56 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_6, _S60, _S61, _S62)];\n }\n if(_S56 == 2)\n {\n\n scaleType_6 = 1;\n\n }\n else\n {\n\n scaleType_6 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_6, _S57, _S58, scaleType_6, 1.0), _S59));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_1;\n vec4 color_1;\n bool overridden_0;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S64, int _S65, vec4 _S66)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_1 = _S64;\n p_0.color_1 = _S66;\n p_0.overridden_0 = false;\n if(_S65 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S65);\n if(_S64 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_4 = rowTablePlaneHeight_0(n_0);\n uint _S67 = rowTableTexelX_0(_S64, n_0);\n\n float u_3 = (float(_S67) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_4);\n uint y_1 = rowTableTexelY_0(_S64, n_0);\n vec4 s_1 = (textureLod((u_rowTable), (vec2(u_3, (float(y_1) + 0.5) / rows_0)), (0.0)));\n if((s_1.w) < 0.5)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_1 = ((byteOf_0(s_1.x)) | ((byteOf_0(s_1.y)) << 8)) | ((byteOf_0(s_1.z)) << 16);\n vec4 c_3 = (textureLod((u_rowTable), (vec2(u_3, (float(y_1 + h_4) + 0.5) / rows_0)), (0.0)));\n bool _S68 = (c_3.w) > 0.0;\n\n p_0.overridden_0 = _S68;\n\n vec4 _S69;\n if(_S68)\n {\n\n _S69 = c_3;\n\n }\n else\n {\n\n _S69 = _S66;\n\n }\n\n p_0.color_1 = _S69;\n return p_0;\n}\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_2;\n vec2 local_1;\n vec2 radii_1;\n float kind_1;\n float halfWidthPx_3;\n float legSide_1;\n};\n\n\nvoid main()\n{\n\n RowPlacement_0 _S70 = rowTableLookup_0(a_row, u_0.rowTableKeys_0, markScaleColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[0], u_0.colorCuts_0[1]));\n\n\n LinkEnv_0 e_4;\n float _S71 = 0.5 * linkStrokeWidthPx_0(a_size, u_0.sizeMode_0, u_0.sizeConstantPx_0, u_0.sizeDomainMin_0, u_0.sizeDomainMax_0, u_0.sizeScaleType_0, u_0.sizeRangeMin_0, u_0.sizeRangeMax_0, u_0.devicePixelRatio_0);\n\n e_4.strokeHalf_0 = _S71;\n\n\n e_4.hw_0 = _S71 + aaHalfPx_0(u_0.devicePixelRatio_0);\n e_4.baseY_0 = linkBaseYPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S70.slot_1, u_0.reverse_0);\n\n float _S72;\n if((u_0.reverse_0) != 0)\n {\n\n _S72 = -1.0;\n\n }\n else\n {\n\n _S72 = 1.0;\n\n }\n\n e_4.ySign_0 = _S72;\n e_4.reach_1 = max(u_0.rowHeight_0 - u_0.insetPx_0, 0.0);\n e_4.xPx_0 = viewRegionPx_0(a_x, u_0.ownEntry_0, u_0.zero_0);\n bool _S73 = a_x2Region < (u_0.regionCount_0);\n\n e_4.placed_0 = _S73;\n if(_S73)\n {\n\n _S72 = viewRegionPx_0(a_x2, u_0.regionTable_0[a_x2Region], u_0.zero_0);\n\n }\n else\n {\n\n _S72 = e_4.xPx_0;\n\n }\n\n e_4.x2Px_0 = _S72;\n\n uint curveVerts_0 = (u_0.curveSegments_0 + 1U) * 2U;\n\n LinkVertex_0 v_3;\n\n if(uint(gl_VertexID) < curveVerts_0)\n {\n\n LinkEnv_0 _S74 = e_4;\n\n uint _S75 = uint(gl_VertexID) / 2U;\n\n if((uint(gl_VertexID) % 2U) == 0U)\n {\n\n _S72 = -1.0;\n\n }\n else\n {\n\n _S72 = 1.0;\n\n }\n\n LinkInstance_0 _S76 = LinkInstance_0(a_x, a_x2, a_x2Region, a_y, a_size, a_color, a_row, a_feet);\n\n v_3 = curveVertex_0(_S76, _S74, _S75, _S72);\n\n }\n else\n {\n uint j_0 = uint(gl_VertexID) - curveVerts_0;\n\n LinkInstance_0 _S77 = LinkInstance_0(a_x, a_x2, a_x2Region, a_y, a_size, a_color, a_row, a_feet);\n\n v_3 = footVertex_0(_S77, e_4, j_0 / 6U, j_0 % 6U);\n\n }\n\n VsOut_0 o_0;\n\n bool _S78;\n if(a_x2Region == 4294967294U)\n {\n\n _S78 = true;\n\n }\n else\n {\n\n _S78 = _S70.hidden_0;\n\n }\n\n vec4 _S79;\n if(_S78)\n {\n\n _S79 = vec4(-2.0, -2.0, 0.0, 1.0);\n\n }\n else\n {\n\n _S79 = vec4(v_3.screen_0.x / u_0.canvasWidth_0 * 2.0 - 1.0, yPxToClipY_0(v_3.screen_0.y, u_0.canvasHeight_0), 0.0, 1.0);\n\n }\n\n o_0.position_0 = _S79;\n\n o_0.color_2 = _S70.color_1;\n o_0.local_1 = v_3.local_0;\n o_0.radii_1 = v_3.radii_0;\n o_0.kind_1 = v_3.kind_0;\n o_0.halfWidthPx_3 = e_4.strokeHalf_0;\n o_0.legSide_1 = v_3.legSide_0;\n VsOut_0 _S80 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S80.color_2;\n\n v_local = _S80.local_1;\n\n v_radii = _S80.radii_1;\n\n v_kind = _S80.kind_1;\n\n v_halfWidthPx = _S80.halfWidthPx_3;\n\n v_legSide = _S80.legSide_1;\n\n return;\n}\n\n"
5
5
 
6
- export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n float canvasHeight_0;\n float devicePixelRatio_0;\n float rowHeight_0;\n float rowOffsetPx_0;\n int reverse_0;\n float stemPx_0;\n float dashPx_0;\n float gapPx_0;\n float footPx_0;\n uint curveSegments_0;\n float insetPx_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n float valueSymlogConstant_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n int valued_0;\n int linkShape_0;\n int sizeMode_0;\n float sizeConstantPx_0;\n float sizeDomainMin_0;\n float sizeDomainMax_0;\n int sizeScaleType_0;\n float sizeRangeMin_0;\n float sizeRangeMax_0;\n float canvasWidth_0;\n uint regionCount_0;\n float zero_0;\n vec4 ownEntry_0;\n vec4 ownSpan_0;\n vec4 regionTable_0[256];\n vec4 regionSpan_0[128];\n int rowTableKeys_0;\n}u_0;\n\nfloat distToWideCirclePx_0(float x_0, float y_0, float r_0)\n{\n\n float rk_0 = 2.0 * x_0 + (x_0 * x_0 + y_0 * y_0) / r_0;\n return abs(rk_0 / (sqrt(max(1.0 + rk_0 / r_0, 0.0)) + 1.0));\n}\n\nfloat distToWideCircle_0(vec2 legLocal_0, float r_1)\n{\n\n return distToWideCirclePx_0(legLocal_0.x, legLocal_0.y, r_1);\n}\n\n\nfloat nearCircleDistancePx_0(float qx_0, float qy_0, float ax_0, float ay_0)\n{\n\n float kx_0 = qx_0 / ax_0;\n float ky_0 = qy_0 / ay_0;\n float k_0 = sqrt(kx_0 * kx_0 + ky_0 * ky_0);\n float gx_0 = qx_0 / (ax_0 * ax_0);\n float gy_0 = qy_0 / (ay_0 * ay_0);\n return abs(k_0 * (k_0 - 1.0) / max(sqrt(gx_0 * gx_0 + gy_0 * gy_0), 9.99999968265522539e-21));\n}\n\n\nfloat sdEllipse_0(vec2 p_0, vec2 radii_0)\n{\n\n vec2 q_0 = abs(p_0);\n\n vec2 ab_0;\n\n vec2 q_1;\n\n if((q_0.x) > (q_0.y))\n {\n\n vec2 _S1 = q_0.yx;\n\n ab_0 = radii_0.yx;\n\n q_1 = _S1;\n\n }\n else\n {\n\n ab_0 = radii_0;\n\n q_1 = q_0;\n\n }\n\n if((dot(ab_0, ab_0)) <= 0.0)\n {\n\n return length(q_1);\n }\n\n float _S2 = ab_0.y;\n\n float _S3 = ab_0.x;\n\n float l_0 = _S2 * _S2 - _S3 * _S3;\n if((abs(l_0)) < (0.05000000074505806 * _S2 * _S2))\n {\n\n return nearCircleDistancePx_0(q_1.x, q_1.y, _S3, _S2);\n }\n float m_0 = _S3 * q_1.x / l_0;\n\n float m2_0 = m_0 * m_0;\n float n_0 = _S2 * q_1.y / l_0;\n\n float n2_0 = n_0 * n_0;\n float c_0 = (m2_0 + n2_0 - 1.0) / 3.0;\n float c3_0 = c_0 * c_0 * c_0;\n float _S4 = m2_0 * n2_0;\n\n float d_0 = c3_0 + _S4;\n float g_0 = m_0 + m_0 * n2_0;\n\n float co_0;\n\n if(d_0 < 0.0)\n {\n\n float h_0 = acos(clamp((c3_0 + _S4 * 2.0) / c3_0, -1.0, 1.0)) / 3.0;\n float s_0 = cos(h_0);\n float t_0 = sin(h_0) * sqrt(3.0);\n float _S5 = - c_0;\n\n float rx_0 = sqrt(max(_S5 * (s_0 + t_0 + 2.0) + m2_0, 0.0));\n float ry_0 = sqrt(max(_S5 * (s_0 - t_0 + 2.0) + m2_0, 0.0));\n\n co_0 = (ry_0 + float((int(sign((l_0))))) * rx_0 + abs(g_0) / max(rx_0 * ry_0, 9.99999968265522539e-21) - m_0) / 2.0;\n\n }\n else\n {\n\n float w_0 = c3_0 + _S4 * 2.0 + 2.0 * m_0 * n_0 * sqrt(d_0);\n float aw_0 = abs(w_0);\n float _S6 = float((int(sign((w_0)))));\n\n float s_1 = _S6 * pow(aw_0, 0.3333333432674408);\n if(aw_0 > 0.0)\n {\n\n co_0 = _S6 * pow(c3_0 * (c3_0 / aw_0), 0.3333333432674408);\n\n }\n else\n {\n\n co_0 = 0.0;\n\n }\n float rx_1 = - s_1 - co_0 - c_0 * 4.0 + 2.0 * m2_0;\n float ry_1 = (s_1 - co_0) * sqrt(3.0);\n float rm_0 = sqrt(rx_1 * rx_1 + ry_1 * ry_1);\n\n co_0 = (ry_1 / sqrt(max(rm_0 - rx_1, 9.99999968265522539e-21)) + 2.0 * g_0 / max(rm_0, 9.99999968265522539e-21) - m_0) / 2.0;\n\n }\n\n float co_1 = clamp(co_0, -1.0, 1.0);\n\n return length(ab_0 * vec2(co_1, sqrt(max(1.0 - co_1 * co_1, 0.0))) - q_1);\n}\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 local_0;\n vec2 radii_1;\n float kind_0;\n float halfWidthPx_0;\n float legSide_0;\n};\n\n\nfloat linkDistance_0(VsOut_0 i_0)\n{\n\n if((i_0.kind_0) >= 2.5)\n {\n\n float _S7 = i_0.local_0.x;\n return length(vec2(_S7 - clamp(_S7, 0.0, i_0.radii_1.x), i_0.local_0.y));\n }\n if((i_0.kind_0) >= 1.5)\n {\n\n float _S8 = i_0.local_0.y;\n return length(vec2(i_0.local_0.x, _S8 - clamp(_S8, - i_0.radii_1.y, 0.0)));\n }\n if((i_0.kind_0) >= 0.5)\n {\n\n return distToWideCircle_0(i_0.local_0, i_0.radii_1.x);\n }\n\n return sdEllipse_0(i_0.local_0, i_0.radii_1);\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaRamp_0(float signedInk_0, float widthPx_0)\n{\n\n return clamp(signedInk_0 / widthPx_0 + 0.5, 0.0, 1.0);\n}\n\n\nfloat edgeCoverage_0(float signedInkCssPx_0, float dpr_1)\n{\n\n return aaRamp_0(signedInkCssPx_0, aaPx_0(dpr_1));\n}\n\n\nfloat linkDashAlong_0(VsOut_0 i_1)\n{\n\n if((i_1.kind_0) >= 3.5)\n {\n\n return -1.0;\n }\n\n if((i_1.kind_0) >= 2.5)\n {\n\n return i_1.local_0.x;\n }\n\n if((i_1.kind_0) >= 1.5)\n {\n\n return - i_1.local_0.y;\n }\n\n return -1.0;\n}\n\n\nfloat dashCoverageAt_0(float coord_0, float dashPx_1, float gapPx_1, float aaPx_1)\n{\n float period_0 = dashPx_1 + gapPx_1;\n float shifted_0 = coord_0 + gapPx_1 * 0.5;\n\n return aaRamp_0(dashPx_1 * 0.5 - abs(shifted_0 - period_0 * floor(shifted_0 / period_0) - period_0 * 0.5), aaPx_1);\n}\n\nfloat dashCoverage_0(float coord_1, float dashPx_2, float gapPx_2, float dpr_2)\n{\n\n return dashCoverageAt_0(coord_1, dashPx_2, gapPx_2, aaPx_0(dpr_2));\n}\n\n\nfloat linkDash_0(VsOut_0 i_2)\n{\n\n float along_0 = linkDashAlong_0(i_2);\n\n bool _S9;\n if((u_0.dashPx_0) > 0.0)\n {\n\n _S9 = along_0 >= 0.0;\n\n }\n else\n {\n\n _S9 = false;\n\n }\n\n float _S10;\n if(_S9)\n {\n\n _S10 = dashCoverage_0(along_0, u_0.dashPx_0, u_0.gapPx_0, u_0.devicePixelRatio_0);\n\n }\n else\n {\n\n _S10 = 1.0;\n\n }\n\n return _S10;\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_local;\n\n\nflat in vec2 v_radii;\n\n\nflat in float v_kind;\n\n\nflat in float v_halfWidthPx;\n\n\nin float v_legSide;\n\n\n\n\nvoid main()\n{\n\n if((abs(v_legSide)) < 0.99900001287460327)\n {\n\n discard;\n\n }\n\n VsOut_0 _S11 = VsOut_0(gl_FragCoord, v_color, v_local, v_radii, v_kind, v_halfWidthPx, v_legSide);\n\n VsOut_0 _S12 = VsOut_0(gl_FragCoord, v_color, v_local, v_radii, v_kind, v_halfWidthPx, v_legSide);\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * (edgeCoverage_0(v_halfWidthPx - linkDistance_0(_S11), u_0.devicePixelRatio_0) * linkDash_0(_S12)));\n\n return;\n}\n\n"
6
+ export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n float canvasHeight_0;\n float devicePixelRatio_0;\n float rowHeight_0;\n float rowOffsetPx_0;\n int reverse_0;\n float stemPx_0;\n float dashPx_0;\n float gapPx_0;\n float footPx_0;\n uint curveSegments_0;\n float insetPx_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n float valueSymlogConstant_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n int valued_0;\n int linkShape_0;\n int sizeMode_0;\n float sizeConstantPx_0;\n float sizeDomainMin_0;\n float sizeDomainMax_0;\n int sizeScaleType_0;\n float sizeRangeMin_0;\n float sizeRangeMax_0;\n float canvasWidth_0;\n uint regionCount_0;\n float zero_0;\n vec4 ownEntry_0;\n vec4 ownSpan_0;\n vec4 regionTable_0[256];\n vec4 regionSpan_0[128];\n int rowTableKeys_0;\n}u_0;\n\nfloat farDomeDistSq_0(float u_1, float dPx_0, float hPx_0, float rx_0, float ry_0)\n{\n\n float ox_0 = 2.0 * rx_0 * u_1 * u_1 - dPx_0;\n float oy_0 = 2.0 * ry_0 * u_1 * sqrt(max(1.0 - u_1 * u_1, 0.0)) - hPx_0;\n return ox_0 * ox_0 + oy_0 * oy_0;\n}\n\n\n\n\nfloat farDomeStep_0(float u_2, float dPx_1, float hPx_1, float rx_1, float ry_1)\n{\n\n float w_0 = sqrt(max(1.0 - u_2 * u_2, 9.99999997475242708e-07));\n float ox_1 = 2.0 * rx_1 * u_2 * u_2 - dPx_1;\n float _S1 = 2.0 * ry_1;\n\n float _S2 = _S1 * u_2;\n\n float oy_1 = _S2 * w_0 - hPx_1;\n float _S3 = 4.0 * rx_1;\n\n float dx_0 = _S3 * u_2;\n float _S4 = 2.0 * u_2 * u_2;\n\n float dy_0 = _S1 * (1.0 - _S4) / w_0;\n\n float whole_0 = clamp(u_2 - (ox_1 * dx_0 + oy_1 * dy_0) / max(dx_0 * dx_0 + dy_0 * dy_0 + ox_1 * _S3 + oy_1 * (_S2 * (_S4 - 3.0) / (w_0 * w_0 * w_0)), 9.999999960041972e-13), 0.0, 0.99900001287460327);\n float half_0 = 0.5 * (u_2 + whole_0);\n float here_0 = ox_1 * ox_1 + oy_1 * oy_1;\n\n float _S5;\n\n if((farDomeDistSq_0(whole_0, dPx_1, hPx_1, rx_1, ry_1)) < here_0)\n {\n\n _S5 = whole_0;\n\n }\n else\n {\n\n if((farDomeDistSq_0(half_0, dPx_1, hPx_1, rx_1, ry_1)) < here_0)\n {\n\n _S5 = half_0;\n\n }\n else\n {\n\n _S5 = u_2;\n\n }\n\n }\n\n return _S5;\n}\n\n\nfloat farDomeDistancePx_0(float dPx_2, float hPx_2, float rxPx_0, float ryPx_0)\n{\n\n float _S6 = max(rxPx_0, 9.99999997475242708e-07);\n float _S7 = max(ryPx_0, 9.99999997475242708e-07);\n float q_0 = clamp(hPx_2 / _S7, 0.0, 1.0);\n float c_0 = sqrt(1.0 - q_0 * q_0);\n\n float uH_0;\n\n if(dPx_2 > _S6)\n {\n\n uH_0 = sqrt(0.5 * (1.0 + c_0));\n\n }\n else\n {\n\n uH_0 = q_0 / sqrt(2.0 * (1.0 + c_0));\n\n }\n float uD_0 = sqrt(clamp(dPx_2 / (2.0 * _S6), 0.0, 1.0));\n\n float u_3;\n\n if((farDomeDistSq_0(uH_0, dPx_2, hPx_2, _S6, _S7)) < (farDomeDistSq_0(uD_0, dPx_2, hPx_2, _S6, _S7)))\n {\n\n u_3 = uH_0;\n\n }\n else\n {\n\n u_3 = uD_0;\n\n }\n\n return sqrt(farDomeDistSq_0(farDomeStep_0(farDomeStep_0(farDomeStep_0(farDomeStep_0(u_3, dPx_2, hPx_2, _S6, _S7), dPx_2, hPx_2, _S6, _S7), dPx_2, hPx_2, _S6, _S7), dPx_2, hPx_2, _S6, _S7), dPx_2, hPx_2, _S6, _S7));\n}\n\n\nfloat distToWideCirclePx_0(float x_0, float y_0, float r_0)\n{\n\n float rk_0 = 2.0 * x_0 + (x_0 * x_0 + y_0 * y_0) / r_0;\n return abs(rk_0 / (sqrt(max(1.0 + rk_0 / r_0, 0.0)) + 1.0));\n}\n\nfloat distToWideCircle_0(vec2 legLocal_0, float r_1)\n{\n\n return distToWideCirclePx_0(legLocal_0.x, legLocal_0.y, r_1);\n}\n\n\nfloat nearCircleDistancePx_0(float qx_0, float qy_0, float ax_0, float ay_0)\n{\n\n float kx_0 = qx_0 / ax_0;\n float ky_0 = qy_0 / ay_0;\n float k_0 = sqrt(kx_0 * kx_0 + ky_0 * ky_0);\n float gx_0 = qx_0 / (ax_0 * ax_0);\n float gy_0 = qy_0 / (ay_0 * ay_0);\n return abs(k_0 * (k_0 - 1.0) / max(sqrt(gx_0 * gx_0 + gy_0 * gy_0), 9.99999968265522539e-21));\n}\n\n\nfloat sdEllipse_0(vec2 p_0, vec2 radii_0)\n{\n\n vec2 q_1 = abs(p_0);\n\n vec2 ab_0;\n\n vec2 q_2;\n\n if((q_1.x) > (q_1.y))\n {\n\n vec2 _S8 = q_1.yx;\n\n ab_0 = radii_0.yx;\n\n q_2 = _S8;\n\n }\n else\n {\n\n ab_0 = radii_0;\n\n q_2 = q_1;\n\n }\n\n if((dot(ab_0, ab_0)) <= 0.0)\n {\n\n return length(q_2);\n }\n\n float _S9 = ab_0.y;\n\n float _S10 = ab_0.x;\n\n float l_0 = _S9 * _S9 - _S10 * _S10;\n if((abs(l_0)) < (0.05000000074505806 * _S9 * _S9))\n {\n\n return nearCircleDistancePx_0(q_2.x, q_2.y, _S10, _S9);\n }\n float m_0 = _S10 * q_2.x / l_0;\n\n float m2_0 = m_0 * m_0;\n float n_0 = _S9 * q_2.y / l_0;\n\n float n2_0 = n_0 * n_0;\n float c_1 = (m2_0 + n2_0 - 1.0) / 3.0;\n float c3_0 = c_1 * c_1 * c_1;\n float _S11 = m2_0 * n2_0;\n\n float d_0 = c3_0 + _S11;\n float g_0 = m_0 + m_0 * n2_0;\n\n float co_0;\n\n if(d_0 < 0.0)\n {\n\n float h_0 = acos(clamp((c3_0 + _S11 * 2.0) / c3_0, -1.0, 1.0)) / 3.0;\n float s_0 = cos(h_0);\n float t_0 = sin(h_0) * sqrt(3.0);\n float _S12 = - c_1;\n\n float rx_2 = sqrt(max(_S12 * (s_0 + t_0 + 2.0) + m2_0, 0.0));\n float ry_2 = sqrt(max(_S12 * (s_0 - t_0 + 2.0) + m2_0, 0.0));\n\n co_0 = (ry_2 + float((int(sign((l_0))))) * rx_2 + abs(g_0) / max(rx_2 * ry_2, 9.99999968265522539e-21) - m_0) / 2.0;\n\n }\n else\n {\n\n float w_1 = c3_0 + _S11 * 2.0 + 2.0 * m_0 * n_0 * sqrt(d_0);\n float aw_0 = abs(w_1);\n float _S13 = float((int(sign((w_1)))));\n\n float s_1 = _S13 * pow(aw_0, 0.3333333432674408);\n if(aw_0 > 0.0)\n {\n\n co_0 = _S13 * pow(c3_0 * (c3_0 / aw_0), 0.3333333432674408);\n\n }\n else\n {\n\n co_0 = 0.0;\n\n }\n float rx_3 = - s_1 - co_0 - c_1 * 4.0 + 2.0 * m2_0;\n float ry_3 = (s_1 - co_0) * sqrt(3.0);\n float rm_0 = sqrt(rx_3 * rx_3 + ry_3 * ry_3);\n\n co_0 = (ry_3 / sqrt(max(rm_0 - rx_3, 9.99999968265522539e-21)) + 2.0 * g_0 / max(rm_0, 9.99999968265522539e-21) - m_0) / 2.0;\n\n }\n\n float co_1 = clamp(co_0, -1.0, 1.0);\n\n return length(ab_0 * vec2(co_1, sqrt(max(1.0 - co_1 * co_1, 0.0))) - q_2);\n}\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 local_0;\n vec2 radii_1;\n float kind_0;\n float halfWidthPx_0;\n float legSide_0;\n};\n\n\nfloat linkDistance_0(VsOut_0 i_0)\n{\n\n if((i_0.kind_0) >= 2.5)\n {\n\n float _S14 = i_0.local_0.x;\n return length(vec2(_S14 - clamp(_S14, 0.0, i_0.radii_1.x), i_0.local_0.y));\n }\n if((i_0.kind_0) >= 1.5)\n {\n\n float _S15 = i_0.local_0.y;\n return length(vec2(i_0.local_0.x, _S15 - clamp(_S15, - i_0.radii_1.y, 0.0)));\n }\n if((i_0.kind_0) >= 0.5)\n {\n\n float _S16 = i_0.radii_1.y;\n\n float _S17 = i_0.radii_1.x;\n\n float _S18;\n if(_S16 < _S17)\n {\n\n _S18 = farDomeDistancePx_0(- i_0.local_0.x, - i_0.local_0.y, _S17, _S16);\n\n }\n else\n {\n\n _S18 = distToWideCircle_0(i_0.local_0, _S17);\n\n }\n\n return _S18;\n }\n\n\n return sdEllipse_0(i_0.local_0, i_0.radii_1);\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaRamp_0(float signedInk_0, float widthPx_0)\n{\n\n return clamp(signedInk_0 / widthPx_0 + 0.5, 0.0, 1.0);\n}\n\n\nfloat edgeCoverage_0(float signedInkCssPx_0, float dpr_1)\n{\n\n return aaRamp_0(signedInkCssPx_0, aaPx_0(dpr_1));\n}\n\n\nfloat linkDashAlong_0(VsOut_0 i_1)\n{\n\n if((i_1.kind_0) >= 3.5)\n {\n\n return -1.0;\n }\n\n if((i_1.kind_0) >= 2.5)\n {\n\n return i_1.local_0.x;\n }\n\n if((i_1.kind_0) >= 1.5)\n {\n\n return - i_1.local_0.y;\n }\n\n return -1.0;\n}\n\n\nfloat dashCoverageAt_0(float coord_0, float dashPx_1, float gapPx_1, float aaPx_1)\n{\n float period_0 = dashPx_1 + gapPx_1;\n float shifted_0 = coord_0 + gapPx_1 * 0.5;\n\n return aaRamp_0(dashPx_1 * 0.5 - abs(shifted_0 - period_0 * floor(shifted_0 / period_0) - period_0 * 0.5), aaPx_1);\n}\n\nfloat dashCoverage_0(float coord_1, float dashPx_2, float gapPx_2, float dpr_2)\n{\n\n return dashCoverageAt_0(coord_1, dashPx_2, gapPx_2, aaPx_0(dpr_2));\n}\n\n\nfloat linkDash_0(VsOut_0 i_2)\n{\n\n float along_0 = linkDashAlong_0(i_2);\n\n bool _S19;\n if((u_0.dashPx_0) > 0.0)\n {\n\n _S19 = along_0 >= 0.0;\n\n }\n else\n {\n\n _S19 = false;\n\n }\n\n float _S20;\n if(_S19)\n {\n\n _S20 = dashCoverage_0(along_0, u_0.dashPx_0, u_0.gapPx_0, u_0.devicePixelRatio_0);\n\n }\n else\n {\n\n _S20 = 1.0;\n\n }\n\n return _S20;\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_local;\n\n\nflat in vec2 v_radii;\n\n\nflat in float v_kind;\n\n\nflat in float v_halfWidthPx;\n\n\nin float v_legSide;\n\n\n\n\nvoid main()\n{\n\n if((abs(v_legSide)) < 0.99900001287460327)\n {\n\n discard;\n\n }\n\n VsOut_0 _S21 = VsOut_0(gl_FragCoord, v_color, v_local, v_radii, v_kind, v_halfWidthPx, v_legSide);\n\n VsOut_0 _S22 = VsOut_0(gl_FragCoord, v_color, v_local, v_radii, v_kind, v_halfWidthPx, v_legSide);\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * (edgeCoverage_0(v_halfWidthPx - linkDistance_0(_S21), u_0.devicePixelRatio_0) * linkDash_0(_S22)));\n\n return;\n}\n\n"
@@ -130,12 +130,38 @@ export function linkApexPx(halfWidthPx: number, reachPx: number, strokeHalfPx: n
130
130
  return _min(halfWidthPx, _max((reachPx - strokeHalfPx), 0.0))
131
131
  }
132
132
 
133
+ export function linkApexHeld(valued: number, value: number, domainMax: number): number {
134
+ let _t0: boolean
135
+ if ((valued != 0)) {
136
+ _t0 = (value < domainMax)
137
+ } else {
138
+ _t0 = false
139
+ }
140
+ let _t1: number
141
+ if (_t0) {
142
+ _t1 = 1
143
+ } else {
144
+ _t1 = 0
145
+ }
146
+ return _t1
147
+ }
148
+
133
149
  export function linkIsFar(halfWidthPx: number, screenWidthPx: number): boolean {
134
150
  return ((2.0 * halfWidthPx) > (3.0 * screenWidthPx))
135
151
  }
136
152
 
137
- export function linkRadiiPx(halfWidthPx: number, apexPx: number, screenWidthPx: number): [number, number] {
153
+ export function linkRadiiPx(halfWidthPx: number, apexPx: number, screenWidthPx: number, held: number): [number, number] {
154
+ let _t0: boolean
138
155
  if (linkIsFar(halfWidthPx, screenWidthPx)) {
156
+ if ((held == 0)) {
157
+ _t0 = true
158
+ } else {
159
+ _t0 = (apexPx >= (0.25 * halfWidthPx))
160
+ }
161
+ } else {
162
+ _t0 = false
163
+ }
164
+ if (_t0) {
139
165
  return [halfWidthPx, halfWidthPx]
140
166
  }
141
167
  return [halfWidthPx, apexPx]
@@ -11,7 +11,10 @@
11
11
  // true distance to the analytic curve, so the hull's facets never reach the
12
12
  // picture. A pair wider than LINK_FAR_SCREEN_WIDTHS view widths degenerates to
13
13
  // a circle whose legs rise from each real foot, built endpoint-relative so a
14
- // radius in the millions of px cancels nothing. A foot the table cannot place
14
+ // radius in the millions of px cancels nothing, or where its apex is low to
15
+ // a dome that keeps the apex, whose canvas-wide stretch is a nearly level
16
+ // line, so a view inside the pair still shows it passing over. A foot the
17
+ // table cannot place
15
18
  // draws a stem at the placed one, so an off-view mate still says it exists. A
16
19
  // foot may carry a breakend tick along the baseline, pointing along the arm
17
20
  // its junction keeps. Under `line` the pair is a straight segment at the apex
@@ -24,8 +27,8 @@
24
27
  //! targets: wgsl, glsl
25
28
  //! topology: triangle-strip
26
29
  //! coverage: analytic
27
- //! export-consts: LINK_SHAPE_DOME, LINK_SHAPE_ARC, LINK_SHAPE_LINE, LINK_LINE_MIN_PX, LINK_NO_REGION, LINK_ELSEWHERE, LINK_MAX_REGIONS, LINK_STEM_PX, LINK_FOOT_PX, LINK_FAR_SCREEN_WIDTHS, LINK_SIZE_CONSTANT, LINK_SIZE_SCALED, LINK_NO_SIZE, LINK_CURVE_SEGMENTS
28
- //! js-export: linkApexPx, linkRadiiPx, linkIsFar, linkStrokeWidthPx, linkValuePx, linkBaseYPx, linkFootLenPx, linkFootDir
30
+ //! export-consts: LINK_SHAPE_DOME, LINK_SHAPE_ARC, LINK_SHAPE_LINE, LINK_LINE_MIN_PX, LINK_NO_REGION, LINK_ELSEWHERE, LINK_MAX_REGIONS, LINK_STEM_PX, LINK_FOOT_PX, LINK_FAR_SCREEN_WIDTHS, LINK_FAR_FLAT_RATIO, LINK_SIZE_CONSTANT, LINK_SIZE_SCALED, LINK_NO_SIZE, LINK_CURVE_SEGMENTS
31
+ //! js-export: linkApexPx, linkApexHeld, linkRadiiPx, linkIsFar, linkStrokeWidthPx, linkValuePx, linkBaseYPx, linkFootLenPx, linkFootDir
29
32
 
30
33
  import antialias;
31
34
  import colorPack;
@@ -35,6 +38,7 @@ import markColor;
35
38
  import rowTable;
36
39
  import scoreScale;
37
40
  import valueScale;
41
+ import viewRegion;
38
42
 
39
43
  public static const uint LINK_CURVE_SEGMENTS = 64u;
40
44
  static const uint CURVE_VERTS = (LINK_CURVE_SEGMENTS + 1u) * 2u;
@@ -56,7 +60,7 @@ public static const uint LINK_NO_REGION = 0xFFFFFFFFu;
56
60
  // An `x2Region` for an instance another region's payload draws: the far half
57
61
  // of a pair both of whose ends have records, or a record fetched twice.
58
62
  public static const uint LINK_ELSEWHERE = 0xFFFFFFFEu;
59
- public static const uint LINK_MAX_REGIONS = 256u;
63
+ public static const uint LINK_MAX_REGIONS = VIEW_REGION_MAX;
60
64
  public static const float LINK_STEM_PX = 12.0;
61
65
  // How long a breakend foot is where its region has the room: a tick along
62
66
  // the baseline over the arm its junction keeps, BreakpointSplitView's length.
@@ -66,6 +70,10 @@ public static const float LINK_FOOT_PX = 20.0;
66
70
  // Not 1, because a circle throws the pair's direction away, and the limit is
67
71
  // tessellation: reference/ARC_BAND.md.
68
72
  public static const float LINK_FAR_SCREEN_WIDTHS = 3.0;
73
+ // A far pair whose scale holds an apex under this share of its half-width
74
+ // keeps it and draws as a flattened dome; above it the pair is a circle. A quarter
75
+ // leaves an arc whose apex IS its half-width, give or take a float, a circle.
76
+ public static const float LINK_FAR_FLAT_RATIO = 0.25;
69
77
  public static const int LINK_SIZE_CONSTANT = 0;
70
78
  public static const int LINK_SIZE_SCALED = 1;
71
79
  // The `size` lane's value for an instance holding no number, which takes the
@@ -113,7 +121,7 @@ struct Uniforms {
113
121
  float rampMax;
114
122
  float rampMidNorm;
115
123
  // `markColor`'s threshold: how many cuts are in use, the cuts four to a
116
- // vector, and the colour of each interval between them.
124
+ // vector, and the color of each interval between them.
117
125
  int colorCutCount;
118
126
  float4 colorCuts[2];
119
127
  float4 colorBands[MAX_COLOR_BANDS];
@@ -170,10 +178,6 @@ struct VsOut {
170
178
  float legSide : COLOR5;
171
179
  };
172
180
 
173
- float entryPx(uint bp, float4 r, float hpZero) {
174
- return r.x - hpViewportOffsetBp(hpSplitUint(bp), float3(r.y, r.z, 0.0), hpZero) * r.w;
175
- }
176
-
177
181
  // Whether a pair is wide enough to draw as a true circle's two legs, which the
178
182
  // painter strokes as a circle and `linkRadiiPx` sizes as one.
179
183
  public bool linkIsFar(float halfWidthPx, float screenWidthPx) {
@@ -202,11 +206,24 @@ public float linkBaseYPx(float rowOffsetPx, float rowHeight, uint row, int rever
202
206
  return rowBandTopPx(rowOffsetPx, rowHeight, row) + (reverse != 0 ? 0.0 : rowHeight);
203
207
  }
204
208
 
205
- // The two radii of the half-ellipse a pair draws, or a true circle's once the
206
- // pair is far. `//! js-export`ed as a pair because the decision IS the pair,
207
- // and it is what the painter, the ink and the hit test read.
208
- public float2 linkRadiiPx(float halfWidthPx, float apexPx, float screenWidthPx) {
209
- if (linkIsFar(halfWidthPx, screenWidthPx)) {
209
+ // Whether the value scale holds a pair's `y`: it names an apex inside the
210
+ // band. A value past the top of its domain is clamped there, and so is a dome
211
+ // with no `y`, which rises as far as its band lets it: the apex either draws
212
+ // at is the band's, not the pair's.
213
+ public int linkApexHeld(int valued, float value, float domainMax) {
214
+ return valued != 0 && value < domainMax ? 1 : 0;
215
+ }
216
+
217
+ // The two radii of the half-ellipse a pair draws. A far pair's are a true
218
+ // circle's, which its band clips to legs, unless the scale holds a low apex
219
+ // for it: then it keeps the apex and is a dome level across the canvas. A read
220
+ // pair's `y` is its own half-span, off the top of the scale long before the
221
+ // pair is far, so it stays the circle. `//! js-export`ed as a pair because the
222
+ // decision IS the pair, and it is what the painter, the ink and the hit test
223
+ // read.
224
+ public float2 linkRadiiPx(float halfWidthPx, float apexPx, float screenWidthPx, int held) {
225
+ if (linkIsFar(halfWidthPx, screenWidthPx)
226
+ && (held == 0 || apexPx >= LINK_FAR_FLAT_RATIO * halfWidthPx)) {
210
227
  return float2(halfWidthPx, halfWidthPx);
211
228
  }
212
229
  return float2(halfWidthPx, apexPx);
@@ -283,7 +300,8 @@ LinkVertex curveVertex(LinkInstance inst, LinkEnv e, uint seg, float side) {
283
300
  float valuePx = linkValuePx(inst.y, u.domainMin, u.domainMax, u.rowHeight,
284
301
  u.valueScaleType, u.insetPx, u.valueSymlogConstant);
285
302
  float apex = linkApexPx(pairHalf, e.reach, e.strokeHalf, u.linkShape, u.valued, valuePx);
286
- v.radii = linkRadiiPx(pairHalf, apex, u.canvasWidth);
303
+ v.radii = linkRadiiPx(pairHalf, apex, u.canvasWidth,
304
+ linkApexHeld(u.valued, inst.y, u.domainMax));
287
305
  float2 ends = float2(min(e.xPx, e.x2Px), max(e.xPx, e.x2Px));
288
306
  if (u.linkShape == LINK_SHAPE_LINE) {
289
307
  v.kind = KIND_LINE;
@@ -291,6 +309,24 @@ LinkVertex curveVertex(LinkInstance inst, LinkEnv e, uint seg, float side) {
291
309
  v.radii = float2(len, 0.0);
292
310
  v.local = float2(t * len, pad);
293
311
  origin = float2((e.xPx + e.x2Px) * 0.5 - len * 0.5, e.baseY - apex * e.ySign);
312
+ } else if (linkIsFar(pairHalf, u.canvasWidth) && v.radii.y < v.radii.x) {
313
+ // A far dome, in px from the foot nearer the canvas and stepped in
314
+ // u = sin(b / 2) for the angle b from that foot, as the fragment
315
+ // measures it: a square root places the canvas's edges where an arcsine
316
+ // is px off at these radii. Over the stretch the canvas shows and no
317
+ // more, so every segment is spent on screen.
318
+ v.kind = KIND_CIRCLE;
319
+ float rx = v.radii.x;
320
+ bool fromRight = u.canvasWidth * 0.5 - ends.x > rx;
321
+ float footX = fromRight ? ends.y : ends.x;
322
+ float margin = e.hw + 2.0;
323
+ float nearD = fromRight ? footX - u.canvasWidth - margin : -margin - footX;
324
+ float farD = fromRight ? footX + margin : u.canvasWidth + margin - footX;
325
+ float u0 = farDomeParam(nearD, rx);
326
+ float step = (max(farDomeParam(farD, rx), u0) - u0) / float(u.curveSegments);
327
+ v.local = -farDomeHullPoint(u0 + float(seg) * step, step, rx, v.radii.y, pad);
328
+ origin = float2(footX, e.baseY);
329
+ legDir = fromRight ? 1.0 : -1.0;
294
330
  } else if (linkIsFar(pairHalf, u.canvasWidth)) {
295
331
  v.kind = KIND_CIRCLE;
296
332
  float legSweep = legSweepAngle(v.radii.x, e.reach + e.hw);
@@ -373,9 +409,9 @@ VsOut vs_main(LinkInstance inst, uint vid : SV_VertexID) {
373
409
  e.baseY = linkBaseYPx(u.rowOffsetPx, u.rowHeight, place.slot, u.reverse);
374
410
  e.ySign = u.reverse != 0 ? -1.0 : 1.0;
375
411
  e.reach = max(u.rowHeight - u.insetPx, 0.0);
376
- e.xPx = entryPx(inst.x, u.ownEntry, u.zero);
412
+ e.xPx = viewRegionPx(inst.x, u.ownEntry, u.zero);
377
413
  e.placed = inst.x2Region < u.regionCount;
378
- e.x2Px = e.placed ? entryPx(inst.x2, u.regionTable[inst.x2Region], u.zero) : e.xPx;
414
+ e.x2Px = e.placed ? viewRegionPx(inst.x2, u.regionTable[inst.x2Region], u.zero) : e.xPx;
379
415
 
380
416
  uint curveVerts = (u.curveSegments + 1u) * 2u;
381
417
  LinkVertex v;
@@ -412,7 +448,11 @@ float linkDistance(VsOut i) {
412
448
  float y = clamp(i.local.y, -i.radii.y, 0.0);
413
449
  return length(float2(i.local.x, i.local.y - y));
414
450
  }
415
- if (i.kind >= 0.5) { return distToWideCircle(i.local, i.radii.x); }
451
+ if (i.kind >= 0.5) {
452
+ return i.radii.y < i.radii.x
453
+ ? farDomeDistancePx(-i.local.x, -i.local.y, i.radii.x, i.radii.y)
454
+ : distToWideCircle(i.local, i.radii.x);
455
+ }
416
456
  return sdEllipse(i.local, i.radii);
417
457
  }
418
458