subjx.js实现拖动旋转缩放svg元素效果代码
代码语言:html
所属分类:其他
代码描述:subjx.js实现拖动旋转缩放svg元素效果代码
代码标签: subjx.js 拖动 旋转 缩放 svg 元素
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/subjx-min.css">
<style>
html,
body {
margin: 0;
padding: 0;
height: 100%;
touch-action: manipulation;
}
.draggable {
position: absolute;
width: 150px;
height: 50px;
background-color: yellow;
}
.clonable {
position: absolute;
width: 50px;
height: 50px;
left: 0;
}
</style>
</head>
<body >
<div style="width:100%; height:100%;">
<div style="position: absolute; display: inline; box-sizing: border-box; color: black">
Double click on element to activate/deactivate
<div id="move">
Move:
<span></span>
</div>
<div id="resize">
Resize:
<span></span>
</div>
<div id="rotate">
Rotate:
<span></span>
</div>
</div>
<svg id="svg-container" width="100%" height="50%" transform="scale(1, 1)">
<rect class="drag-svg" x="552" y="209" width="30" height="30" stroke="black" fill="transparent" stroke-width="5" transform="rotate(0 567 224)"></rect>
<rect class="drag-svg" x="469" y="211" rx="10" ry="10" width="30" height="30" stroke="black" fill="transparent" stroke-width="5" transform="rotate(0 484 226)"></rect>
<circle cx="792" cy="152" r="20" stroke="red" fill="transparent" stroke-width="5" transform="rotate(0 792 152)"></circle>
<ellipse class="drag-svg" cx="358" cy="222" rx="22.000000000000004" ry="17" stroke="red" fill="transparent" stroke-width="5" transform="rotate(0 358 222)"></ellipse>
<line class="drag-svg" x1="626" x2="666" y1="200" y2="240" stroke="orange" fill="transparent" stroke-width="5" transform="rotate(0 646 220)"></line>
<polyline class="drag-svg" points="599 73 604 83 609 78 614 93 619 88 624 103 629 98 634 113 639 108" stroke="orange" fill="transparent" stroke-width="5" transform="rotate(0 619 93)"></polyline>
<polygon class="drag-svg" points="356 71 361 91 376 91 366 101 371 116 356 106 341 1.........完整代码请登录后点击上方下载按钮下载查看
网友评论0