如何在开始旋转时保持克隆元素的旋转位置使用jquery

How to maintain position of rotation for cloned element when start rotating using jquery

本文关键字:旋转 位置 元素 jquery 开始      更新时间:2023-09-26

当我克隆可旋转元素时,之前的旋转是在我开始克隆元素时开始的。PLS帮助这个

var newdiv = $(imageid).parent().clone();
                var id = "div" + divid;
                var imid = "img" + imgid;
                $(newdiv).attr('id', id);
                $(newdiv).find("img:first").attr("id", imid)
                $(newdiv).css("z-index", newZindex);
                $(newdiv).find('.ui-resizable-handle').remove();
                var position = $(imageid).parent().position();
                $(newdiv).addClass("selected clone").css({ "top": position.top + 20, "left": position.left + 20 }).appendTo("#selectable"); 
               $("#" + id).rotatable({ handle: $(newdiv).find('img:last').addClass("rotatable-handle") }, {
                stop: stopHandlerRotate,
                start: startHandlerRotate
            }).resizable({
                handles: "n, e, s, w, nw, ne, sw,se"
            }, {
                stop: stopHandlerResize,
                start: startHandlerResize
            }).draggable({
                stop: stopHandlerDrag,
                start: startHandlerDrag
            });

当我克隆元素时,它像这样检查图像克隆。当我点击开始旋转时,它会转到起始位置。检查图像克隆旋转

我在这里找到了重新绑定之前的先前角度,并在绑定时给出了它。

$("#" + id).rotatable({ handle: $(newdiv).find('img:last').addClass("rotatable-handle") },{angle:previousangle}, {
                stop: stopHandlerRotate,
                start: startHandlerRotate
            }).resizable({
                handles: "n, e, s, w, nw, ne, sw,se"
            }, {
                stop: stopHandlerResize,
                start: startHandlerResize
            }).draggable({
                stop: stopHandlerDrag,
                start: startHandlerDrag
            });