canvasframework 0.5.16 → 0.5.18

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.
Files changed (112) hide show
  1. package/dist/canvasframework.js +2 -0
  2. package/dist/canvasframework.js.LICENSE.txt +1 -0
  3. package/package.json +18 -17
  4. package/components/Accordion.js +0 -265
  5. package/components/AndroidDatePickerDialog.js +0 -406
  6. package/components/AppBar.js +0 -398
  7. package/components/AudioPlayer.js +0 -611
  8. package/components/Avatar.js +0 -202
  9. package/components/Banner.js +0 -342
  10. package/components/BottomNavigationBar.js +0 -433
  11. package/components/BottomSheet.js +0 -234
  12. package/components/Button.js +0 -360
  13. package/components/Camera.js +0 -644
  14. package/components/Card.js +0 -193
  15. package/components/Chart.js +0 -700
  16. package/components/Checkbox.js +0 -166
  17. package/components/Chip.js +0 -212
  18. package/components/CircularProgress.js +0 -327
  19. package/components/ContextMenu.js +0 -116
  20. package/components/DatePicker.js +0 -298
  21. package/components/Dialog.js +0 -337
  22. package/components/Divider.js +0 -125
  23. package/components/Drawer.js +0 -276
  24. package/components/FAB.js +0 -270
  25. package/components/FileUpload.js +0 -315
  26. package/components/FloatedCamera.js +0 -644
  27. package/components/IOSDatePickerWheel.js +0 -430
  28. package/components/ImageCarousel.js +0 -219
  29. package/components/ImageComponent.js +0 -223
  30. package/components/Input.js +0 -831
  31. package/components/InputDatalist.js +0 -723
  32. package/components/InputTags.js +0 -624
  33. package/components/List.js +0 -95
  34. package/components/ListItem.js +0 -269
  35. package/components/Modal.js +0 -364
  36. package/components/MorphingFAB.js +0 -428
  37. package/components/MultiSelectDialog.js +0 -206
  38. package/components/NumberInput.js +0 -271
  39. package/components/PasswordInput.js +0 -462
  40. package/components/ProgressBar.js +0 -88
  41. package/components/QRCodeReader.js +0 -539
  42. package/components/RadioButton.js +0 -151
  43. package/components/SearchInput.js +0 -315
  44. package/components/SegmentedControl.js +0 -357
  45. package/components/Select.js +0 -199
  46. package/components/SelectDialog.js +0 -255
  47. package/components/Slider.js +0 -113
  48. package/components/SliverAppBar.js +0 -139
  49. package/components/Snackbar.js +0 -243
  50. package/components/SpeedDialFAB.js +0 -397
  51. package/components/Stepper.js +0 -281
  52. package/components/SwipeableListItem.js +0 -327
  53. package/components/Switch.js +0 -147
  54. package/components/Table.js +0 -492
  55. package/components/Tabs.js +0 -423
  56. package/components/Text.js +0 -141
  57. package/components/TextField.js +0 -151
  58. package/components/TimePicker.js +0 -934
  59. package/components/Toast.js +0 -236
  60. package/components/TreeView.js +0 -420
  61. package/components/Video.js +0 -397
  62. package/components/View.js +0 -140
  63. package/components/VirtualList.js +0 -120
  64. package/core/CanvasFramework.js +0 -3034
  65. package/core/Component.js +0 -243
  66. package/core/ThemeManager.js +0 -358
  67. package/core/UIBuilder.js +0 -267
  68. package/core/WebGLCanvasAdapter.js +0 -782
  69. package/features/Column.js +0 -43
  70. package/features/Grid.js +0 -47
  71. package/features/LayoutComponent.js +0 -43
  72. package/features/OpenStreetMap.js +0 -310
  73. package/features/Positioned.js +0 -33
  74. package/features/PullToRefresh.js +0 -328
  75. package/features/Row.js +0 -40
  76. package/features/SignaturePad.js +0 -257
  77. package/features/Skeleton.js +0 -193
  78. package/features/Stack.js +0 -21
  79. package/index.js +0 -119
  80. package/manager/AccessibilityManager.js +0 -107
  81. package/manager/ErrorHandler.js +0 -59
  82. package/manager/FeatureFlags.js +0 -60
  83. package/manager/MemoryManager.js +0 -107
  84. package/manager/PerformanceMonitor.js +0 -84
  85. package/manager/SecurityManager.js +0 -54
  86. package/utils/AnimationEngine.js +0 -734
  87. package/utils/CryptoManager.js +0 -303
  88. package/utils/DataStore.js +0 -403
  89. package/utils/DevTools.js +0 -1618
  90. package/utils/DevToolsConsole.js +0 -201
  91. package/utils/EventBus.js +0 -407
  92. package/utils/FetchClient.js +0 -74
  93. package/utils/FirebaseAuth.js +0 -653
  94. package/utils/FirebaseCore.js +0 -246
  95. package/utils/FirebaseFirestore.js +0 -581
  96. package/utils/FirebaseFunctions.js +0 -97
  97. package/utils/FirebaseRealtimeDB.js +0 -498
  98. package/utils/FirebaseStorage.js +0 -612
  99. package/utils/FormValidator.js +0 -355
  100. package/utils/GeoLocationService.js +0 -62
  101. package/utils/I18n.js +0 -207
  102. package/utils/IndexedDBManager.js +0 -273
  103. package/utils/InspectionOverlay.js +0 -308
  104. package/utils/NotificationManager.js +0 -60
  105. package/utils/OfflineSyncManager.js +0 -342
  106. package/utils/PayPalPayment.js +0 -678
  107. package/utils/QueryBuilder.js +0 -478
  108. package/utils/SafeArea.js +0 -64
  109. package/utils/SecureStorage.js +0 -289
  110. package/utils/StateManager.js +0 -207
  111. package/utils/StripePayment.js +0 -552
  112. package/utils/WebSocketClient.js +0 -66
@@ -1,328 +0,0 @@
1
- import Component from '../core/Component.js';
2
-
3
- /**
4
- * Composant Pull-to-Refresh complètement autonome
5
- * Intercepte les événements touch/mouse directement
6
- * @class
7
- * @extends Component
8
- */
9
- class PullToRefresh extends Component {
10
- constructor(framework, options = {}) {
11
- super(framework, {
12
- x: 0,
13
- y: -100,
14
- width: framework.width,
15
- height: 100
16
- });
17
-
18
- this.framework = framework;
19
- this.onRefresh = options.onRefresh;
20
- this.state = 'idle';
21
- this.pullDistance = 0;
22
- this.refreshThreshold = options.refreshThreshold || 80;
23
- this.isRefreshing = false;
24
-
25
- // ✅ Propres gestionnaires d'événements
26
- this.myIsDragging = false;
27
- this.startY = 0;
28
- this.currentY = 0;
29
- this.canPull = false; // Seulement si on commence en haut
30
-
31
- // ✅ Installer nos propres écouteurs d'événements
32
- this.setupOwnEventListeners();
33
- }
34
-
35
- /**
36
- * Configure les écouteurs d'événements propres au composant
37
- */
38
- setupOwnEventListeners() {
39
- const canvas = this.framework.canvas;
40
-
41
- // Touch events
42
- this.handleTouchStartBound = this.handleOwnTouchStart.bind(this);
43
- this.handleTouchMoveBound = this.handleOwnTouchMove.bind(this);
44
- this.handleTouchEndBound = this.handleOwnTouchEnd.bind(this);
45
-
46
- canvas.addEventListener('touchstart', this.handleTouchStartBound, { passive: false });
47
- canvas.addEventListener('touchmove', this.handleTouchMoveBound, { passive: false });
48
- canvas.addEventListener('touchend', this.handleTouchEndBound, { passive: false });
49
-
50
- // Mouse events (pour desktop)
51
- this.handleMouseDownBound = this.handleOwnMouseDown.bind(this);
52
- this.handleMouseMoveBound = this.handleOwnMouseMove.bind(this);
53
- this.handleMouseUpBound = this.handleOwnMouseUp.bind(this);
54
-
55
- canvas.addEventListener('mousedown', this.handleMouseDownBound);
56
- canvas.addEventListener('mousemove', this.handleMouseMoveBound);
57
- canvas.addEventListener('mouseup', this.handleMouseUpBound);
58
- }
59
-
60
- /**
61
- * Gère le début du touch
62
- */
63
- handleOwnTouchStart(e) {
64
- const scrollOffset = this.framework.scrollOffset || 0;
65
-
66
- // ✅ On peut pull SEULEMENT si on est en haut (scrollOffset === 0)
67
- if (Math.abs(scrollOffset) < 1) {
68
- this.canPull = true;
69
- const touch = e.touches[0];
70
- this.startY = touch.clientY;
71
- this.currentY = touch.clientY;
72
- this.myIsDragging = false;
73
- } else {
74
- this.canPull = false;
75
- }
76
- }
77
-
78
- /**
79
- * Gère le mouvement du touch
80
- */
81
- handleOwnTouchMove(e) {
82
- if (!this.canPull) return;
83
-
84
- const touch = e.touches[0];
85
- this.currentY = touch.clientY;
86
- const deltaY = this.currentY - this.startY;
87
-
88
- // ✅ Si on tire vers le bas (deltaY > 0)
89
- if (deltaY > 10) {
90
- this.myIsDragging = true;
91
- this.state = 'pulling';
92
-
93
- // ✅ Effet de résistance (plus on tire, plus c'est dur)
94
- this.pullDistance = Math.min(deltaY * 0.5, this.refreshThreshold * 1.5);
95
-
96
- // ✅ Empêcher le scroll du framework si on est en train de pull
97
- if (deltaY > 20) {
98
- e.preventDefault();
99
- e.stopPropagation();
100
- }
101
- }
102
- }
103
-
104
- /**
105
- * Gère la fin du touch
106
- */
107
- handleOwnTouchEnd(e) {
108
- if (!this.canPull) return;
109
-
110
- if (this.myIsDragging && this.state === 'pulling') {
111
- if (this.pullDistance >= this.refreshThreshold) {
112
- this.triggerRefresh();
113
- } else {
114
- this.reset();
115
- }
116
- }
117
-
118
- this.myIsDragging = false;
119
- this.canPull = false;
120
- }
121
-
122
- /**
123
- * Gère le début du clic souris
124
- */
125
- handleOwnMouseDown(e) {
126
- const scrollOffset = this.framework.scrollOffset || 0;
127
-
128
- if (Math.abs(scrollOffset) < 1) {
129
- this.canPull = true;
130
- this.startY = e.clientY;
131
- this.currentY = e.clientY;
132
- this.myIsDragging = false;
133
- } else {
134
- this.canPull = false;
135
- }
136
- }
137
-
138
- /**
139
- * Gère le mouvement de la souris
140
- */
141
- handleOwnMouseMove(e) {
142
- if (!this.canPull) return;
143
-
144
- this.currentY = e.clientY;
145
- const deltaY = this.currentY - this.startY;
146
-
147
- if (deltaY > 10) {
148
- this.myIsDragging = true;
149
- this.state = 'pulling';
150
- this.pullDistance = Math.min(deltaY * 0.5, this.refreshThreshold * 1.5);
151
-
152
- if (deltaY > 20) {
153
- e.preventDefault();
154
- e.stopPropagation();
155
- }
156
- }
157
- }
158
-
159
- /**
160
- * Gère le relâchement de la souris
161
- */
162
- handleOwnMouseUp(e) {
163
- if (!this.canPull) return;
164
-
165
- if (this.myIsDragging && this.state === 'pulling') {
166
- if (this.pullDistance >= this.refreshThreshold) {
167
- this.triggerRefresh();
168
- } else {
169
- this.reset();
170
- }
171
- }
172
-
173
- this.myIsDragging = false;
174
- this.canPull = false;
175
- }
176
-
177
- /**
178
- * Déclenche le rafraîchissement
179
- */
180
- async triggerRefresh() {
181
- if (this.isRefreshing) return;
182
-
183
- console.log('🔄 Refresh déclenché!');
184
- this.state = 'refreshing';
185
- this.isRefreshing = true;
186
- this.pullDistance = 60;
187
-
188
- if (this.onRefresh) {
189
- try {
190
- await this.onRefresh();
191
- } catch (error) {
192
- console.error('Erreur refresh:', error);
193
- }
194
- }
195
-
196
- setTimeout(() => {
197
- this.reset();
198
- }, 300);
199
- }
200
-
201
- /**
202
- * Réinitialise l'état
203
- */
204
- reset() {
205
- console.log('🔄 Reset PullToRefresh');
206
-
207
- // Animation de retour élastique
208
- const animate = () => {
209
- if (this.pullDistance > 0) {
210
- this.pullDistance *= 0.8;
211
- if (this.pullDistance < 1) {
212
- this.pullDistance = 0;
213
- this.state = 'idle';
214
- this.isRefreshing = false;
215
- }
216
- requestAnimationFrame(animate);
217
- } else {
218
- this.state = 'idle';
219
- this.isRefreshing = false;
220
- }
221
- };
222
- animate();
223
- }
224
-
225
- /**
226
- * Nettoie les écouteurs d'événements
227
- */
228
- destroy() {
229
- const canvas = this.framework.canvas;
230
-
231
- canvas.removeEventListener('touchstart', this.handleTouchStartBound);
232
- canvas.removeEventListener('touchmove', this.handleTouchMoveBound);
233
- canvas.removeEventListener('touchend', this.handleTouchEndBound);
234
-
235
- canvas.removeEventListener('mousedown', this.handleMouseDownBound);
236
- canvas.removeEventListener('mousemove', this.handleMouseMoveBound);
237
- canvas.removeEventListener('mouseup', this.handleMouseUpBound);
238
- }
239
-
240
- /**
241
- * Dessine le composant
242
- */
243
- draw(ctx) {
244
- // ✅ Ne rien dessiner si pullDistance <= 0
245
- if (this.pullDistance <= 0) return;
246
-
247
- ctx.save();
248
-
249
- const progress = Math.min(1, this.pullDistance / this.refreshThreshold);
250
- const displayHeight = Math.min(this.pullDistance, 230);
251
-
252
- // Background
253
- ctx.fillStyle = 'rgba(255, 255, 255, 0.95)';
254
- ctx.fillRect(0, 0, this.width, displayHeight);
255
-
256
- // Séparateur
257
- ctx.strokeStyle = 'rgba(0, 0, 0, 0.1)';
258
- ctx.lineWidth = 1;
259
- ctx.beginPath();
260
- ctx.moveTo(0, displayHeight);
261
- ctx.lineTo(this.width, displayHeight);
262
- ctx.stroke();
263
-
264
- const centerX = this.width / 2;
265
- const centerY = Math.min(displayHeight / 0.6, 90);
266
- const spinnerRadius = 16;
267
-
268
- if (this.state === 'refreshing' || this.isRefreshing) {
269
- // Spinner animé
270
- const rotation = (Date.now() / 1000) * Math.PI * 2;
271
- ctx.strokeStyle = '#6200EE';
272
- ctx.lineWidth = 3;
273
- ctx.lineCap = 'round';
274
- ctx.beginPath();
275
- ctx.arc(centerX, centerY, spinnerRadius, rotation, rotation + Math.PI * 1.5);
276
- ctx.stroke();
277
-
278
- if (displayHeight > 35) {
279
- ctx.fillStyle = '#666666';
280
- ctx.font = '14px -apple-system, sans-serif';
281
- ctx.textAlign = 'center';
282
- ctx.textBaseline = 'middle';
283
- ctx.fillText('Actualisation...', centerX, centerY + 28);
284
- }
285
-
286
- } else if (this.state === 'pulling') {
287
- // Cercle de progression
288
- ctx.strokeStyle = progress >= 1 ? '#6200EE' : '#CCCCCC';
289
- ctx.lineWidth = 3;
290
- ctx.lineCap = 'round';
291
- ctx.beginPath();
292
- ctx.arc(centerX, centerY, spinnerRadius, -Math.PI / 2, (-Math.PI / 2) + (Math.PI * 2 * progress));
293
- ctx.stroke();
294
-
295
- // Flèche
296
- ctx.save();
297
- ctx.translate(centerX, centerY);
298
- ctx.rotate(progress >= 1 ? Math.PI : 0);
299
-
300
- ctx.beginPath();
301
- ctx.moveTo(0, -8);
302
- ctx.lineTo(-5, -3);
303
- ctx.lineTo(5, -3);
304
- ctx.closePath();
305
- ctx.fillStyle = progress >= 1 ? '#6200EE' : '#999999';
306
- ctx.fill();
307
-
308
- ctx.restore();
309
-
310
- if (displayHeight > 35) {
311
- ctx.fillStyle = '#666666';
312
- ctx.font = '14px -apple-system, sans-serif';
313
- ctx.textAlign = 'center';
314
- ctx.textBaseline = 'middle';
315
-
316
- if (progress >= 1) {
317
- ctx.fillText('Relâchez pour actualiser', centerX, centerY + 28);
318
- } else {
319
- ctx.fillText('Tirez pour actualiser', centerX, centerY + 28);
320
- }
321
- }
322
- }
323
-
324
- ctx.restore();
325
- }
326
- }
327
-
328
- export default PullToRefresh;
package/features/Row.js DELETED
@@ -1,40 +0,0 @@
1
- import LayoutComponent from './LayoutComponent.js';
2
-
3
- class Row extends LayoutComponent {
4
- constructor(framework, options = {}) {
5
- super(framework, options);
6
- this.align = options.align || 'start'; // start | center | end
7
- }
8
-
9
- layout() {
10
- let x = this.x;
11
- let maxHeight = 0;
12
-
13
- for (const child of this.children) {
14
- child.x = x;
15
-
16
- if (this.align === 'center') {
17
- child.y = this.y + (this.height - child.height) / 2;
18
- } else if (this.align === 'end') {
19
- child.y = this.y + this.height - child.height;
20
- } else {
21
- child.y = this.y;
22
- }
23
-
24
- x += child.width + this.spacing;
25
- maxHeight = Math.max(maxHeight, child.height);
26
- }
27
-
28
- this.width = x - this.x - this.spacing;
29
- if (!this.height) this.height = maxHeight;
30
-
31
- // Layout récursif automatique des enfants
32
- for (const child of this.children) {
33
- if (typeof child.layoutRecursive === 'function') {
34
- child.layoutRecursive();
35
- }
36
- }
37
- }
38
- }
39
-
40
- export default Row;
@@ -1,257 +0,0 @@
1
- import Component from '../core/Component.js';
2
-
3
- /**
4
- * Pad de signature électronique
5
- * @class
6
- * @extends Component
7
- */
8
- class SignaturePad extends Component {
9
- constructor(framework, options = {}) {
10
- super(framework, {
11
- width: options.width || 300,
12
- height: options.height || 200,
13
- ...options
14
- });
15
-
16
- this.points = [];
17
- this.isDrawing = false;
18
- this.strokeColor = options.strokeColor || '#000000';
19
- this.strokeWidth = options.strokeWidth || 3; // Plus épais par défaut
20
- this.backgroundColor = options.backgroundColor || '#FFFFFF';
21
- this.onSignatureChange = options.onSignatureChange;
22
- this.lastPoint = null;
23
-
24
- // Canvas interne pour stocker la signature
25
- this.signatureCanvas = document.createElement('canvas');
26
- this.signatureCanvas.width = this.width;
27
- this.signatureCanvas.height = this.height;
28
- this.signatureCtx = this.signatureCanvas.getContext('2d');
29
-
30
- // IMPORTANT: Configurer le contexte UNE SEULE FOIS
31
- this.signatureCtx.strokeStyle = this.strokeColor;
32
- this.signatureCtx.fillStyle = this.strokeColor;
33
- this.signatureCtx.lineWidth = this.strokeWidth;
34
- this.signatureCtx.lineCap = 'round';
35
- this.signatureCtx.lineJoin = 'round';
36
-
37
- // Initialiser le canvas
38
- this.clearSignature();
39
-
40
- // Bind des méthodes
41
- this.handlePress = this.handlePress.bind(this);
42
- this.handleMove = this.handleMove.bind(this);
43
- this.handleRelease = this.handleRelease.bind(this);
44
-
45
- // IMPORTANT: Définir les handlers pour le framework
46
- this.onPress = this.handlePress;
47
- this.onMove = this.handleMove;
48
- this.onRelease = this.handleRelease;
49
- }
50
-
51
- /**
52
- * Gère le début du dessin
53
- */
54
- handlePress(x, y) {
55
- if (!this.isPointInside(x, y)) return false;
56
-
57
- this.isDrawing = true;
58
- const relativeX = x - this.x;
59
- const relativeY = (y - this.framework.scrollOffset) - this.y;
60
-
61
- // Stocker le point
62
- this.lastPoint = { x: relativeX, y: relativeY };
63
- this.points.push([{ x: relativeX, y: relativeY }]);
64
-
65
- // Dessiner un point initial
66
- this.signatureCtx.fillStyle = this.strokeColor;
67
- this.signatureCtx.beginPath();
68
- this.signatureCtx.arc(relativeX, relativeY, this.strokeWidth / 2, 0, Math.PI * 2);
69
- this.signatureCtx.fill();
70
-
71
- return true;
72
- }
73
-
74
- /**
75
- * Gère le dessin
76
- */
77
- handleMove(x, y) {
78
- if (!this.isDrawing) return false;
79
-
80
- const relativeX = x - this.x;
81
- const relativeY = (y - this.framework.scrollOffset) - this.y;
82
-
83
- // S'assurer que les coordonnées sont dans les limites
84
- if (relativeX < 0 || relativeX > this.width ||
85
- relativeY < 0 || relativeY > this.height) {
86
- return false;
87
- }
88
-
89
- // OPTIMISATION: Dessiner directement sans vérifications lourdes
90
- this.signatureCtx.beginPath();
91
- this.signatureCtx.moveTo(this.lastPoint.x, this.lastPoint.y);
92
- this.signatureCtx.lineTo(relativeX, relativeY);
93
- this.signatureCtx.stroke();
94
-
95
- // Ajouter le point (simplifié)
96
- if (this.points.length > 0) {
97
- this.points[this.points.length - 1].push({ x: relativeX, y: relativeY });
98
- }
99
-
100
- // Mettre à jour le dernier point
101
- this.lastPoint = { x: relativeX, y: relativeY };
102
-
103
- return true;
104
- }
105
-
106
- /**
107
- * Gère la fin du dessin
108
- */
109
- handleRelease(x, y) {
110
- if (this.isDrawing) {
111
- this.isDrawing = false;
112
- this.lastPoint = null;
113
-
114
- // Callback seulement à la fin
115
- if (this.onSignatureChange) {
116
- this.onSignatureChange(this.points);
117
- }
118
-
119
- return true;
120
- }
121
- return false;
122
- }
123
-
124
- /**
125
- * Efface la signature
126
- */
127
- clear() {
128
- this.points = [];
129
- this.clearSignature();
130
-
131
- if (this.onSignatureChange) {
132
- this.onSignatureChange([]);
133
- }
134
- }
135
-
136
- /**
137
- * Efface le canvas interne
138
- */
139
- clearSignature() {
140
- this.signatureCtx.fillStyle = this.backgroundColor;
141
- this.signatureCtx.fillRect(0, 0, this.width, this.height);
142
-
143
- // Réinitialiser le style du trait
144
- this.signatureCtx.strokeStyle = this.strokeColor;
145
- this.signatureCtx.fillStyle = this.strokeColor;
146
- this.signatureCtx.lineWidth = this.strokeWidth;
147
- this.signatureCtx.lineCap = 'round';
148
- this.signatureCtx.lineJoin = 'round';
149
- }
150
-
151
- /**
152
- * Récupère la signature comme Data URL
153
- */
154
- getSignatureAsDataURL(type = 'image/png', quality = 1.0) {
155
- return this.signatureCanvas.toDataURL(type, quality);
156
- }
157
-
158
- /**
159
- * Récupère la signature comme blob
160
- */
161
- getSignatureAsBlob(callback, type = 'image/png', quality = 1.0) {
162
- this.signatureCanvas.toBlob(callback, type, quality);
163
- }
164
-
165
- /**
166
- * Vérifie si la signature est vide
167
- */
168
- isEmpty() {
169
- return this.points.length === 0 || this.points.every(stroke => stroke.length === 0);
170
- }
171
-
172
- /**
173
- * Dessine le composant
174
- */
175
- draw(ctx) {
176
- ctx.save();
177
-
178
- // Fond du pad avec bordure visible
179
- ctx.fillStyle = this.backgroundColor;
180
- ctx.strokeStyle = '#2196F3'; // Bleu pour voir le pad
181
- ctx.lineWidth = 2;
182
-
183
- // Rectangle avec bordure
184
- ctx.fillRect(this.x, this.y, this.width, this.height);
185
- ctx.strokeRect(this.x, this.y, this.width, this.height);
186
-
187
- // Ligne de signature (guide)
188
- ctx.strokeStyle = '#DDDDDD';
189
- ctx.lineWidth = 1;
190
- ctx.setLineDash([5, 5]);
191
- ctx.beginPath();
192
- ctx.moveTo(this.x + 20, this.y + this.height - 40);
193
- ctx.lineTo(this.x + this.width - 20, this.y + this.height - 40);
194
- ctx.stroke();
195
- ctx.setLineDash([]);
196
-
197
- // Texte indicatif
198
- if (this.isEmpty()) {
199
- ctx.fillStyle = '#999999';
200
- ctx.font = '16px Arial';
201
- ctx.textAlign = 'center';
202
- ctx.textBaseline = 'middle';
203
- ctx.fillText('Signez ici', this.x + this.width / 2, this.y + this.height / 2);
204
- }
205
-
206
- // Dessiner la signature depuis le canvas interne
207
- ctx.drawImage(this.signatureCanvas, this.x, this.y);
208
-
209
- // Indicateur de dessin en cours
210
- if (this.isDrawing && this.lastPoint) {
211
- ctx.fillStyle = 'rgba(33, 150, 243, 0.3)';
212
- ctx.beginPath();
213
- ctx.arc(
214
- this.x + this.lastPoint.x,
215
- this.y + this.lastPoint.y,
216
- this.strokeWidth * 3,
217
- 0,
218
- Math.PI * 2
219
- );
220
- ctx.fill();
221
- }
222
-
223
- // DEBUG: Afficher les coordonnées
224
- ctx.fillStyle = '#666666';
225
- ctx.font = '10px Arial';
226
- ctx.textAlign = 'left';
227
- ctx.fillText(
228
- `x:${this.x} y:${this.y} ${this.width}x${this.height}`,
229
- this.x + 5,
230
- this.y + 15
231
- );
232
-
233
- ctx.restore();
234
- }
235
-
236
- /**
237
- * Vérifie si un point est dans les limites
238
- */
239
- isPointInside(x, y) {
240
- const adjustedY = y - this.framework.scrollOffset;
241
- return x >= this.x &&
242
- x <= this.x + this.width &&
243
- adjustedY >= this.y &&
244
- adjustedY <= this.y + this.height;
245
- }
246
-
247
- /**
248
- * Nettoie les ressources
249
- */
250
- destroy() {
251
- this.signatureCanvas.width = 0;
252
- this.signatureCanvas.height = 0;
253
- super.destroy && super.destroy();
254
- }
255
- }
256
-
257
- export default SignaturePad;