@ray-js/graffiti 1.1.5-beta.1 → 1.1.6
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/lib/components/index.js +6 -11
- package/lib/components/index.rjs +5 -2
- package/lib/props.js +1 -0
- package/package.json +1 -1
package/lib/components/index.js
CHANGED
|
@@ -150,12 +150,8 @@ Component({
|
|
|
150
150
|
},
|
|
151
151
|
drawData: {
|
|
152
152
|
// 初始绘制数据
|
|
153
|
-
type:
|
|
154
|
-
|
|
155
|
-
if (newValue && this.render) {
|
|
156
|
-
this.render.drawData(newValue);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
153
|
+
type: Array,
|
|
154
|
+
value: []
|
|
159
155
|
}
|
|
160
156
|
},
|
|
161
157
|
data: {
|
|
@@ -178,7 +174,8 @@ Component({
|
|
|
178
174
|
pixelGap,
|
|
179
175
|
mode,
|
|
180
176
|
scale,
|
|
181
|
-
isDragging
|
|
177
|
+
isDragging,
|
|
178
|
+
drawData
|
|
182
179
|
} = this.data;
|
|
183
180
|
width = getDeviceRealPx(width);
|
|
184
181
|
height = getDeviceRealPx(height);
|
|
@@ -219,11 +216,9 @@ Component({
|
|
|
219
216
|
penColor: this.data.penColor,
|
|
220
217
|
scale: scale,
|
|
221
218
|
isDragging: isDragging,
|
|
222
|
-
boxRect: rect
|
|
219
|
+
boxRect: rect,
|
|
220
|
+
drawData: drawData
|
|
223
221
|
});
|
|
224
|
-
if (this.data.drawData) {
|
|
225
|
-
this.render.drawData(this.data.drawData);
|
|
226
|
-
}
|
|
227
222
|
}
|
|
228
223
|
},
|
|
229
224
|
methods: {
|
package/lib/components/index.rjs
CHANGED
|
@@ -17,6 +17,7 @@ export default Render({
|
|
|
17
17
|
scale,
|
|
18
18
|
isDragging,
|
|
19
19
|
boxRect,
|
|
20
|
+
drawData,
|
|
20
21
|
}) {
|
|
21
22
|
this.scale = scale || 1;
|
|
22
23
|
this.isDragging = isDragging || false;
|
|
@@ -75,6 +76,9 @@ export default Render({
|
|
|
75
76
|
// 初始化画布, 绘制像素点
|
|
76
77
|
this.createPixel(pixelColor);
|
|
77
78
|
|
|
79
|
+
// 初始化传入的绘制数据
|
|
80
|
+
this.initDrawData(Array.isArray(drawData) ? drawData : []);
|
|
81
|
+
|
|
78
82
|
this.updateScale(scale);
|
|
79
83
|
|
|
80
84
|
canvas.addEventListener('touchstart', this.handleTouchstart, false);
|
|
@@ -274,8 +278,7 @@ export default Render({
|
|
|
274
278
|
this.callMethod('genImageData', { base64, gridData: this.gridData });
|
|
275
279
|
},
|
|
276
280
|
|
|
277
|
-
|
|
278
|
-
console.log('render drawData', list);
|
|
281
|
+
initDrawData(list) {
|
|
279
282
|
for (const item of list) {
|
|
280
283
|
this.fillPixel(item.x, item.y, item.color);
|
|
281
284
|
}
|
package/lib/props.js
CHANGED