@archireport/react-native-svg-draw 2.3.0 → 2.3.2
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/commonjs/components/DrawCore/CurrentAnimatedItem.js +63 -55
- package/lib/commonjs/components/DrawCore/CurrentAnimatedItem.js.map +1 -1
- package/lib/commonjs/components/DrawCore/CurrentAnimatedText.js +2 -2
- package/lib/commonjs/components/DrawCore/CurrentAnimatedText.js.map +1 -1
- package/lib/commonjs/components/DrawCore/Item.js +2 -1
- package/lib/commonjs/components/DrawCore/Item.js.map +1 -1
- package/lib/module/components/DrawCore/CurrentAnimatedItem.js +63 -55
- package/lib/module/components/DrawCore/CurrentAnimatedItem.js.map +1 -1
- package/lib/module/components/DrawCore/CurrentAnimatedText.js +2 -2
- package/lib/module/components/DrawCore/CurrentAnimatedText.js.map +1 -1
- package/lib/module/components/DrawCore/Item.js +2 -1
- package/lib/module/components/DrawCore/Item.js.map +1 -1
- package/lib/typescript/components/DrawCore/CurrentAnimatedItem.d.ts.map +1 -1
- package/lib/typescript/components/DrawCore/CurrentAnimatedText.d.ts.map +1 -1
- package/lib/typescript/components/DrawCore/useDrawHook.d.ts +0 -1
- package/lib/typescript/components/DrawCore/useDrawHook.d.ts.map +1 -1
- package/lib/typescript/components/Slider/sliderStyle.d.ts +2 -2
- package/package.json +5 -5
- package/src/components/DrawCore/CurrentAnimatedItem.tsx +42 -21
- package/src/components/DrawCore/CurrentAnimatedText.tsx +8 -4
- package/src/components/DrawCore/Item.tsx +2 -2
|
@@ -151,13 +151,13 @@ const propAdapter = createAnimatedPropAdapter(
|
|
|
151
151
|
Object.keys(props).includes('fill') &&
|
|
152
152
|
(typeof props.fill === 'string' || typeof props.fill === 'number')
|
|
153
153
|
) {
|
|
154
|
-
props.fill = { type: 0, payload: processColor(props.fill) };
|
|
154
|
+
props.fill = { type: 0, payload: processColor(props.fill as string) };
|
|
155
155
|
}
|
|
156
156
|
if (
|
|
157
157
|
Object.keys(props).includes('stroke') &&
|
|
158
158
|
(typeof props.stroke === 'string' || typeof props.stroke === 'number')
|
|
159
159
|
) {
|
|
160
|
-
props.stroke = { type: 0, payload: processColor(props.stroke) };
|
|
160
|
+
props.stroke = { type: 0, payload: processColor(props.stroke as string) };
|
|
161
161
|
}
|
|
162
162
|
},
|
|
163
163
|
['fill', 'stroke']
|
|
@@ -188,7 +188,7 @@ export default function CurrentAnimatedItem() {
|
|
|
188
188
|
rx: coordinates.rx,
|
|
189
189
|
ry: coordinates.ry,
|
|
190
190
|
fill: 'transparent',
|
|
191
|
-
stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
|
|
191
|
+
//stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
|
|
192
192
|
opacity: currentItem.value?.type === 'ellipse' ? 1 : 0,
|
|
193
193
|
strokeWidth:
|
|
194
194
|
currentItem.value?.type === 'ellipse'
|
|
@@ -213,7 +213,7 @@ export default function CurrentAnimatedItem() {
|
|
|
213
213
|
x2: coordinates.x2,
|
|
214
214
|
y2: coordinates.y2,
|
|
215
215
|
fill: 'transparent',
|
|
216
|
-
stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
|
|
216
|
+
//stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
|
|
217
217
|
opacity: currentItem.value?.type === 'singleHead' ? 1 : 0,
|
|
218
218
|
strokeWidth:
|
|
219
219
|
currentItem.value?.type === 'singleHead'
|
|
@@ -239,7 +239,7 @@ export default function CurrentAnimatedItem() {
|
|
|
239
239
|
x2: coordinates.x2,
|
|
240
240
|
y2: coordinates.y2,
|
|
241
241
|
fill: 'transparent',
|
|
242
|
-
stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
|
|
242
|
+
//stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
|
|
243
243
|
opacity: currentItem.value?.type === 'doubleHead' ? 1 : 0,
|
|
244
244
|
strokeWidth:
|
|
245
245
|
currentItem.value?.type === 'doubleHead'
|
|
@@ -307,7 +307,6 @@ export default function CurrentAnimatedItem() {
|
|
|
307
307
|
first: boolean;
|
|
308
308
|
}) => {
|
|
309
309
|
'worklet';
|
|
310
|
-
//console.log('*******************');
|
|
311
310
|
const dist = distance(x1, y1, x2, y2);
|
|
312
311
|
const textLength = getTextLength();
|
|
313
312
|
const newDist = (!textLength ? dist : dist - textLength) / 2;
|
|
@@ -362,7 +361,7 @@ export default function CurrentAnimatedItem() {
|
|
|
362
361
|
x2,
|
|
363
362
|
y2,
|
|
364
363
|
fill: 'transparent',
|
|
365
|
-
stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
|
|
364
|
+
//stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
|
|
366
365
|
opacity: currentItem.value?.type === 'doubleArrows' ? 1 : 0,
|
|
367
366
|
strokeWidth:
|
|
368
367
|
currentItem.value?.type === 'doubleArrows'
|
|
@@ -402,7 +401,7 @@ export default function CurrentAnimatedItem() {
|
|
|
402
401
|
x2,
|
|
403
402
|
y2,
|
|
404
403
|
fill: 'transparent',
|
|
405
|
-
stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
|
|
404
|
+
//stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
|
|
406
405
|
opacity: currentItem.value?.type === 'doubleArrows' ? 1 : 0,
|
|
407
406
|
strokeWidth:
|
|
408
407
|
currentItem.value?.type === 'doubleArrows'
|
|
@@ -470,14 +469,16 @@ export default function CurrentAnimatedItem() {
|
|
|
470
469
|
}
|
|
471
470
|
|
|
472
471
|
return {
|
|
473
|
-
top: y -
|
|
472
|
+
top: y - 25,
|
|
474
473
|
left: x - getTextLength() / 2,
|
|
475
474
|
fontSize: 10 + (currentItem.value?.strokeWidth ?? 0) * 2,
|
|
476
475
|
color: currentItem.value?.color
|
|
477
476
|
? hslToRgb(currentItem.value?.color)
|
|
478
477
|
: 'white',
|
|
479
478
|
transform: [{ rotateZ: `${angle}deg` }],
|
|
479
|
+
//backgroundColor: 'red',
|
|
480
480
|
width: getTextLength(),
|
|
481
|
+
height: 50,
|
|
481
482
|
};
|
|
482
483
|
},
|
|
483
484
|
null,
|
|
@@ -496,7 +497,7 @@ export default function CurrentAnimatedItem() {
|
|
|
496
497
|
width: coordinates.width,
|
|
497
498
|
height: coordinates.height,
|
|
498
499
|
fill: 'transparent',
|
|
499
|
-
stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
|
|
500
|
+
//stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
|
|
500
501
|
opacity: currentItem.value?.type === 'rectangle' ? 1 : 0,
|
|
501
502
|
strokeWidth:
|
|
502
503
|
currentItem.value?.type === 'rectangle'
|
|
@@ -519,10 +520,11 @@ export default function CurrentAnimatedItem() {
|
|
|
519
520
|
);
|
|
520
521
|
return {
|
|
521
522
|
d: d,
|
|
523
|
+
//opacity: 1,
|
|
524
|
+
opacity: currentItem.value?.type === 'pen' ? 1 : 0,
|
|
525
|
+
//stroke: currentItem.value?.color || "black",
|
|
522
526
|
strokeWidth:
|
|
523
527
|
currentItem.value?.type === 'pen' ? currentItem.value.strokeWidth : 0,
|
|
524
|
-
stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
|
|
525
|
-
opacity: currentItem.value?.type === 'pen' ? 1 : 0,
|
|
526
528
|
fill: 'transparent',
|
|
527
529
|
markerStart: 'selection',
|
|
528
530
|
markerEnd: 'selection',
|
|
@@ -552,15 +554,27 @@ export default function CurrentAnimatedItem() {
|
|
|
552
554
|
|
|
553
555
|
return (
|
|
554
556
|
<>
|
|
555
|
-
<AnimatedEllipse
|
|
557
|
+
<AnimatedEllipse
|
|
558
|
+
animatedProps={ellipseAnimatedProps}
|
|
559
|
+
stroke={currentItem.value?.color || 'black'}
|
|
560
|
+
/>
|
|
556
561
|
<G markerStart="url(#selection)" markerEnd="url(#selection)">
|
|
557
|
-
<AnimatedLine
|
|
562
|
+
<AnimatedLine
|
|
563
|
+
animatedProps={singleHeadAnimatedProps}
|
|
564
|
+
stroke={currentItem.value?.color || 'black'}
|
|
565
|
+
/>
|
|
558
566
|
</G>
|
|
559
567
|
<G markerStart="url(#selection)" markerEnd="url(#selection)">
|
|
560
|
-
<AnimatedLine
|
|
568
|
+
<AnimatedLine
|
|
569
|
+
animatedProps={doubleHeadAnimatedProps}
|
|
570
|
+
stroke={currentItem.value?.color || 'black'}
|
|
571
|
+
/>
|
|
561
572
|
</G>
|
|
562
573
|
<G markerStart="url(#selection)" markerEnd="url(#selection)">
|
|
563
|
-
<AnimatedLine
|
|
574
|
+
<AnimatedLine
|
|
575
|
+
animatedProps={doubleArrowsAnimatedPropsFirst}
|
|
576
|
+
stroke={currentItem.value?.color || 'black'}
|
|
577
|
+
/>
|
|
564
578
|
|
|
565
579
|
<AnimatedTextInput
|
|
566
580
|
animatedProps={{
|
|
@@ -575,7 +589,6 @@ export default function CurrentAnimatedItem() {
|
|
|
575
589
|
ref={doubleArrowTextInput}
|
|
576
590
|
underlineColorAndroid={'transparent'}
|
|
577
591
|
onChangeText={(text) => {
|
|
578
|
-
console.log('onChangeText', text);
|
|
579
592
|
if (currentItem.value?.type === 'doubleArrows') {
|
|
580
593
|
currentItem.value = {
|
|
581
594
|
...currentItem.value,
|
|
@@ -590,11 +603,19 @@ export default function CurrentAnimatedItem() {
|
|
|
590
603
|
}}
|
|
591
604
|
/>
|
|
592
605
|
|
|
593
|
-
<AnimatedLine
|
|
606
|
+
<AnimatedLine
|
|
607
|
+
animatedProps={doubleArrowsAnimatedPropsLast}
|
|
608
|
+
stroke={currentItem.value?.color || 'black'}
|
|
609
|
+
/>
|
|
594
610
|
</G>
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
611
|
+
<AnimatedRectangle
|
|
612
|
+
animatedProps={rectangleAnimatedProps}
|
|
613
|
+
stroke={currentItem.value?.color || 'black'}
|
|
614
|
+
/>
|
|
615
|
+
<AnimatedPath
|
|
616
|
+
animatedProps={penAnimatedProps}
|
|
617
|
+
stroke={currentItem.value?.color || 'black'}
|
|
618
|
+
/>
|
|
598
619
|
</>
|
|
599
620
|
);
|
|
600
621
|
}
|
|
@@ -86,16 +86,20 @@ export default function CurrentAnimatedText({
|
|
|
86
86
|
translateX:
|
|
87
87
|
(currentItem.value?.type === 'text' &&
|
|
88
88
|
(typeof currentItem.value.data.x === 'string'
|
|
89
|
-
? parseFloat(currentItem.value.data.x)
|
|
90
|
-
: currentItem.value.data.x
|
|
89
|
+
? parseFloat(currentItem.value.data.x) - 28
|
|
90
|
+
: currentItem.value.data.x
|
|
91
|
+
? currentItem.value.data.x - 28
|
|
92
|
+
: 0)) ||
|
|
91
93
|
0,
|
|
92
94
|
},
|
|
93
95
|
{
|
|
94
96
|
translateY:
|
|
95
97
|
(currentItem.value?.type === 'text' &&
|
|
96
98
|
(typeof currentItem.value.data.y === 'string'
|
|
97
|
-
? parseFloat(currentItem.value.data.y)
|
|
98
|
-
: currentItem.value.data.y
|
|
99
|
+
? parseFloat(currentItem.value.data.y) - 12
|
|
100
|
+
: currentItem.value.data.y
|
|
101
|
+
? currentItem.value.data.y - 12
|
|
102
|
+
: 0)) ||
|
|
99
103
|
0,
|
|
100
104
|
},
|
|
101
105
|
],
|
|
@@ -265,7 +265,7 @@ export default function Item({
|
|
|
265
265
|
case 'text':
|
|
266
266
|
return (
|
|
267
267
|
<G onPress={onPress}>
|
|
268
|
-
<Rect {...item.data} onPress={onPress} />
|
|
268
|
+
<Rect {...item.data} onPress={onPress} fill={'transparent'} />
|
|
269
269
|
<ForeignObject
|
|
270
270
|
x={item.data.x}
|
|
271
271
|
y={item.data.y}
|
|
@@ -276,7 +276,7 @@ export default function Item({
|
|
|
276
276
|
style={[
|
|
277
277
|
styles.textZone,
|
|
278
278
|
{
|
|
279
|
-
width: item.data.width,
|
|
279
|
+
width: item.data.width as number,
|
|
280
280
|
},
|
|
281
281
|
]}
|
|
282
282
|
>
|