Comments (2)
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:
- You draw to your regular canvas
- When you call
inf_ctx.updateChunks()
, this gets synchronised to the infinite canvas behind - You can now call
inf_ctx.moveBy
andinf_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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from infinite-canvas.