1

I'm trying to draw an image on my Raphael canvas. I don't want to just draw a rect on top of an image or behind it because I want to be able to drag the image around. I have tried the following:

var rect2 = s.rect(posx, posy, 40, 40).attr({
            fill: 'url(../images/pi.svg)',
            stroke: "5",
            opacity: .5,
            cursor: "move"
        });

But my image either shows a small corner of it in the rect or doesn't show anything at all (depending on which image I use). How can I get a small image on my canvas?

unconditionalcoder
  • 723
  • 1
  • 13
  • 25
  • 1
    Possible duplicate of [Using Raphael JS, fill an SVG element with with a background-image with an offset](http://stackoverflow.com/questions/5378390/using-raphael-js-fill-an-svg-element-with-with-a-background-image-with-an-offse) – Ian Jun 23 '16 at 08:23

0 Answers0