Skip to content

Commit

Permalink
refactor: fix type condition
Browse files Browse the repository at this point in the history
  • Loading branch information
hkfb committed Jan 7, 2025
1 parent defb08d commit d0f917d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/layers/extruded-path-layer/extruded-path-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { vs } from "./extruded-path-layer-vertex.glsl";
import { Geometry, Model } from "@luma.gl/engine";
import type { Accessor, Color } from "@deck.gl/core";
import { TransitionSettings } from "@deck.gl/core/dist/lib/attribute/transition-settings";
import { NumberArray, TypedArray } from "@math.gl/types";
import * as _ from "lodash";

export type ExtrudedPathLayerProps<DataT> = PathLayerProps<DataT> & {
/**
Expand All @@ -14,9 +16,15 @@ export type ExtrudedPathLayerProps<DataT> = PathLayerProps<DataT> & {
};

const ATTRIBUTE_TRANSITION: Partial<TransitionSettings> = {
enter: (value: number[], chunk?: number[]) => {
enter: (value: NumberArray, chunk?: NumberArray) => {
if (!_.isTypedArray(chunk)) {
return value;
}

return chunk?.length
? chunk.subarray(chunk.length - value.length)
? ((chunk as unknown as TypedArray).subarray(
chunk.length - value.length,
) as unknown as NumberArray)
: value;
},
};
Expand Down

0 comments on commit d0f917d

Please sign in to comment.