Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a drawing tool made using HTML5 and canvas .Initially i was using plain images file as background for canvas so i can edit those images, now i have the requirement where i have to use SVG files as background.
(Please refer below code)'panelDrawing' is my parent container,i am assigning a background image to 'divContainer' and putting a canvas layer over it to help drawing.

ASP.NET
<div id="panelDrawing" runat="server" style="width: 1000px; height: 600px">
    <div id="divContainer" runat="server" style="overflow: visible; background-repeat: no-repeat">
        <canvas id="drawCanvas" width="1000px" height="600px">
          <b> *Your browser doesn't support canvas. Please switch to different browser.</b>
        </canvas>
    </div>
      </div>

As i am using SVG files which are actually plot images i have to add zoom in feature to help view the detailed area and then draw on it.
JavaScript
$('#divContainer').css('zoom', "200%");

I am zooming in the div using above jquery, i found that after zooming the div the background image gets zoomed but it cuts off after certain width and height.Is it possible to zoom the div completely with it's background image also zoomed?I have tried lot of things to adjust the background-image but no luck.
Posted

1 solution

I have zoom the image by adding separate image control instead of assigning image as div background but the problem is not yet resolved.After zooming in shapes are not drawn in proper place.How to manage the X,Y position relative to canvas after zooming in?
Current method to get X,Y position
JavaScript
mouseDownX = ev.clientX;
mouseDownY = ev.clientY;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900