Coder Social home page Coder Social logo

Comments (2)

noelwelsh avatar noelwelsh commented on July 20, 2024

Thanks for the report! Rotations would be awesome. Circular arcs you should be able to build on top of BezierCurveTo, as in Canvas#circle

The issue you're seeing is caused by the call to Canvas#setOrigin here. The underlying issue is that draw attempts to render the image centered in the canvas. This requires translating from the local coordinate system that an Image uses to the global coordinate system in the Canvas.

The axes image is already centered on its local coordinate system, so there is no transformation from local to global coordinate system.

The linePath image is centered at (5,5) in its local coordinate system (the line goes from (0,0) to (10, 10)), so when we call draw it add a transform from local to global coordinates. It's this transform, along with the attempt to resize the canvas, that causes the image to not be centered relative to the previous image.

I'm not sure of the best way to fix this. There are other draw methods that allow the origin to be specified, but they aren't very convenient to use.

from doodle.

noelwelsh avatar noelwelsh commented on July 20, 2024

The Frame API in 0.9 fixes this.

from doodle.

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.