From f33d66f4668f0083fafd115811db8e0095559ac4 Mon Sep 17 00:00:00 2001 From: "REDMOND\\agnel" Date: Thu, 17 Jun 2021 07:12:28 -0500 Subject: [PATCH] dx/dy rendering --- windows/RNSVG/TSpanView.cpp | 6 ++++-- windows/RNSVG/TextView.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/windows/RNSVG/TSpanView.cpp b/windows/RNSVG/TSpanView.cpp index 5414a0fc6..f11f1ac33 100644 --- a/windows/RNSVG/TSpanView.cpp +++ b/windows/RNSVG/TSpanView.cpp @@ -37,12 +37,14 @@ void TSpanView::CreateGeometry(UI::Xaml::CanvasControl const &canvas) { void TSpanView::Render(UI::Xaml::CanvasControl const &canvas, CanvasDrawingSession const &session) { auto const &transform{session.Transform()}; - bool translateXY{X().Size() > 0 || Y().Size() > 0}; + bool translateXY{X().Size() > 0 || Y().Size() > 0 || DX().Size() > 0 || DY().Size() > 0}; if (translateXY) { float x{X().Size() > 0 ? X().GetAt(0).Value() : 0}; float y{Y().Size() > 0 ? Y().GetAt(0).Value() : 0}; - session.Transform(transform * Numerics::make_float3x2_translation(x, y)); + float dx{DX().Size() > 0 ? DX().GetAt(0).Value() : 0}; + float dy{DY().Size() > 0 ? DY().GetAt(0).Value() : 0}; + session.Transform(transform * Numerics::make_float3x2_translation(x + dx, y + dy)); } __super::Render(canvas, session); if (translateXY) { diff --git a/windows/RNSVG/TextView.cpp b/windows/RNSVG/TextView.cpp index 40ceaa260..f8663f6d5 100644 --- a/windows/RNSVG/TextView.cpp +++ b/windows/RNSVG/TextView.cpp @@ -47,11 +47,13 @@ void TextView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, void TextView::RenderGroup(UI::Xaml::CanvasControl const &canvas, CanvasDrawingSession const &session) { auto const &transform{session.Transform()}; - bool translateXY{X().Size() > 0 || Y().Size() > 0}; + bool translateXY{X().Size() > 0 || Y().Size() > 0 || DX().Size() > 0 || DY().Size() > 0}; if (translateXY) { float x{X().Size() > 0 ? X().GetAt(0).Value() : 0}; float y{Y().Size() > 0 ? Y().GetAt(0).Value() : 0}; - session.Transform(transform * Numerics::make_float3x2_translation(x, y)); + float dx{DX().Size() > 0 ? DX().GetAt(0).Value() : 0}; + float dy{DY().Size() > 0 ? DY().GetAt(0).Value() : 0}; + session.Transform(transform * Numerics::make_float3x2_translation(x + dx, y + dy)); } __super::RenderGroup(canvas, session); if (translateXY) {