Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added missing export of CanvasSourceSpecification #13369

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 1 addition & 7 deletions src/source/canvas_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ import ValidationError from '../style-spec/error/validation_error';
import type {Map} from '../ui/map';
import type Dispatcher from '../util/dispatcher';
import type {Evented} from '../util/evented';

export type CanvasSourceSpecification = {
["type"]: 'canvas';
["coordinates"]: [[number, number], [number, number], [number, number], [number, number]];
["animate"]?: boolean;
["canvas"]: string | HTMLCanvasElement;
};
import type {CanvasSourceSpecification} from '../style-spec/types';

/**
* Options to add a canvas source type to the map.
Expand Down
2 changes: 1 addition & 1 deletion src/source/image_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import assert from "assert";

import type LngLat from '../geo/lng_lat';
import type {ISource, SourceEvents} from './source';
import type {CanvasSourceSpecification} from './canvas_source';
import type {Map} from '../ui/map';
import type Dispatcher from '../util/dispatcher';
import type Tile from './tile';
Expand All @@ -26,6 +25,7 @@ import type VertexBuffer from '../gl/vertex_buffer';
import type IndexBuffer from '../gl/index_buffer';
import type {ProjectedPoint} from '../geo/projection/projection';
import type {
CanvasSourceSpecification,
ImageSourceSpecification,
VideoSourceSpecification
} from '../style-spec/types';
Expand Down
8 changes: 8 additions & 0 deletions src/style-spec/types.ts
Copy link
Member

@underoot underoot Jan 17, 2025

Choose a reason for hiding this comment

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

It's automatically generated file from style-spec. See the header of file for the details

Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,13 @@ export type ModelSourceSpecification = {
"tiles"?: Array<string>
}

export type CanvasSourceSpecification = {
Copy link
Member

Choose a reason for hiding this comment

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

CanvasSource is purely a GL JS runtime entity. Thus, it doesn't belong to the Style Specification. You can alternatively import the type from canvas_source.ts in src/source/source_types.ts it is a bit will change convention, but it reflects actual state anyway

["type"]: 'canvas';
["coordinates"]: [[number, number], [number, number], [number, number], [number, number]];
["animate"]?: boolean;
["canvas"]: string | HTMLCanvasElement;
};

export type SourceSpecification =
| VectorSourceSpecification
| RasterSourceSpecification
Expand All @@ -401,6 +408,7 @@ export type SourceSpecification =
| VideoSourceSpecification
| ImageSourceSpecification
| ModelSourceSpecification
| CanvasSourceSpecification;

export type ModelSpecification = string;

Expand Down