Comments (11)
Yes as I thought the function called was the bad one, if i remember well you just need to remove "this." in the this.drawImage :
index.js line 200 :
drawImage({ctx: context,img: this.props.imgSrc,x: 0,y: 0,w: this.props.canvasWidth, h: this.props.canvasHeight});
I don't know how to do a pull request but I'll try posting one.
from react-canvas-draw.
any updates here?
from react-canvas-draw.
any updates here?
from react-canvas-draw.
Yes as I thought the function called was the bad one, if i remember well you just need to remove "this." in the this.drawImage : index.js line 200 :
drawImage({ctx: context,img: this.props.imgSrc,x: 0,y: 0,w: this.props.canvasWidth, h: this.props.canvasHeight});
I don't know how to do a pull request but I'll try posting one.
Can you please explain exactly how / where you did edit this in other to get it to work? I've looked into the node_modules for an index.js but couldn't manage it... thanks
from react-canvas-draw.
any updates here?
from react-canvas-draw.
Still not working. Any updates?
@mitjana Could you please share your modified index.js
file with the solution? I could create the PR then... Thanks! 🙂
from react-canvas-draw.
@embiem I am currently investigating what is happening when getting the image data with the background.
Disclaimer: I haven't really worked a lot with canvas elements ✌️
In the index.js on line 178, you save the reference to the canvas.
let canvasToExport = this.canvas.drawing;
In total, the library uses four canvas instances.
I found out that the background image is part of the canvas with the name "grid".
Is this a reason why the background image is not part of the canvas we are trying to save?
I hope that is somewhat clear.
from react-canvas-draw.
Hello,
I just made a pull request with the line modified. Check PR #141
I hope it can help you.
from react-canvas-draw.
@mitjana Thank you so much for creating the pull request ✌️ I've just tested it locally and I am getting the following runtime error:
Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or OffscreenCanvas or SVGImageElement or VideoFrame)'.
drawImage.js:63
How did you solve this issue?
@embiem Could you please have a look at the issue? I really like your library and would love to integrate it into our project fully. But this feature would be required for us. Please let me know if you need further details!
from react-canvas-draw.
Hi there,
@skuntze I think you may have a clue concerning the canvas ref at line 178 in index.js. Seems like we get only the drawings but not the bgImage as it is drawn on the canvas grid. I'm no expert but it looks like a good lead, right ?
@embiem I really appreciate your work on this library. I would like to use background image in my project too but as it's still not working...
Let us know if we can help to fix that quickly !
Thanks again
from react-canvas-draw.
Hi there.
I had the same problem so I made this.
https://codesandbox.io/s/canva-with-background-image-uf652c
from react-canvas-draw.
Related Issues (20)
- Insert label
- it seems it does not supports react 17+ versions? HOT 2
- background image while fetching from AWS S3 in google chrome does not work from localhost HOT 1
- Support for pressure considered? HOT 4
- The "ref" issue HOT 1
- Cannot read properties of undefined (reading 'getPointerCoordinates') HOT 2
- [Feature Request] Resize pointer on zoom
- Scrolling while drawing throws an error
- Accidental duplicate issue
- Cannot read properties of undefined (reading 'getPointerCoordinates') when setting a small canvasWidth HOT 3
- Invariant Violation: View config getter callback for component `canvas` must be a function (received `undefined`). Make sure to start component names with a capital letter.
- ... HOT 1
- Support for React 18 & typescript HOT 3
- Property 'getDataURL' does not exist on type 'CanvasDraw' HOT 1
- Feature request: callbacks for common events
- Animation events continue after loading new data
- Postion canvas always static
- Uncaught TypeError: Cannot read property 'getPointerCoordinates' of undefined. HOT 1
- apply clear reactangle
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 react-canvas-draw.