Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Enable Corepack
run: corepack enable
- name: "Install"
run: "yarn install"
run: "yarn install --ignore-scripts"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should have noticed and added this when I upgraded Lerna a bit ago

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely an easy one to miss! The yarn install commands don't often get modified in PRs, so Sonar wasn't adding warnings to PRs frequently, and since the failure shows up post-merge, I've been missing this one as well 😅

- name: "Lint"
run: "yarn lint"
test:
Expand All @@ -73,7 +73,7 @@ jobs:
- name: Enable Corepack
run: corepack enable
- name: "Install"
run: "yarn install"
run: "yarn install --ignore-scripts"
- name: "Test"
run: "yarn test:ci"
docs:
Expand All @@ -96,7 +96,7 @@ jobs:
- name: Enable Corepack
run: corepack enable
- name: "Install"
run: "yarn install"
run: "yarn install --ignore-scripts"
- name: "Generate docs"
run: "yarn generate:docs"
- name: "Test docs"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Enable Corepack
run: corepack enable
- name: "Install"
run: "yarn install --frozen-lockfile"
run: "yarn install --ignore-scripts --frozen-lockfile"
- name: "Build"
run: "yarn build"
- name: "Test"
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
- name: Enable Corepack
run: corepack enable
- name: "Install"
run: "yarn install"
run: "yarn install --ignore-scripts"
- name: "Publish Canary to NPM"
env:
NODE_AUTH_TOKEN: "${{ secrets.NPMJS_ACCESS_TOKEN }}"
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
- name: Enable Corepack
run: corepack enable
- name: "Install"
run: "yarn install"
run: "yarn install --ignore-scripts"
- name: "Publish Release to NPM"
env:
NODE_AUTH_TOKEN: "${{ secrets.NPMJS_ACCESS_TOKEN }}"
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
- name: "Install"
run: "yarn install"
run: "yarn install --ignore-scripts"
- name: "Generate docs"
run: "yarn generate:docs"
- name: "Upload docs as pages artifact"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Enable Corepack
run: corepack enable
- name: "Install"
run: "yarn install --frozen-lockfile"
run: "yarn install --ignore-scripts --frozen-lockfile"
- name: "Build"
run: "yarn build"
- name: "Upload build artifacts"
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Enable Corepack
run: corepack enable
- name: "Install"
run: "yarn install"
run: "yarn install --ignore-scripts"
- name: "Publish Testing build to NPM"
env:
NODE_AUTH_TOKEN: "${{ secrets.NPMJS_ACCESS_TOKEN }}"
Expand Down
12 changes: 6 additions & 6 deletions examples/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ const DEFAULT_STREAM_KEY = 'ydD87RtDdJCZQaa6twueZTEtsciQmAWl5qnP';

export async function loadViewerWithQueryParams(
viewer,
{ env, streamKey } = {
streamKey: getStreamKey() || DEFAULT_STREAM_KEY,
env: getEnvironment() || DEFAULT_ENV,
}
options
) {
viewer.configEnv = env;
await viewer.load(`urn:vertex:stream-key:${streamKey}`);
const effectiveStreamKey = options?.streamKey ?? getStreamKey() ?? DEFAULT_STREAM_KEY;
const effectiveEnv = options?.env ?? getEnvironment() ?? DEFAULT_ENV;

viewer.configEnv = effectiveEnv;
await viewer.load(`urn:vertex:stream-key:${effectiveStreamKey}`);
}

export function getStreamKey() {
Expand Down
11 changes: 7 additions & 4 deletions examples/metadata-operations/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
></script>
</head>
<body>
<vertex-viewer id="viewer" class="viewer">
<vertex-viewer-toolbar data-viewer="viewer">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not need the toolbar anymore?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope! I've updated this to show the controls outside the viewer - the toolbar was really only used here for positioning, but taking a look at the example, these felt like they fit outside the viewer better anyway

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! I like how it looks now.

<div class="app">
<vertex-viewer id="viewer" class="viewer">
</vertex-viewer>
<div class="inputs">
<label class="invisible" for="metadata-key">Metadata Key</label>
<input id="metadata-key" type="text" placeholder="Metadata Key" />
<label class="invisible" for="metadata-value">Metadata Value</label>
<input id="metadata-value" type="text" placeholder="Metadata Value" />
<button id="search-btn">Search</button>
<button id="clear-btn">Clear</button>
</vertex-viewer-toolbar>
</vertex-viewer>
</div>
</body>
</html>
34 changes: 31 additions & 3 deletions examples/metadata-operations/styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}

.app {
width: 100%;
height: 100%;
padding: 0.5rem;
box-sizing: border-box;
display: flex;
flex-direction: column;
}

.viewer {
display: block;
width: 500px;
height: 500px;
width: 100%;
height: 100%;
grid-column: 1 / 5;
}

.inputs {
display: flex;
gap: 1rem;
align-items: center;
justify-content: center;
}

.invisible {
position: absolute;
visibility: hidden;
}
2 changes: 1 addition & 1 deletion examples/scene-tree-columns/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function main() {
// Get array of selected metadata keys
const selectedMetadataKeys = Array.from(selectedColumns);

if (!searchInput || !selectedColumns.size === 0) {
if (!searchInput) {
console.warn('No search input currently, resetting phantom state')
// If no search value, reset phantom state
await scene.elements((op) => [op.items.where((q) => q.all()).clearPhantom()]).execute();
Expand Down
5 changes: 2 additions & 3 deletions packages/geometry/src/boundingBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ export function union(
): BoundingBox;
export function union(...boxes: BoundingBox[]): BoundingBox | undefined;
export function union(box: BoundingBox, ...rest: BoundingBox[]): BoundingBox {
const boxes = [box, ...rest];
return boxes.reduce((a, b) => {
return rest.reduce((a, b) => {
return create(Vector3.min(a.min, b.min), Vector3.max(a.max, b.max));
});
}, box);
}
/* eslint-enable padding-line-between-statements */

Expand Down
2 changes: 1 addition & 1 deletion packages/geometry/src/vector3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function create(...args: any[]): Vector3 {
* component. A component is invalid if it contains a non-finite or NaN value.
*/
export function isValid({ x, y, z }: Vector3): boolean {
return [x, y, z].every((v) => isFinite(v) && !isNaN(v));
return [x, y, z].every((v) => Number.isFinite(v) && !Number.isNaN(v));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function timeout(...args: unknown[]): Promise<unknown> {
return timeout;
}
} else {
return Promise.reject('First argument to `timeout` must be a number');
return Promise.reject(new Error('First argument to `timeout` must be a number'));
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/binaryReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const readUtf8String = (
length: number,
reader: BinaryReader,
): BinaryReaderValue<string> => {
const value = String.fromCharCode.apply(
const value = String.fromCodePoint.apply(
null,
Array.from(new Uint8Array(reader.data.buffer, reader.offset, length)),
);
Expand Down
16 changes: 8 additions & 8 deletions packages/utils/src/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const fromNumber = (num: number): Color => {
export const fromHexString = (str: string): Color | undefined => {
const match = hexRegex.exec(str);
if (match != null) {
return fromNumber(parseInt(match[2], 16));
return fromNumber(Number.parseInt(match[2], 16));
}
};

Expand All @@ -72,19 +72,19 @@ export const fromCss = (css: string): Color | undefined => {
const rgbMatch = rgbRegex.exec(css);
if (rgbMatch != null) {
return create(
parseInt(rgbMatch[1]),
parseInt(rgbMatch[2]),
parseInt(rgbMatch[3]),
Number.parseInt(rgbMatch[1]),
Number.parseInt(rgbMatch[2]),
Number.parseInt(rgbMatch[3]),
);
}

const rgbaMatch = rgbaRegex.exec(css);
if (rgbaMatch != null) {
return create(
parseInt(rgbaMatch[1]),
parseInt(rgbaMatch[2]),
parseInt(rgbaMatch[3]),
Math.floor(parseFloat(rgbaMatch[4]) * 255),
Number.parseInt(rgbaMatch[1]),
Number.parseInt(rgbaMatch[2]),
Number.parseInt(rgbaMatch[3]),
Math.floor(Number.parseFloat(rgbaMatch[4]) * 255),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export class HitIndicator extends ReglComponent {
private getPlaneOpacity(): number {
if (this.planeOpacity != null) {
return typeof this.planeOpacity === 'string'
? parseFloat(this.planeOpacity)
? Number.parseFloat(this.planeOpacity)
: this.planeOpacity;
}
return DEFAULT_PLANE_OPACITY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function computePlaneNdcValues(
const world = [bottomLeft, topLeft, topRight, bottomRight];

return new MeshPoints(
!isNaN(worldX.x),
!Number.isNaN(worldX.x),
[bottomLeft, topLeft, topRight, bottomRight],
world.map((v) =>
Vector3.multiplyByTransformMatrixColumnMajor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function computePointNdcValues(
];

return new MeshPoints(
!isNaN(worldX.x),
!Number.isNaN(worldX.x),
world,
world.map((v) =>
Vector3.multiplyByTransformMatrixColumnMajor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ export function isVertexViewerMarkupElement(
}

export function isValidPointData(...points: Point.Point[]): boolean {
return points.every((pt) => !isNaN(pt.x) && !isNaN(pt.y));
return points.every((pt) => !Number.isNaN(pt.x) && !Number.isNaN(pt.y));
}

export function isValidStartEvent(event: PointerEvent): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,28 @@ describe('vertex-viewer-measurement-line', () => {
?.querySelector('.line-fill')
?.querySelector('.end-cap') as SVGLineElement;

expect(parseFloat(fillStartCap.getAttribute('x1') ?? '')).toBeCloseTo(0);
expect(parseFloat(fillStartCap.getAttribute('y1') ?? '')).toBeCloseTo(5);
expect(parseFloat(fillStartCap.getAttribute('x2') ?? '')).toBeCloseTo(0);
expect(parseFloat(fillStartCap.getAttribute('y2') ?? '')).toBeCloseTo(-5);
expect(Number.parseFloat(fillStartCap.getAttribute('x1') ?? '')).toBeCloseTo(0);
expect(Number.parseFloat(fillStartCap.getAttribute('y1') ?? '')).toBeCloseTo(5);
expect(Number.parseFloat(fillStartCap.getAttribute('x2') ?? '')).toBeCloseTo(0);
expect(Number.parseFloat(fillStartCap.getAttribute('y2') ?? '')).toBeCloseTo(-5);

expect(parseFloat(fillEndCap.getAttribute('x1') ?? '')).toBeCloseTo(100);
expect(parseFloat(fillEndCap.getAttribute('y1') ?? '')).toBeCloseTo(5);
expect(parseFloat(fillEndCap.getAttribute('x2') ?? '')).toBeCloseTo(100);
expect(parseFloat(fillEndCap.getAttribute('y2') ?? '')).toBeCloseTo(-5);
expect(Number.parseFloat(fillEndCap.getAttribute('x1') ?? '')).toBeCloseTo(100);
expect(Number.parseFloat(fillEndCap.getAttribute('y1') ?? '')).toBeCloseTo(5);
expect(Number.parseFloat(fillEndCap.getAttribute('x2') ?? '')).toBeCloseTo(100);
expect(Number.parseFloat(fillEndCap.getAttribute('y2') ?? '')).toBeCloseTo(-5);

expect(parseFloat(strokeStartCap.getAttribute('x1') ?? '')).toBeCloseTo(0);
expect(parseFloat(strokeStartCap.getAttribute('y1') ?? '')).toBeCloseTo(
expect(Number.parseFloat(strokeStartCap.getAttribute('x1') ?? '')).toBeCloseTo(0);
expect(Number.parseFloat(strokeStartCap.getAttribute('y1') ?? '')).toBeCloseTo(
5.5,
);
expect(parseFloat(strokeStartCap.getAttribute('x2') ?? '')).toBeCloseTo(0);
expect(parseFloat(strokeStartCap.getAttribute('y2') ?? '')).toBeCloseTo(
expect(Number.parseFloat(strokeStartCap.getAttribute('x2') ?? '')).toBeCloseTo(0);
expect(Number.parseFloat(strokeStartCap.getAttribute('y2') ?? '')).toBeCloseTo(
-5.5,
);

expect(parseFloat(strokeEndCap.getAttribute('x1') ?? '')).toBeCloseTo(100);
expect(parseFloat(strokeEndCap.getAttribute('y1') ?? '')).toBeCloseTo(5.5);
expect(parseFloat(strokeEndCap.getAttribute('x2') ?? '')).toBeCloseTo(100);
expect(parseFloat(strokeEndCap.getAttribute('y2') ?? '')).toBeCloseTo(-5.5);
expect(Number.parseFloat(strokeEndCap.getAttribute('x1') ?? '')).toBeCloseTo(100);
expect(Number.parseFloat(strokeEndCap.getAttribute('y1') ?? '')).toBeCloseTo(5.5);
expect(Number.parseFloat(strokeEndCap.getAttribute('x2') ?? '')).toBeCloseTo(100);
expect(Number.parseFloat(strokeEndCap.getAttribute('y2') ?? '')).toBeCloseTo(-5.5);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,9 @@ export class VertexPinLabel {
this.textareaRows = Math.max(
1,
Math.ceil(
(parseFloat(computedStyles.getPropertyValue('height')) -
parseFloat(computedStyles.getPropertyValue('borderWidth')) * 2) /
parseFloat(computedStyles.getPropertyValue('lineHeight')),
(Number.parseFloat(computedStyles.getPropertyValue('height')) -
Number.parseFloat(computedStyles.getPropertyValue('borderWidth')) * 2) /
Number.parseFloat(computedStyles.getPropertyValue('lineHeight')),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ export const TransformWidgetInput: FunctionalComponent<
}) => {
const handleChange = (event: Event): void => {
if (event.target != null) {
const parsed = parseFloat((event.target as HTMLInputElement).value);
const parsed = Number.parseFloat((event.target as HTMLInputElement).value);

if (!isNaN(parsed)) {
onChange?.(parseFloat((event.target as HTMLInputElement).value));
if (!Number.isNaN(parsed)) {
onChange?.(Number.parseFloat((event.target as HTMLInputElement).value));
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ export class ViewerTransformWidget {
if (this.inputRef != null) {
const definedValue =
this.getDisplayedDistance() ?? this.getDisplayedAngle() ?? 0;
const displayValue = `${parseFloat(
const displayValue = `${Number.parseFloat(
definedValue.toFixed(this.decimalPlaces),
)}`;

Expand Down
2 changes: 1 addition & 1 deletion packages/viewer/src/lib/grpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function requestUnary<R, E = unknown>(
return new Promise((resolve, reject) => {
caller((err, res) => {
if (err != null) {
reject(err);
reject(err instanceof Error ? err : new Error(String(err)));
} else if (res != null) {
resolve(res);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,14 @@ export abstract class BaseInteractionHandler implements InteractionHandler {
if (this.bodyStyleCache == null) {
const bodyStyle = window.getComputedStyle(document.body);
const fontSize =
parseFloat(bodyStyle.getPropertyValue('fontSize')) || DEFAULT_FONT_SIZE;
const lineHeight = parseFloat(bodyStyle.getPropertyValue('lineHeight'));
Number.parseFloat(bodyStyle.getPropertyValue('fontSize')) || DEFAULT_FONT_SIZE;
const lineHeight = Number.parseFloat(bodyStyle.getPropertyValue('lineHeight'));
this.bodyStyleCache = {
lineHeightPixels: Number.isFinite(lineHeight)
? lineHeight
: fontSize * DEFAULT_FONT_TO_LINE_HEIGHT_MULTIPLIER,
height:
parseFloat(bodyStyle.getPropertyValue('height')) ||
Number.parseFloat(bodyStyle.getPropertyValue('height')) ||
window.innerHeight,
};
window.setTimeout(() => {
Expand Down
Loading