Skip to content

Commit b8186fa

Browse files
author
Julien
committed
style(sdk): add deprecation warning
1 parent 793505c commit b8186fa

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

engine/modules/entities/src/main/resources/view/entity-module/GraphicEntityModule.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,26 @@ export class GraphicEntityModule {
206206
const height = globalData.height
207207
this.globalData.toWorldUnits = fitAspectRatio(width, height, WIDTH, HEIGHT)
208208
api.toWorldUnits = this.globalData.toWorldUnits
209+
209210
// Retro-compatibility
210-
api.coeff = api.toWorldUnits
211-
211+
Object.defineProperty(api, 'coeff', {get: () => {
212+
const msg = 'The "coeff" property of GraphicEntityModule\'s API is deprecated, please use "toWorldUnits" instead'
213+
const stack = (new Error).stack
214+
215+
if (console.groupCollapsed) {
216+
console.groupCollapsed(
217+
"%cDeprecation Warning: %c%s",
218+
"color:#614108;background:#fffbe6",
219+
"font-weight:normal;color:#614108;background:#fffbe6",
220+
msg
221+
)
222+
console.warn(stack)
223+
console.groupEnd()
224+
} else {
225+
console.warn("Deprecation Warning: ", msg)
226+
}
227+
228+
return api.toWorldUnits
229+
}})
212230
}
213231
}

0 commit comments

Comments
 (0)