シンプルな HTML キャンバスがあります
<div class='circle'>
<canvas id="myCanvas" width="100" height="100">Your browser does not support the HTML5 canvas tag.</canvas>
</div>
スタイルのある
.circle {
height: auto;
width: auto;
}
とスクリプト
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.arc(50, 50, 50, 0, 2 * Math.PI);
ctx.fill();
$('.circle').draggable({
helper: 'clone' // Remove this line to make it draggable
});
ドラッグしたときに円のコピーを元の位置に保持したいヘルパーオプションを使用できないようです。ドラッグ可能は、ヘルパー オプションを削除した場合にのみ機能します。これは、css を使用して円を描画した場合ではなく、キャンバスでのみ発生しました。フィドルはこちらです。ありがとう!