MCPcopy Create free account
hub / github.com/microsoft/SandDance / markStager

Function markStager

packages/vega-deck.gl/src/marks/rule.ts:11–37  ·  view source on GitHub ↗
(options: MarkStagerOptions, stage: Stage, scene: Scene, x: number, y: number, groupType: GroupType)

Source from the content-addressed store, hash-verified

9import { zSwap } from '../zaxis';
10
11const markStager: MarkStager = (options: MarkStagerOptions, stage: Stage, scene: Scene, x: number, y: number, groupType: GroupType) => {
12
13 base.vega.sceneVisit(scene, function (item: SceneLine) {
14 const x1 = item.x || 0;
15 const y1 = item.y || 0;
16 const x2 = item.x2 != null ? item.x2 : x1;
17 const y2 = item.y2 != null ? item.y2 : y1;
18
19 const lineItem = styledLine(x1 + x, y1 + y, x2 + x, y2 + y, item.stroke, item.strokeWidth);
20
21 if (item.mark.role === 'axis-tick') {
22 if (options.currAxis.role === 'z') {
23 zSwap(lineItem.sourcePosition);
24 zSwap(lineItem.targetPosition);
25 }
26 options.currAxis.ticks.push(lineItem);
27 } else if (item.mark.role === 'axis-domain') {
28 if (options.currAxis.role === 'z') {
29 zSwap(lineItem.sourcePosition);
30 zSwap(lineItem.targetPosition);
31 }
32 options.currAxis.domain = lineItem;
33 } else {
34 stage.gridLines.push(lineItem);
35 }
36 });
37};
38
39function styledLine(x1: number, y1: number, x2: number, y2: number, stroke: string, strokeWidth: number) {
40 const line: StyledLine = {

Callers

nothing calls this directly

Calls 2

zSwapFunction · 0.90
styledLineFunction · 0.70

Tested by

no test coverage detected