@archireport/react-native-svg-draw 2.3.0 → 2.3.1

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.
@@ -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,13 +469,14 @@ export default function CurrentAnimatedItem() {
470
469
  }
471
470
 
472
471
  return {
473
- top: y - 10,
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
481
  };
482
482
  },
@@ -496,7 +496,7 @@ export default function CurrentAnimatedItem() {
496
496
  width: coordinates.width,
497
497
  height: coordinates.height,
498
498
  fill: 'transparent',
499
- stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
499
+ //stroke: hslToRgb(currentItem.value?.color || 'hsl(0, 0%, 0%)'),
500
500
  opacity: currentItem.value?.type === 'rectangle' ? 1 : 0,
501
501
  strokeWidth:
502
502
  currentItem.value?.type === 'rectangle'
@@ -519,10 +519,11 @@ export default function CurrentAnimatedItem() {
519
519
  );
520
520
  return {
521
521
  d: d,
522
+ //opacity: 1,
523
+ opacity: currentItem.value?.type === 'pen' ? 1 : 0,
524
+ //stroke: currentItem.value?.color || "black",
522
525
  strokeWidth:
523
526
  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
527
  fill: 'transparent',
527
528
  markerStart: 'selection',
528
529
  markerEnd: 'selection',
@@ -552,15 +553,27 @@ export default function CurrentAnimatedItem() {
552
553
 
553
554
  return (
554
555
  <>
555
- <AnimatedEllipse animatedProps={ellipseAnimatedProps} />
556
+ <AnimatedEllipse
557
+ animatedProps={ellipseAnimatedProps}
558
+ stroke={currentItem.value?.color || 'black'}
559
+ />
556
560
  <G markerStart="url(#selection)" markerEnd="url(#selection)">
557
- <AnimatedLine animatedProps={singleHeadAnimatedProps} />
561
+ <AnimatedLine
562
+ animatedProps={singleHeadAnimatedProps}
563
+ stroke={currentItem.value?.color || 'black'}
564
+ />
558
565
  </G>
559
566
  <G markerStart="url(#selection)" markerEnd="url(#selection)">
560
- <AnimatedLine animatedProps={doubleHeadAnimatedProps} />
567
+ <AnimatedLine
568
+ animatedProps={doubleHeadAnimatedProps}
569
+ stroke={currentItem.value?.color || 'black'}
570
+ />
561
571
  </G>
562
572
  <G markerStart="url(#selection)" markerEnd="url(#selection)">
563
- <AnimatedLine animatedProps={doubleArrowsAnimatedPropsFirst} />
573
+ <AnimatedLine
574
+ animatedProps={doubleArrowsAnimatedPropsFirst}
575
+ stroke={currentItem.value?.color || 'black'}
576
+ />
564
577
 
565
578
  <AnimatedTextInput
566
579
  animatedProps={{
@@ -575,7 +588,6 @@ export default function CurrentAnimatedItem() {
575
588
  ref={doubleArrowTextInput}
576
589
  underlineColorAndroid={'transparent'}
577
590
  onChangeText={(text) => {
578
- console.log('onChangeText', text);
579
591
  if (currentItem.value?.type === 'doubleArrows') {
580
592
  currentItem.value = {
581
593
  ...currentItem.value,
@@ -590,11 +602,19 @@ export default function CurrentAnimatedItem() {
590
602
  }}
591
603
  />
592
604
 
593
- <AnimatedLine animatedProps={doubleArrowsAnimatedPropsLast} />
605
+ <AnimatedLine
606
+ animatedProps={doubleArrowsAnimatedPropsLast}
607
+ stroke={currentItem.value?.color || 'black'}
608
+ />
594
609
  </G>
595
-
596
- <AnimatedRectangle animatedProps={rectangleAnimatedProps} />
597
- <AnimatedPath animatedProps={penAnimatedProps} />
610
+ <AnimatedRectangle
611
+ animatedProps={rectangleAnimatedProps}
612
+ stroke={currentItem.value?.color || 'black'}
613
+ />
614
+ <AnimatedPath
615
+ animatedProps={penAnimatedProps}
616
+ stroke={currentItem.value?.color || 'black'}
617
+ />
598
618
  </>
599
619
  );
600
620
  }
@@ -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
  >