GithubHelp home page GithubHelp logo

Comments (2)

Azeirah avatar Azeirah commented on June 23, 2024

The problem is that you're storing the rectangle co-ordinates and redrawing them every time.
The moveTo and moveBy methods handle the drawing for you.

It works like this:

  1. You draw to your regular canvas
  2. When you call inf_ctx.updateChunks(), this gets synchronised to the infinite canvas behind
  3. You can now call inf_ctx.moveBy and inf_ctx.moveTo to move around the canvas. Whatever was drawn to the canvas originally will be automatically drawn in the new, correct position.

This interaction model only really makes sense for painting-like applications, like an infinitely-expanding whiteboard or MS Paint with an automatically expanding canvas.

Can you tell me a little bit more about your goal? This library might fit, but if it involves more than a little bit of interaction I highly recommend going for something with an interaction-model built-in like paper.js, pixi.js or phaser.js (it's a game engine, but game engines are perfectly fine for interactive canvas applications!) or if you prefer a well-filled low-level toolbox you could use p5.js.

from infinite-canvas.

FrankDaze avatar FrankDaze commented on June 23, 2024

thanks for your quick answer.

I redraw the objects all the time because I need to do that for drawing the rectangles by dragging the mouse.
My goal is to build a collaboration board like Miro (Miro.com) or Lucidchart.

I will have a look into the libraries you mentioned and will check if they suit to my idea.

Best
Frank

from infinite-canvas.

Related Issues (3)

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.