简体   繁体   中英

How do I manipulate an image in an SVG, using mouse actions?

I have:

<html>
    <body>
        <svg>
            <image x="0" y="0" width="5px" height="5px" xlink:href="myimage.png">

How do I let the visitor use click-and-drag actions to scale the image and adjust its placement within the SVG?

UPDATE: I noticed Raphael has click and drag methods so that solves the placement part of my question. How do I let users scale the image? Plan: find the corners of the image, make the area near them selectable & draggable, and use those vectors to update the image dimensions.

UPDATE 2: I got it working! I made some polygons in Raphael and scaled the images with basic vector math.

Take look at code in this link . It's almost exactly what you need.

This link is even better :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM