如何在画布对象上使用jquery ui可拖动方法? [英] How to use the jquery ui draggable method on an canvas object?

查看:111
本文介绍了如何在画布对象上使用jquery ui可拖动方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让用户能够使用draggable方法在画布元素周围移动矩形.

I'm trying to allow the user the ability to move a rectangle around a canvas element using the draggable method.

这是我最初的想法,但是不起作用.

This was my original thought but it doesn't work.

我在 http://jsfiddle.net/r2Zbe/

$("button").click(function () {
    var door = bgContext.strokeRect(20, 20, 50, 150);
    door.draggable();
});

推荐答案

不确定将jQuery UI与画布一起使用,但是如果您正在使用画布,则可能需要看一下EaselJS.它使一切(包括拖放操作)都非常简单.

Not sure about using jQuery UI with canvas, but if you are working with canvas you may want to take a look at EaselJS. It makes everything, including drag and drop, very simple.

EaselJS

这篇关于如何在画布对象上使用jquery ui可拖动方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆