Skip to content

Commit

Permalink
changes on VectorTileParser -> add deprecation messages (sprites move…
Browse files Browse the repository at this point in the history
…d to style)
  • Loading branch information
ftoromanoff committed Oct 17, 2023
1 parent 0f7bef7 commit bf8784d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Core/Label.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ class Label extends THREE.Object3D {
* it can be accessed through `label.content.style`, but it is highly
* discouraged to do so.
*/
constructor(content = '', coordinates, style = {}) {
constructor(content = '', coordinates, style = {}, ...args) {
if (coordinates == undefined) {
throw new Error('coordinates are mandatory to add a Label');
}
if (args.length > 0) {
console.warn('Deprecated, information on sprites should be in style.');
}

super();

Expand Down
9 changes: 8 additions & 1 deletion src/Core/Style.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,10 @@ class Style {

this.icon = {};
defineStyleProperty(this, 'icon', 'source', params.icon.source);
if (params.icon.key) {
console.warn('Deprecated: use icon.id instead');
params.icon.id = params.icon.key;
}
defineStyleProperty(this, 'icon', 'id', params.icon.id);
defineStyleProperty(this, 'icon', 'cropValues', params.icon.cropValues);
defineStyleProperty(this, 'icon', 'anchor', params.icon.anchor, 'center');
Expand Down Expand Up @@ -843,7 +847,10 @@ class Style {
*
* @param {Element} domElement - The element to set the style to.
*/
async applyToHTML(domElement) {
async applyToHTML(domElement, ...args) {
if (args.length > 0) {
console.warn('Deprecated, information on sprites should be in style.');
}
domElement.style.padding = `${this.text.padding}px`;
domElement.style.maxWidth = `${this.text.wrap}em`;

Expand Down

0 comments on commit bf8784d

Please sign in to comment.