jquery - How can I setDraggable(false) on layer by name -
i have problem in program. want setdraggable of layer false. have no idea how set it. created layer when user clicks button. , layer has different name. name of layer set "abc"+i. variable increment. i'm using jquery-1.8.3.js, jquery-ui.js, , kinetic-v4.3.2-beta.js.
document.getelementbyid('computer').addeventlistener('click', function(e) { draw(images); layer.add(img); stage.add(layer); i++; }, false);
and here code of function draw
function draw( images ) { img = new kinetic.rect({ x: 50, y: 150, width: 50, height: 50, fillpatternimage: images.abc, name: "abc"+i, draggable: true }); }
then when user double click on layer, dialog box appear. , saved name of layer variable name.
layer.on( 'dblclick', function(evt) { var shape = evt.shape; name = shape.getname(); $( "#dialog-form" ).dialog( "open" ); }); $( "#dialog-form" ).dialog({ autoopen: false, height: 350, width: 350, modal: true, buttons: { "submit": function() { **name.setdraggable(false);** }, cancel: function() { $( ).dialog( "close" ); } }, close: function() { allfields.val( "" ).removeclass( "ui-state-error" ); } });
i don't know how use that..please help.. thx..
stage.get(name).setdraggable(false);
Comments
Post a Comment