react-native-windows 0.0.0-canary.556 → 0.0.0-canary.558
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/Microsoft.ReactNative/CompositionSwitcher.idl +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +36 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +114 -122
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +5 -8
- package/Microsoft.ReactNative/Utils/LocalBundleReader.cpp +3 -2
- package/PropertySheets/Generated/PackageVersion.g.props +1 -1
- package/package.json +1 -1
|
@@ -53,6 +53,7 @@ namespace Microsoft.ReactNative.Composition
|
|
|
53
53
|
void Size(Windows.Foundation.Numerics.Vector2 size);
|
|
54
54
|
void Offset(Windows.Foundation.Numerics.Vector3 offset);
|
|
55
55
|
void Offset(Windows.Foundation.Numerics.Vector3 offset, Windows.Foundation.Numerics.Vector3 relativeAdjustment);
|
|
56
|
+
void RelativeSizeWithOffset(Windows.Foundation.Numerics.Vector2 size, Windows.Foundation.Numerics.Vector2 relativeSizeAdjustment);
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
[webhosthidden]
|
|
@@ -230,6 +230,13 @@ struct CompVisual : public winrt::implements<
|
|
|
230
230
|
m_visual.RelativeOffsetAdjustment(relativeAdjustment);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
void RelativeSizeWithOffset(
|
|
234
|
+
winrt::Windows::Foundation::Numerics::float2 size,
|
|
235
|
+
winrt::Windows::Foundation::Numerics::float2 relativeSizeAdjustment) noexcept {
|
|
236
|
+
m_visual.Size(size);
|
|
237
|
+
m_visual.RelativeSizeAdjustment(relativeSizeAdjustment);
|
|
238
|
+
}
|
|
239
|
+
|
|
233
240
|
private:
|
|
234
241
|
winrt::Windows::UI::Composition::Visual m_visual;
|
|
235
242
|
};
|
|
@@ -245,8 +252,8 @@ struct CompSpriteVisual : winrt::Microsoft::ReactNative::Composition::implementa
|
|
|
245
252
|
void InsertAt(const winrt::Microsoft::ReactNative::Composition::IVisual &visual, uint32_t index) noexcept {
|
|
246
253
|
auto containerChildren = m_visual.Children();
|
|
247
254
|
auto compVisual = winrt::Microsoft::ReactNative::Composition::CompositionContextHelper::InnerVisual(visual);
|
|
248
|
-
if (index == 0
|
|
249
|
-
containerChildren.
|
|
255
|
+
if (index == 0) {
|
|
256
|
+
containerChildren.InsertAtBottom(compVisual);
|
|
250
257
|
return;
|
|
251
258
|
}
|
|
252
259
|
auto insertAfter = containerChildren.First();
|
|
@@ -305,6 +312,13 @@ struct CompSpriteVisual : winrt::Microsoft::ReactNative::Composition::implementa
|
|
|
305
312
|
m_visual.RelativeOffsetAdjustment(relativeAdjustment);
|
|
306
313
|
}
|
|
307
314
|
|
|
315
|
+
void RelativeSizeWithOffset(
|
|
316
|
+
winrt::Windows::Foundation::Numerics::float2 size,
|
|
317
|
+
winrt::Windows::Foundation::Numerics::float2 relativeSizeAdjustment) noexcept {
|
|
318
|
+
m_visual.Size(size);
|
|
319
|
+
m_visual.RelativeSizeAdjustment(relativeSizeAdjustment);
|
|
320
|
+
}
|
|
321
|
+
|
|
308
322
|
void SetClippingPath(ID2D1Geometry *clippingPath) noexcept {
|
|
309
323
|
if (!clippingPath) {
|
|
310
324
|
m_visual.Clip(nullptr);
|
|
@@ -462,7 +476,9 @@ struct CompScrollerVisual : winrt::Microsoft::ReactNative::Composition::implemen
|
|
|
462
476
|
}
|
|
463
477
|
|
|
464
478
|
void Size(winrt::Windows::Foundation::Numerics::float2 const &size) noexcept {
|
|
479
|
+
m_visualSize = size;
|
|
465
480
|
m_visual.Size(size);
|
|
481
|
+
UpdateMaxPosition();
|
|
466
482
|
}
|
|
467
483
|
|
|
468
484
|
void Offset(winrt::Windows::Foundation::Numerics::float3 const &offset) noexcept {
|
|
@@ -476,6 +492,13 @@ struct CompScrollerVisual : winrt::Microsoft::ReactNative::Composition::implemen
|
|
|
476
492
|
m_visual.RelativeOffsetAdjustment(relativeAdjustment);
|
|
477
493
|
}
|
|
478
494
|
|
|
495
|
+
void RelativeSizeWithOffset(
|
|
496
|
+
winrt::Windows::Foundation::Numerics::float2 size,
|
|
497
|
+
winrt::Windows::Foundation::Numerics::float2 relativeSizeAdjustment) noexcept {
|
|
498
|
+
m_visual.Size(size);
|
|
499
|
+
m_visual.RelativeSizeAdjustment(relativeSizeAdjustment);
|
|
500
|
+
}
|
|
501
|
+
|
|
479
502
|
void SetClippingPath(ID2D1Geometry *clippingPath) noexcept {
|
|
480
503
|
auto geometry = winrt::make<GeometrySource>(clippingPath);
|
|
481
504
|
auto path = winrt::Windows::UI::Composition::CompositionPath(geometry);
|
|
@@ -499,8 +522,9 @@ struct CompScrollerVisual : winrt::Microsoft::ReactNative::Composition::implemen
|
|
|
499
522
|
}
|
|
500
523
|
|
|
501
524
|
void ContentSize(winrt::Windows::Foundation::Numerics::float2 const &size) noexcept {
|
|
525
|
+
m_contentSize = size;
|
|
502
526
|
m_contentVisual.Size(size);
|
|
503
|
-
|
|
527
|
+
UpdateMaxPosition();
|
|
504
528
|
}
|
|
505
529
|
|
|
506
530
|
winrt::Windows::Foundation::Numerics::float3 ScrollPosition() noexcept {
|
|
@@ -516,6 +540,15 @@ struct CompScrollerVisual : winrt::Microsoft::ReactNative::Composition::implemen
|
|
|
516
540
|
m_scrollPositionChangedEvent(*this, winrt::make<CompScrollPositionChangedArgs>(position));
|
|
517
541
|
}
|
|
518
542
|
|
|
543
|
+
void UpdateMaxPosition() {
|
|
544
|
+
m_interactionTracker.MaxPosition(
|
|
545
|
+
{std::max<float>(m_contentSize.x - m_visualSize.x, 0),
|
|
546
|
+
std::max<float>(m_contentSize.y - m_visualSize.y, 0),
|
|
547
|
+
0});
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
winrt::Windows::Foundation::Numerics::float2 m_contentSize{0};
|
|
551
|
+
winrt::Windows::Foundation::Numerics::float2 m_visualSize{0};
|
|
519
552
|
winrt::event<
|
|
520
553
|
winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::Composition::ScrollPositionChangedArgs>>
|
|
521
554
|
m_scrollPositionChangedEvent;
|
|
@@ -90,10 +90,12 @@ bool CompositionBaseComponentView::ScrollWheel(facebook::react::Point pt, int32_
|
|
|
90
90
|
return false;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
std::array<
|
|
93
|
+
std::array<
|
|
94
|
+
winrt::Microsoft::ReactNative::Composition::SpriteVisual,
|
|
95
|
+
CompositionBaseComponentView::SpecialBorderLayerCount>
|
|
94
96
|
CompositionBaseComponentView::FindSpecialBorderLayers() const noexcept {
|
|
95
|
-
std::array<winrt::Microsoft::ReactNative::Composition::SpriteVisual,
|
|
96
|
-
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
|
|
97
|
+
std::array<winrt::Microsoft::ReactNative::Composition::SpriteVisual, SpecialBorderLayerCount> layers{
|
|
98
|
+
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
|
|
97
99
|
|
|
98
100
|
if (m_numBorderVisuals) {
|
|
99
101
|
for (uint8_t i = 0; i < m_numBorderVisuals; i++) {
|
|
@@ -375,6 +377,8 @@ void SetBorderLayerPropertiesCommon(
|
|
|
375
377
|
const D2D1_RECT_F &textureRect,
|
|
376
378
|
facebook::react::Point anchorPoint,
|
|
377
379
|
facebook::react::Point anchorOffset,
|
|
380
|
+
winrt::Windows::Foundation::Numerics::float2 size,
|
|
381
|
+
winrt::Windows::Foundation::Numerics::float2 relativeSizeAdjustment,
|
|
378
382
|
FLOAT strokeWidth,
|
|
379
383
|
const facebook::react::SharedColor &borderColor,
|
|
380
384
|
facebook::react::BorderStyle borderStyle) {
|
|
@@ -389,7 +393,7 @@ void SetBorderLayerPropertiesCommon(
|
|
|
389
393
|
|
|
390
394
|
layer.Brush(compContext.CreateSurfaceBrush(surface));
|
|
391
395
|
layer.Offset({anchorOffset.x, anchorOffset.y, 0}, {anchorPoint.x, anchorPoint.y, 0});
|
|
392
|
-
layer.
|
|
396
|
+
layer.RelativeSizeWithOffset(size, relativeSizeAdjustment);
|
|
393
397
|
|
|
394
398
|
AutoDrawHelper autoDraw(borderTexture);
|
|
395
399
|
|
|
@@ -462,6 +466,8 @@ void SetBorderLayerProperties(
|
|
|
462
466
|
const D2D1_RECT_F &textureRect,
|
|
463
467
|
facebook::react::Point anchorPoint,
|
|
464
468
|
facebook::react::Point anchorOffset,
|
|
469
|
+
winrt::Windows::Foundation::Numerics::float2 size,
|
|
470
|
+
winrt::Windows::Foundation::Numerics::float2 relativeSizeAdjustment,
|
|
465
471
|
FLOAT strokeWidth,
|
|
466
472
|
const facebook::react::SharedColor &borderColor,
|
|
467
473
|
facebook::react::BorderStyle borderStyle) {
|
|
@@ -474,6 +480,8 @@ void SetBorderLayerProperties(
|
|
|
474
480
|
textureRect,
|
|
475
481
|
anchorPoint,
|
|
476
482
|
anchorOffset,
|
|
483
|
+
size,
|
|
484
|
+
relativeSizeAdjustment,
|
|
477
485
|
strokeWidth,
|
|
478
486
|
borderColor,
|
|
479
487
|
borderStyle);
|
|
@@ -516,16 +524,19 @@ const float Bottom = 1.0;
|
|
|
516
524
|
template <typename TShape>
|
|
517
525
|
void DrawAllBorderLayers(
|
|
518
526
|
winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
519
|
-
std::array<
|
|
527
|
+
std::array<
|
|
528
|
+
winrt::Microsoft::ReactNative::Composition::SpriteVisual,
|
|
529
|
+
CompositionBaseComponentView::SpecialBorderLayerCount> &spBorderLayers,
|
|
520
530
|
TShape &shape,
|
|
521
|
-
|
|
531
|
+
const facebook::react::BorderWidths &borderWidths,
|
|
532
|
+
const facebook::react::BorderRadii &borderRadii,
|
|
522
533
|
float textureWidth,
|
|
523
534
|
float textureHeight,
|
|
524
535
|
const facebook::react::BorderColors &borderColors,
|
|
525
536
|
facebook::react::BorderStyle borderStyle) {
|
|
526
537
|
// Now that we've drawn our nice border in one layer, split it into its component layers
|
|
527
|
-
winrt::com_ptr<Composition::ICompositionDrawingSurfaceInterop>
|
|
528
|
-
|
|
538
|
+
winrt::com_ptr<Composition::ICompositionDrawingSurfaceInterop>
|
|
539
|
+
spTextures[CompositionBaseComponentView::SpecialBorderLayerCount];
|
|
529
540
|
|
|
530
541
|
// Set component border properties
|
|
531
542
|
// Top Left Corner
|
|
@@ -534,162 +545,144 @@ void DrawAllBorderLayers(
|
|
|
534
545
|
spBorderLayers[0],
|
|
535
546
|
shape,
|
|
536
547
|
spTextures[0], // Target Layer, Source Texture, Target Texture
|
|
537
|
-
{0,
|
|
548
|
+
{0,
|
|
549
|
+
0,
|
|
550
|
+
borderRadii.topLeft + borderWidths.left,
|
|
551
|
+
borderRadii.topLeft + borderWidths.top}, // Texture Left, Top, Width, Height
|
|
538
552
|
{AnchorPosition::Left, AnchorPosition::Top}, // Layer Anchor Point
|
|
539
553
|
{0, 0}, // Layer Anchor Offset
|
|
540
|
-
|
|
554
|
+
{borderRadii.topLeft + borderWidths.left, borderRadii.topLeft + borderWidths.top}, // size
|
|
555
|
+
{0.0f, 0.0f}, // relativeSize
|
|
556
|
+
std::max(borderWidths.left, borderWidths.top),
|
|
541
557
|
borderColors.left ? borderColors.left : borderColors.top,
|
|
542
558
|
borderStyle);
|
|
543
559
|
|
|
544
|
-
// Top
|
|
560
|
+
// Top Edge Border
|
|
545
561
|
SetBorderLayerProperties(
|
|
546
562
|
compContext,
|
|
547
563
|
spBorderLayers[1],
|
|
548
564
|
shape,
|
|
549
565
|
spTextures[1],
|
|
550
|
-
{
|
|
566
|
+
{borderRadii.topLeft + borderWidths.left,
|
|
567
|
+
0,
|
|
568
|
+
textureWidth - (borderRadii.topRight + borderWidths.right),
|
|
569
|
+
borderWidths.top},
|
|
551
570
|
{AnchorPosition::Left, AnchorPosition::Top},
|
|
552
|
-
{
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
// Top Edge Border
|
|
558
|
-
SetBorderLayerProperties(
|
|
559
|
-
compContext,
|
|
560
|
-
spBorderLayers[2],
|
|
561
|
-
shape,
|
|
562
|
-
spTextures[2],
|
|
563
|
-
{cornerSize, 0, textureWidth - cornerSize, cornerSize},
|
|
564
|
-
{AnchorPosition::Left, AnchorPosition::Top},
|
|
565
|
-
{cornerSize, 0},
|
|
566
|
-
strokeWidth,
|
|
571
|
+
{borderRadii.topLeft + borderWidths.left, 0},
|
|
572
|
+
{-(borderRadii.topLeft + borderWidths.left + borderRadii.topRight + borderWidths.right),
|
|
573
|
+
borderWidths.top}, // size
|
|
574
|
+
{1.0f, 0.0f}, // relativeSize
|
|
575
|
+
borderWidths.top,
|
|
567
576
|
borderColors.top,
|
|
568
577
|
borderStyle);
|
|
569
578
|
|
|
570
579
|
// Top Right Corner Border
|
|
571
580
|
SetBorderLayerProperties(
|
|
572
581
|
compContext,
|
|
573
|
-
spBorderLayers[
|
|
574
|
-
shape,
|
|
575
|
-
spTextures[3],
|
|
576
|
-
{textureWidth - cornerSize, 0, textureWidth, cornerSize},
|
|
577
|
-
{AnchorPosition::Right, AnchorPosition::Top},
|
|
578
|
-
{-cornerSize, 0},
|
|
579
|
-
strokeWidth,
|
|
580
|
-
borderColors.right ? borderColors.right : borderColors.top,
|
|
581
|
-
borderStyle);
|
|
582
|
-
|
|
583
|
-
// Top Right Inset Corner Border
|
|
584
|
-
SetBorderLayerProperties(
|
|
585
|
-
compContext,
|
|
586
|
-
spBorderLayers[4],
|
|
582
|
+
spBorderLayers[2],
|
|
587
583
|
shape,
|
|
588
|
-
spTextures[
|
|
589
|
-
{
|
|
590
|
-
|
|
591
|
-
textureWidth
|
|
592
|
-
|
|
584
|
+
spTextures[2],
|
|
585
|
+
{textureWidth - (borderRadii.topRight + borderWidths.right),
|
|
586
|
+
0,
|
|
587
|
+
textureWidth,
|
|
588
|
+
borderRadii.topRight + borderWidths.top},
|
|
593
589
|
{AnchorPosition::Right, AnchorPosition::Top},
|
|
594
|
-
{-
|
|
595
|
-
|
|
590
|
+
{-(borderRadii.topRight + borderWidths.right), 0},
|
|
591
|
+
{borderRadii.topRight + borderWidths.right, borderRadii.topRight + borderWidths.top},
|
|
592
|
+
{0.0f, 0.0f},
|
|
593
|
+
std::max(borderWidths.right, borderWidths.top),
|
|
596
594
|
borderColors.right ? borderColors.right : borderColors.top,
|
|
597
595
|
borderStyle);
|
|
598
596
|
|
|
599
597
|
// Right Edge Border
|
|
600
598
|
SetBorderLayerProperties(
|
|
601
599
|
compContext,
|
|
602
|
-
spBorderLayers[
|
|
600
|
+
spBorderLayers[3],
|
|
603
601
|
shape,
|
|
604
|
-
spTextures[
|
|
605
|
-
{textureWidth -
|
|
602
|
+
spTextures[3],
|
|
603
|
+
{textureWidth - borderWidths.right,
|
|
604
|
+
borderWidths.top + borderRadii.topRight,
|
|
605
|
+
textureWidth,
|
|
606
|
+
textureHeight - (borderWidths.bottom + borderRadii.bottomRight)},
|
|
606
607
|
{AnchorPosition::Right, AnchorPosition::Top},
|
|
607
|
-
{-
|
|
608
|
-
|
|
608
|
+
{-borderWidths.right, borderWidths.top + borderRadii.topRight},
|
|
609
|
+
{borderWidths.right,
|
|
610
|
+
-(borderWidths.top + borderRadii.topRight + borderWidths.bottom + borderRadii.bottomRight)}, // size
|
|
611
|
+
{0.0f, 1.0f},
|
|
612
|
+
borderWidths.right,
|
|
609
613
|
borderColors.right,
|
|
610
614
|
borderStyle);
|
|
611
615
|
|
|
612
616
|
// Bottom Right Corner Border
|
|
613
617
|
SetBorderLayerProperties(
|
|
614
618
|
compContext,
|
|
615
|
-
spBorderLayers[
|
|
616
|
-
shape,
|
|
617
|
-
spTextures[6],
|
|
618
|
-
{textureWidth - cornerSize, textureHeight - cornerSize, textureWidth, textureHeight},
|
|
619
|
-
{AnchorPosition::Right, AnchorPosition::Bottom},
|
|
620
|
-
{-cornerSize, -cornerSize},
|
|
621
|
-
strokeWidth,
|
|
622
|
-
borderColors.right ? borderColors.right : borderColors.bottom,
|
|
623
|
-
borderStyle);
|
|
624
|
-
|
|
625
|
-
// Bottom Right Inset Corner Border
|
|
626
|
-
SetBorderLayerProperties(
|
|
627
|
-
compContext,
|
|
628
|
-
spBorderLayers[7],
|
|
619
|
+
spBorderLayers[4],
|
|
629
620
|
shape,
|
|
630
|
-
spTextures[
|
|
631
|
-
{
|
|
632
|
-
|
|
633
|
-
textureWidth
|
|
634
|
-
textureHeight
|
|
621
|
+
spTextures[4],
|
|
622
|
+
{textureWidth - (borderWidths.right + borderRadii.bottomRight),
|
|
623
|
+
textureHeight - (borderWidths.bottom + borderRadii.bottomRight),
|
|
624
|
+
textureWidth,
|
|
625
|
+
textureHeight},
|
|
635
626
|
{AnchorPosition::Right, AnchorPosition::Bottom},
|
|
636
|
-
{-
|
|
637
|
-
|
|
627
|
+
{-(borderWidths.right + borderRadii.bottomRight), -(borderWidths.bottom + borderRadii.bottomRight)},
|
|
628
|
+
{borderWidths.right + borderRadii.bottomRight, borderWidths.bottom + borderRadii.bottomRight},
|
|
629
|
+
{0, 0},
|
|
630
|
+
std::max(borderWidths.right, borderWidths.bottom),
|
|
638
631
|
borderColors.right ? borderColors.right : borderColors.bottom,
|
|
639
632
|
borderStyle);
|
|
640
633
|
|
|
641
634
|
// Bottom Edge Border
|
|
642
635
|
SetBorderLayerProperties(
|
|
643
636
|
compContext,
|
|
644
|
-
spBorderLayers[
|
|
637
|
+
spBorderLayers[5],
|
|
645
638
|
shape,
|
|
646
|
-
spTextures[
|
|
647
|
-
{
|
|
639
|
+
spTextures[5],
|
|
640
|
+
{borderWidths.left + borderRadii.bottomLeft,
|
|
641
|
+
textureHeight - borderWidths.bottom,
|
|
642
|
+
textureWidth - (borderWidths.right + borderRadii.bottomLeft),
|
|
643
|
+
textureHeight},
|
|
648
644
|
{AnchorPosition::Left, AnchorPosition::Bottom},
|
|
649
|
-
{
|
|
650
|
-
|
|
645
|
+
{borderWidths.left + borderRadii.bottomLeft, -borderWidths.bottom},
|
|
646
|
+
{-(borderWidths.right + borderRadii.bottomLeft + borderWidths.left + borderRadii.bottomLeft),
|
|
647
|
+
borderWidths.bottom},
|
|
648
|
+
{1.0f, 0.0f},
|
|
649
|
+
borderWidths.bottom,
|
|
651
650
|
borderColors.bottom,
|
|
652
651
|
borderStyle);
|
|
653
652
|
|
|
654
653
|
// Bottom Left Corner Border
|
|
655
654
|
SetBorderLayerProperties(
|
|
656
655
|
compContext,
|
|
657
|
-
spBorderLayers[
|
|
658
|
-
shape,
|
|
659
|
-
spTextures[9],
|
|
660
|
-
{0, textureHeight - cornerSize, cornerSize, textureHeight},
|
|
661
|
-
{AnchorPosition::Left, AnchorPosition::Bottom},
|
|
662
|
-
{0, -cornerSize},
|
|
663
|
-
strokeWidth,
|
|
664
|
-
borderColors.left ? borderColors.left : borderColors.bottom,
|
|
665
|
-
borderStyle);
|
|
666
|
-
|
|
667
|
-
// Bottom Left Inset Corner Border
|
|
668
|
-
SetBorderLayerProperties(
|
|
669
|
-
compContext,
|
|
670
|
-
spBorderLayers[10],
|
|
656
|
+
spBorderLayers[6],
|
|
671
657
|
shape,
|
|
672
|
-
spTextures[
|
|
673
|
-
{
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
textureHeight
|
|
658
|
+
spTextures[6],
|
|
659
|
+
{0,
|
|
660
|
+
textureHeight - (borderWidths.bottom + borderRadii.bottomLeft),
|
|
661
|
+
borderWidths.left + borderRadii.bottomLeft,
|
|
662
|
+
textureHeight},
|
|
677
663
|
{AnchorPosition::Left, AnchorPosition::Bottom},
|
|
678
|
-
{
|
|
679
|
-
|
|
664
|
+
{0, -(borderWidths.bottom + borderRadii.bottomLeft)},
|
|
665
|
+
{borderWidths.left + borderRadii.bottomLeft, borderWidths.bottom + borderRadii.bottomLeft},
|
|
666
|
+
{0, 0},
|
|
667
|
+
std::max(borderWidths.left, borderWidths.bottom),
|
|
680
668
|
borderColors.left ? borderColors.left : borderColors.bottom,
|
|
681
669
|
borderStyle);
|
|
682
670
|
|
|
683
671
|
// Left Edge Border
|
|
684
672
|
SetBorderLayerProperties(
|
|
685
673
|
compContext,
|
|
686
|
-
spBorderLayers[
|
|
674
|
+
spBorderLayers[7],
|
|
687
675
|
shape,
|
|
688
|
-
spTextures[
|
|
689
|
-
{0,
|
|
676
|
+
spTextures[7],
|
|
677
|
+
{0,
|
|
678
|
+
borderWidths.top + borderRadii.topLeft,
|
|
679
|
+
borderWidths.left,
|
|
680
|
+
textureHeight - (borderWidths.bottom + borderRadii.bottomLeft)},
|
|
690
681
|
{AnchorPosition::Left, AnchorPosition::Top},
|
|
691
|
-
{0,
|
|
692
|
-
|
|
682
|
+
{0, borderWidths.top + borderRadii.topLeft},
|
|
683
|
+
{borderWidths.left, -(borderWidths.top + borderRadii.topLeft + borderWidths.bottom + borderRadii.bottomLeft)},
|
|
684
|
+
{0, 1},
|
|
685
|
+
borderWidths.left,
|
|
693
686
|
borderColors.left,
|
|
694
687
|
borderStyle);
|
|
695
688
|
}
|
|
@@ -827,7 +820,7 @@ facebook::react::BorderMetrics resolveAndAlignBorderMetrics(
|
|
|
827
820
|
}
|
|
828
821
|
|
|
829
822
|
bool CompositionBaseComponentView::TryUpdateSpecialBorderLayers(
|
|
830
|
-
std::array<winrt::Microsoft::ReactNative::Composition::SpriteVisual,
|
|
823
|
+
std::array<winrt::Microsoft::ReactNative::Composition::SpriteVisual, SpecialBorderLayerCount> &spBorderVisuals,
|
|
831
824
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
832
825
|
const facebook::react::ViewProps &viewProps) noexcept {
|
|
833
826
|
auto borderMetrics = resolveAndAlignBorderMetrics(layoutMetrics, viewProps);
|
|
@@ -843,7 +836,7 @@ bool CompositionBaseComponentView::TryUpdateSpecialBorderLayers(
|
|
|
843
836
|
|
|
844
837
|
// Create the special border layers if they don't exist yet
|
|
845
838
|
if (!spBorderVisuals[0]) {
|
|
846
|
-
for (uint8_t i = 0; i <
|
|
839
|
+
for (uint8_t i = 0; i < SpecialBorderLayerCount; i++) {
|
|
847
840
|
auto visual = m_compContext.CreateSpriteVisual();
|
|
848
841
|
Visual().InsertAt(visual, i);
|
|
849
842
|
spBorderVisuals[i] = std::move(visual);
|
|
@@ -859,13 +852,11 @@ bool CompositionBaseComponentView::TryUpdateSpecialBorderLayers(
|
|
|
859
852
|
if (borderStyle == facebook::react::BorderStyle::Dotted || borderStyle == facebook::react::BorderStyle::Dashed) {
|
|
860
853
|
// Because in DirectX geometry starts at the center of the stroke, we need to deflate
|
|
861
854
|
// rectangle by half the stroke width to render correctly.
|
|
862
|
-
float strokeCenteringOffset = borderMetrics.borderWidths.left / 2.0f;
|
|
863
|
-
|
|
864
855
|
facebook::react::RectangleEdges<float> rectPathGeometry = {
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
extentWidth -
|
|
868
|
-
extentHeight -
|
|
856
|
+
borderMetrics.borderWidths.left / 2.0f,
|
|
857
|
+
borderMetrics.borderWidths.top / 2.0f,
|
|
858
|
+
extentWidth - borderMetrics.borderWidths.right / 2.0f,
|
|
859
|
+
extentHeight - borderMetrics.borderWidths.bottom / 2.0f};
|
|
869
860
|
|
|
870
861
|
winrt::com_ptr<ID2D1PathGeometry> pathGeometry =
|
|
871
862
|
GenerateRoundedRectPathGeometry(m_compContext, borderMetrics.borderRadii, {0, 0, 0, 0}, rectPathGeometry);
|
|
@@ -875,7 +866,8 @@ bool CompositionBaseComponentView::TryUpdateSpecialBorderLayers(
|
|
|
875
866
|
m_compContext,
|
|
876
867
|
spBorderVisuals,
|
|
877
868
|
*pathGeometry,
|
|
878
|
-
borderMetrics.borderWidths
|
|
869
|
+
borderMetrics.borderWidths,
|
|
870
|
+
borderMetrics.borderRadii,
|
|
879
871
|
extentWidth,
|
|
880
872
|
extentHeight,
|
|
881
873
|
borderMetrics.borderColors,
|
|
@@ -897,7 +889,8 @@ bool CompositionBaseComponentView::TryUpdateSpecialBorderLayers(
|
|
|
897
889
|
m_compContext,
|
|
898
890
|
spBorderVisuals,
|
|
899
891
|
*pathGeometry,
|
|
900
|
-
borderMetrics.borderWidths
|
|
892
|
+
borderMetrics.borderWidths,
|
|
893
|
+
borderMetrics.borderRadii,
|
|
901
894
|
extentWidth,
|
|
902
895
|
extentHeight,
|
|
903
896
|
borderMetrics.borderColors,
|
|
@@ -906,18 +899,17 @@ bool CompositionBaseComponentView::TryUpdateSpecialBorderLayers(
|
|
|
906
899
|
} else {
|
|
907
900
|
// Because in DirectX geometry starts at the center of the stroke, we need to deflate rectangle by half the stroke
|
|
908
901
|
// width / height to render correctly.
|
|
909
|
-
float strokeCenteringOffsetX = (borderMetrics.borderWidths.left / 2.0f);
|
|
910
|
-
float strokeCenteringOffsetY = (borderMetrics.borderWidths.top / 2.0f);
|
|
911
902
|
D2D1_RECT_F rectShape{
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
extentWidth -
|
|
915
|
-
extentHeight -
|
|
903
|
+
borderMetrics.borderWidths.left / 2.0f,
|
|
904
|
+
borderMetrics.borderWidths.top / 2.0f,
|
|
905
|
+
extentWidth - (borderMetrics.borderWidths.right / 2.0f),
|
|
906
|
+
extentHeight - (borderMetrics.borderWidths.bottom / 2.0f)};
|
|
916
907
|
DrawAllBorderLayers(
|
|
917
908
|
m_compContext,
|
|
918
909
|
spBorderVisuals,
|
|
919
910
|
rectShape,
|
|
920
|
-
borderMetrics.borderWidths
|
|
911
|
+
borderMetrics.borderWidths,
|
|
912
|
+
borderMetrics.borderRadii,
|
|
921
913
|
extentWidth,
|
|
922
914
|
extentHeight,
|
|
923
915
|
borderMetrics.borderColors,
|
|
@@ -19,6 +19,8 @@ CompositionBaseComponentView *GetFocusedComponent() noexcept;
|
|
|
19
19
|
void SetFocusedComponent(CompositionBaseComponentView *value) noexcept;
|
|
20
20
|
|
|
21
21
|
struct CompositionBaseComponentView : public IComponentView {
|
|
22
|
+
static constexpr size_t SpecialBorderLayerCount = 8;
|
|
23
|
+
|
|
22
24
|
CompositionBaseComponentView(
|
|
23
25
|
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
24
26
|
facebook::react::Tag tag);
|
|
@@ -49,9 +51,10 @@ struct CompositionBaseComponentView : public IComponentView {
|
|
|
49
51
|
virtual void OnRenderingDeviceLost() noexcept;
|
|
50
52
|
|
|
51
53
|
protected:
|
|
52
|
-
std::array<winrt::Microsoft::ReactNative::Composition::SpriteVisual,
|
|
54
|
+
std::array<winrt::Microsoft::ReactNative::Composition::SpriteVisual, SpecialBorderLayerCount>
|
|
55
|
+
FindSpecialBorderLayers() const noexcept;
|
|
53
56
|
bool TryUpdateSpecialBorderLayers(
|
|
54
|
-
std::array<winrt::Microsoft::ReactNative::Composition::SpriteVisual,
|
|
57
|
+
std::array<winrt::Microsoft::ReactNative::Composition::SpriteVisual, SpecialBorderLayerCount> &spBorderVisuals,
|
|
55
58
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
56
59
|
const facebook::react::ViewProps &viewProps) noexcept;
|
|
57
60
|
void UpdateSpecialBorderLayers(
|
|
@@ -66,12 +69,6 @@ struct CompositionBaseComponentView : public IComponentView {
|
|
|
66
69
|
facebook::react::LayoutMetrics m_layoutMetrics;
|
|
67
70
|
bool m_needsBorderUpdate{false};
|
|
68
71
|
uint8_t m_numBorderVisuals{0};
|
|
69
|
-
|
|
70
|
-
/*
|
|
71
|
-
winrt::Windows::UI::Composition::ShapeVisual m_borderVisual{nullptr};
|
|
72
|
-
winrt::Windows::UI::Composition::CompositionSpriteShape m_borderShape{nullptr};
|
|
73
|
-
winrt::Windows::UI::Composition::CompositionRoundedRectangleGeometry m_borderGeometry{nullptr};
|
|
74
|
-
*/
|
|
75
72
|
};
|
|
76
73
|
|
|
77
74
|
struct CompositionViewComponentView : public CompositionBaseComponentView {
|
|
@@ -76,14 +76,15 @@ std::future<std::string> LocalBundleReader::LoadBundleAsync(const std::string &b
|
|
|
76
76
|
auto fileBuffer{co_await winrt::Windows::Storage::FileIO::ReadBufferAsync(file)};
|
|
77
77
|
auto dataReader{winrt::Windows::Storage::Streams::DataReader::FromBuffer(fileBuffer)};
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
// No need to use length + 1, STL guarantees that string storage is null-terminated.
|
|
80
|
+
std::string script(fileBuffer.Length(), '\0');
|
|
80
81
|
|
|
81
82
|
// Construct the array_view to slice into the first fileBuffer.Length bytes.
|
|
82
83
|
// DataReader.ReadBytes will read as many bytes as are present in the
|
|
83
84
|
// array_view. The backing string has fileBuffer.Length() + 1 bytes, without
|
|
84
85
|
// an explicit end it will read 1 byte to many and throw.
|
|
85
86
|
dataReader.ReadBytes(winrt::array_view<uint8_t>{
|
|
86
|
-
reinterpret_cast<uint8_t *>(&script[0]), reinterpret_cast<uint8_t *>(&script[script.length()
|
|
87
|
+
reinterpret_cast<uint8_t *>(&script[0]), reinterpret_cast<uint8_t *>(&script[script.length()])});
|
|
87
88
|
dataReader.Close();
|
|
88
89
|
|
|
89
90
|
co_return script;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.0.0-canary.
|
|
13
|
+
<ReactNativeWindowsVersion>0.0.0-canary.558</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>0</ReactNativeWindowsMinor>
|
|
16
16
|
<ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
|