Movable¶
-
class
webix.
Movable
()¶ Movable mixin
External references¶
Code¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | webix.Movable = {
move_setter: function (value) {
if (value){
this._move_admin = webix.clone(this._move_admin);
this._move_admin.master = this;
webix.DragControl.addDrag(this._headobj, this._move_admin);
}
return value;
},
_move_admin: {
$dragCreate:function(object, e){
if(this.master.config.move){
var offset = webix.html.offset(object);
var pos = webix.html.pos(e);
webix.DragControl.top = offset.y - pos.y;
webix.DragControl.left = offset.x - pos.x;
return webix.toNode(this.master._viewobj);
}
},
$dragDestroy:function(node, drag){
var view = this.master;
if (view._settings){
view._settings.top = parseInt(drag.style.top,10);
view._settings.left = parseInt(drag.style.left,10);
}
webix.DragControl.top = webix.DragControl.left = 5;
this.master.callEvent("onViewMoveEnd", []);
return;
},
$dragPos:function(pos, e){
this.master.callEvent("onViewMove", [pos, e]);
}
}
};
|