@budibase/bbui 3.34.10 → 3.35.0
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/bbui",
|
|
3
3
|
"description": "A UI solution used in the different Budibase projects.",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.35.0",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"module": "dist/bbui.mjs",
|
|
7
7
|
"exports": {
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "f1fae8b647a4c3812f725e1c1cd0680d5501ec83"
|
|
107
107
|
}
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
const dispatch = createEventDispatcher()
|
|
7
7
|
|
|
8
|
-
let last
|
|
9
|
-
|
|
10
8
|
export let value
|
|
11
9
|
export let disabled = false
|
|
12
10
|
export let editable = true
|
|
@@ -21,9 +19,10 @@
|
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
export function toFile() {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const pixelWidth = canvasRef?.width || width
|
|
23
|
+
const pixelHeight = canvasRef?.height || height
|
|
24
|
+
const imageData = canvasContext.getImageData(0, 0, pixelWidth, pixelHeight)
|
|
25
|
+
const data = imageData.data.some(channel => channel !== 0)
|
|
27
26
|
|
|
28
27
|
if (!data) {
|
|
29
28
|
return
|
|
@@ -75,43 +74,19 @@
|
|
|
75
74
|
updated = false
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
$: if (last) {
|
|
79
|
-
dispatch("update")
|
|
80
|
-
}
|
|
81
|
-
|
|
82
77
|
onMount(() => {
|
|
83
78
|
if (!editable) {
|
|
84
79
|
return
|
|
85
80
|
}
|
|
86
81
|
|
|
87
|
-
const getPos = e => {
|
|
88
|
-
let rect = canvasRef.getBoundingClientRect()
|
|
89
|
-
const canvasX = e.offsetX || e.targetTouches?.[0].pageX - rect.left
|
|
90
|
-
const canvasY = e.offsetY || e.targetTouches?.[0].pageY - rect.top
|
|
91
|
-
|
|
92
|
-
return { x: canvasX, y: canvasY }
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const checkUp = e => {
|
|
96
|
-
last = getPos(e)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
canvasRef.addEventListener("pointerdown", e => {
|
|
100
|
-
const current = getPos(e)
|
|
101
|
-
//If the cursor didn't move at all, block the default pointerdown
|
|
102
|
-
if (last?.x === current?.x && last?.y === current?.y) {
|
|
103
|
-
e.preventDefault()
|
|
104
|
-
e.stopImmediatePropagation()
|
|
105
|
-
}
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
document.addEventListener("pointerup", checkUp)
|
|
109
|
-
|
|
110
82
|
signature = new Atrament(canvasRef, {
|
|
111
83
|
width,
|
|
112
84
|
height,
|
|
113
85
|
color: "white",
|
|
114
86
|
})
|
|
87
|
+
signature.addEventListener("dirty", () => {
|
|
88
|
+
dispatch("update")
|
|
89
|
+
})
|
|
115
90
|
|
|
116
91
|
signature.weight = 4
|
|
117
92
|
signature.smoothing = 2
|
|
@@ -129,7 +104,6 @@
|
|
|
129
104
|
|
|
130
105
|
return () => {
|
|
131
106
|
signature.destroy()
|
|
132
|
-
document.removeEventListener("pointerup", checkUp)
|
|
133
107
|
}
|
|
134
108
|
})
|
|
135
109
|
</script>
|
|
@@ -202,7 +176,7 @@
|
|
|
202
176
|
</div>
|
|
203
177
|
|
|
204
178
|
<style>
|
|
205
|
-
.indicator-overlay {
|
|
179
|
+
.canvas-wrap .indicator-overlay {
|
|
206
180
|
position: absolute;
|
|
207
181
|
width: 100%;
|
|
208
182
|
height: 100%;
|
|
@@ -254,7 +228,7 @@
|
|
|
254
228
|
position: absolute;
|
|
255
229
|
width: 100%;
|
|
256
230
|
height: 100%;
|
|
257
|
-
pointer-events: none;
|
|
231
|
+
pointer-events: none !important;
|
|
258
232
|
padding: var(--spectrum-global-dimension-size-150);
|
|
259
233
|
text-align: right;
|
|
260
234
|
z-index: 2;
|