如何抓取和拖动元素围绕一个圆? [英] How to grab and drag an element around a circle?
问题描述
到目前为止,我有一个带有标记的圈子。
我想抓住并将标记拖曳到圆圈周围,但目前的功能
我可以对代码进行哪些更改,以便在按住鼠标时可以围绕圆圈拖动标记?/ p>
请注意
如果您可以更新您的解决方案
<$>解决方案c $ c> $(document).ready(function(){
$('#marker')。on('mousedown',function(){
$('body' ).on('mousemove',function(event){
rotateAnnotationCropper($('#innerCircle')。parent(),event.pageX,event.pageY,$('#marker'));
});
});
});
也可以添加此代码
$('body')。on('mouseup',function(event){$('body')。unbind('mousemove')});在函数
中的
jsfiddle http://jsfiddle.net/sandeeprajoria/x5APH/11/
So far I have a circle with a marker.
I would like to grab and drag the marker around the circle, however the current functionality only nudges the marker when you click it.
What changes can I make to the code so that the marker can be dragged around the circle while the mouse is held down?
Note
If you could update the fiddle with your solution I would greatly appreciate it.
changed some code
$(document).ready(function(){
$('#marker').on('mousedown', function(){
$('body').on('mousemove', function(event){
rotateAnnotationCropper($('#innerCircle').parent(), event.pageX,event.pageY, $('#marker'));
});
});
});
also add this code
$('body').on('mouseup', function(event){ $('body').unbind('mousemove')});
in the function
this is the jsfiddle http://jsfiddle.net/sandeeprajoria/x5APH/11/
这篇关于如何抓取和拖动元素围绕一个圆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!