Giter Club home page Giter Club logo

Comments (11)

mitjana avatar mitjana commented on June 1, 2024 1

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.

IslamIv avatar IslamIv commented on June 1, 2024

any updates here?

from react-canvas-draw.

wondem12 avatar wondem12 commented on June 1, 2024

any updates here?

from react-canvas-draw.

tiagoapp avatar tiagoapp commented on June 1, 2024

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.

apenab avatar apenab commented on June 1, 2024

any updates here?

from react-canvas-draw.

skuntze avatar skuntze commented on June 1, 2024

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.

skuntze avatar skuntze commented on June 1, 2024

@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.

mitjana avatar mitjana commented on June 1, 2024

Hello,
I just made a pull request with the line modified. Check PR #141

I hope it can help you.

from react-canvas-draw.

skuntze avatar skuntze commented on June 1, 2024

@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!

EIuZJ3BNmw

from react-canvas-draw.

MaximeYunow avatar MaximeYunow commented on June 1, 2024

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.

Jucesr avatar Jucesr commented on June 1, 2024

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)

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.