Skip to content

Commit

Permalink
fix(core): "link" mark's other endpoint didn't quite reach the target
Browse files Browse the repository at this point in the history
Fell one vertex pair short.
  • Loading branch information
tuner committed Mar 8, 2024
1 parent fb46978 commit fc10bff
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/core/src/marks/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default class LinkMark extends Mark {
this.registerMarkUniformValue(
"uSegmentBreaks",
props.segments,
(x) => x + 1
(x) => x
);
this.registerMarkUniformValue(
"uNoFadingOnPointSelection",
Expand Down Expand Up @@ -207,6 +207,14 @@ export default class LinkMark extends Mark {
render(options) {
const gl = this.gl;

const getInstanceVertexCount = () => {
const breaks = /** @type {Float32Array} */ (
this.markUniformInfo.uniforms.uSegmentBreaks
)[0];

return (breaks + 1) * 2;
};

return this._baseInstanceExt
? this.createRenderCallback((offset, count) => {
// Using the following extension, which, however, is only a draft and
Expand All @@ -216,9 +224,7 @@ export default class LinkMark extends Mark {
this._baseInstanceExt.drawArraysInstancedBaseInstanceWEBGL(
gl.TRIANGLE_STRIP,
0,
/** @type {Float32Array} */ (
this.markUniformInfo.uniforms.uSegmentBreaks
)[0] * 2,
getInstanceVertexCount(),
count,
offset
);
Expand Down Expand Up @@ -254,9 +260,7 @@ export default class LinkMark extends Mark {
gl.drawArraysInstanced(
gl.TRIANGLE_STRIP,
0,
/** @type {Float32Array} */ (
this.markUniformInfo.uniforms.uSegmentBreaks
)[0] * 2,
getInstanceVertexCount(),
count
);
}, options);
Expand Down

0 comments on commit fc10bff

Please sign in to comment.