canvasframework 0.5.33 → 0.5.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Card.js +32 -7
- package/package.json +1 -1
package/components/Card.js
CHANGED
|
@@ -260,7 +260,7 @@ add(child) {
|
|
|
260
260
|
this.drawShadow(ctx);
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
// Dessiner le fond de la carte
|
|
263
|
+
// Dessiner le fond de la carte
|
|
264
264
|
if (this.bgColor !== 'transparent') {
|
|
265
265
|
ctx.fillStyle = this.bgColor;
|
|
266
266
|
if (this.borderRadius > 0) {
|
|
@@ -272,16 +272,41 @@ add(child) {
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
// 🔴 DESSINER
|
|
276
|
-
|
|
277
|
-
ctx.translate(this.x, this.y);
|
|
275
|
+
// 🔴 DESSINER avec translate POUR LE WEB, sans translate POUR CAPACITOR
|
|
276
|
+
const isCapacitor = typeof window !== 'undefined' && window.Capacitor;
|
|
278
277
|
|
|
279
|
-
|
|
280
|
-
|
|
278
|
+
if (isCapacitor) {
|
|
279
|
+
// Capacitor : positions absolues directes
|
|
280
|
+
for (let child of this.children) {
|
|
281
|
+
if (child.visible) {
|
|
282
|
+
// Sauvegarder position relative
|
|
283
|
+
const relX = child.x;
|
|
284
|
+
const relY = child.y;
|
|
285
|
+
|
|
286
|
+
// Convertir temporairement en absolu pour le dessin
|
|
287
|
+
child.x = this.x + relX;
|
|
288
|
+
child.y = this.y + relY;
|
|
289
|
+
|
|
290
|
+
child.draw(ctx);
|
|
291
|
+
|
|
292
|
+
// Restaurer position relative
|
|
293
|
+
child.x = relX;
|
|
294
|
+
child.y = relY;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
} else {
|
|
298
|
+
// Web : translate
|
|
299
|
+
ctx.save();
|
|
300
|
+
ctx.translate(this.x, this.y);
|
|
301
|
+
|
|
302
|
+
for (let child of this.children) {
|
|
303
|
+
if (child.visible) child.draw(ctx);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
ctx.restore();
|
|
281
307
|
}
|
|
282
308
|
|
|
283
309
|
ctx.restore();
|
|
284
|
-
ctx.restore();
|
|
285
310
|
}
|
|
286
311
|
|
|
287
312
|
/**
|