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 116 346 101 336 91 351 91" stroke="green" fill="transparent" stroke-width="5" transform="rotate(0 356 93.5)"></polygon> <path class="drag-svg" d="M451,91 Q471,66,481,91 T521,91 " fill="none" stroke="blue" stroke-width="5" transform="rotate(0 486 91)"></path> <g class="drag-svg" style="visibility: visible; cursor: move;"> <ellipse cx="150.5" cy="75.478994" rx="25.75" ry="19.97899159663865" fill="#ffffff" stroke="#000000" pointer-events="all" transform="rotate(0 150.5 134.75)"></ellipse> <path d="M150.5,94.12605099999999 L150.5,160.722692 M150.5,107.445385 L202,107.445385 M150.5,107.445385 L99,107.445385 M150.5,160.722692 L202,214 M150.5,160.722692 L99,214 " fill="none" stroke="white" stroke-miterlimit="10" pointer-events="stroke" visibility="hidden" stroke-width="9" transform="rotate(0 150.5 134.75)"></path> <path d="M150.5,94.12605099999999 L150.5,160.722692 M150.5,107.445385 L202,107.445385 M150.5,107.445385 L99,107.445385 M150.5,160.722692 L202,214 M150.5,160.722692 L99,214 " fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="all&.........完整代码请登录后点击上方下载按钮下载查看
网友评论0