【问题标题】:How to drag and drop the polygons in a canvas when drawing the polygon dynamically using mouse clicks?使用鼠标单击动态绘制多边形时如何在画布中拖放多边形?
【发布时间】:2016-04-11 16:19:43
【问题描述】:

当您使用带有 HTML 的 JavaScript 通过鼠标单击动态绘制多边形时,如何在画布中拖放多边形?我试过了:

<div class="draggable">
    <button id=done hidden>Click when done assigning points>
    <canvas id="canvas" width=450 height=450 class="draggable"></canvas>
</div>

【问题讨论】:

    标签: javascript html


    【解决方案1】:

    将坐标保存在 js 变量中,并通过鼠标点击在画布上重绘多边形。

    方块示例:http://simonsarris.com/blog/140-canvas-moving-selectable-shapes

    【讨论】:

      猜你喜欢
      • 2012-04-22
      • 1970-01-01
      • 2015-06-09
      • 2016-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多