[英]kinetic.js drag and drop doesn't work unless I enable it for the entire stage
將對象的draggable
設置為true
,除非我也為舞台啟用了它們,否則它們是不可拖動的。 但是,這在我的應用程序中是非常不希望的; 我只希望某些特定對象可拖動。
function initGUI()
{
stage = new Kinetic.Stage(
{
container: 'stage',
width: w.innerWidth,
height: w.innerHeight,
// draggable: true // Uncommenting this makes everything draggable
});
layer = new Kinetic.Layer();
stage.add(layer);
var debugRect = new Kinetic.Rect(
{
fill: 'green',
x: 0,
y: 0,
draggable: true, // This isn't draggable despite this line
width: 200,
height: 200
})
layer.add(debugRect);
}
HTML:
<body>
<div id="stage"></div>
</body>
我以前曾將Kinetic用於某些應用程序,但從未遇到過。
請看一下。它正在工作! 演示版
var stage = new Kinetic.Stage({
container: 'container',
width: 578,
height: 500
});
var layer = new Kinetic.Layer();
stage.add(layer);
var debugRect = new Kinetic.Rect(
{
fill: 'green',
x: 0,
y: 0,
draggable: true, // This isn't draggable despite this line
width: 200,
height: 200
})
layer.add(debugRect);
layer.draw();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.