Skip to content

Commit

Permalink
feat: add support for image sprites
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
IconSymbolizer.image can be a Sprite
  • Loading branch information
Kai Volland committed Oct 19, 2023
1 parent 222c641 commit f82e4dc
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,28 @@ export interface TextSymbolizer extends BasePointSymbolizer {
fontWeight?: Expression<'normal' | 'bold'>;
}

/**
* Configuration for a sprite image.
*/
export type Sprite = {
/**
* A path/URL to the sprite image file.
*/
source: Expression<string>;
/**
* The starting position of the sprite to cut out. Origing [0, 0] is top left.
*/
position: [Expression<number>, Expression<number>];
/**
* The width of the sprite.
*/
width: Expression<number>;
/**
* The height of the sprite.
*/
height: Expression<number>;
};

/**
* An IconSymbolizer describes the style representation of POINT data if styled
* with a specific icon.
Expand Down Expand Up @@ -423,7 +445,7 @@ export interface IconSymbolizer extends BasePointSymbolizer {
/**
* A path/URL to the icon image file.
*/
image?: Expression<string>;
image?: Expression<string> | Sprite;
/**
* An optional configuration for the image format as MIME type.
* This might be needed if the image(path) has no filending specified. e.g. http://myserver/getImage
Expand Down

0 comments on commit f82e4dc

Please sign in to comment.