Git Product home page Git Product logo

Comments (3)

mrbean-bremen avatar mrbean-bremen commented on August 16, 2024 1

Was the change intentional? I did not find any breaking changes in the release notes.

Yes, see #925. And yes, the release notes for this are not really helpful in that respect.

Is there a flag or a setting I can use to return the default behavior to absolute coordinates without the need to calculate them manually?

Not that I know of, though @H1Gdev might know more.

from svg.

hubaksis avatar hubaksis commented on August 16, 2024

Workaround that I've currently implemented in my project:

PointF absolutePoint = new PointF(0, 0);
foreach (var point in path.PathData)
{
     absolutePoint = ToAbsolute(point.End, point.IsRelative, absolutePoint);
     ... do what you need to do with the absolutePoint
}

Where ToAbsolute I took from the abstract class SvgPathSegment

 protected static PointF ToAbsolute(PointF point, bool isRelative, PointF start)
 {
     if (float.IsNaN(point.X))
         point.X = start.X;
     else if (isRelative)
         point.X += start.X;

     if (float.IsNaN(point.Y))
         point.Y = start.Y;
     else if (isRelative)
         point.Y += start.Y;

     return point;
 }

from svg.

H1Gdev avatar H1Gdev commented on August 16, 2024

@hubaksis

In the previous version, relative information was lost when read SVG into DOM.
(SVG(relative) -> SvgDocument(absolute) -> SVG(absolute))

We supported relatives with PR #925.

For conversion, I think you should use ToAbsolute logic. You can calculate each point in this method sequentially.

from svg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.