N
nstasiv
Hello,
the idea is to make object draggable with code like this
var callout = new Callout(...);
new Draggable(callout);
where new Callout(...) adds some elements to DOM tree and new Draggale
does the trick:
function Draggable(_obj){
this.obj = _obj;
this.clickedX=0;
this.clickedY=0;
this.origX=0;
this.origY=0;
this.obj.onmousedown = function(evt){
this.pickup(evt);
}
this.obj.onmouseup = function(evt){
this.dropoff(evt);
}
this.obj.onmousemove = function(evt){
this.givealift(evt);
}
}
Draggable.prototype.givealift = function(evt)...
Draggable.prototype.pickup = function(evt)...
Draggable.prototype.dropdown = function(evt)...
I used to install event handler with e.setAttribute("onmousedown",
"pickup(evt)")
and everything worked fine, then I made scripts in object oriented way
but code
this.obj.onmousedown = function(evt){
this.pickup(evt);
}
won't work as expected, please help!
Thank you
Nazar
the idea is to make object draggable with code like this
var callout = new Callout(...);
new Draggable(callout);
where new Callout(...) adds some elements to DOM tree and new Draggale
does the trick:
function Draggable(_obj){
this.obj = _obj;
this.clickedX=0;
this.clickedY=0;
this.origX=0;
this.origY=0;
this.obj.onmousedown = function(evt){
this.pickup(evt);
}
this.obj.onmouseup = function(evt){
this.dropoff(evt);
}
this.obj.onmousemove = function(evt){
this.givealift(evt);
}
}
Draggable.prototype.givealift = function(evt)...
Draggable.prototype.pickup = function(evt)...
Draggable.prototype.dropdown = function(evt)...
I used to install event handler with e.setAttribute("onmousedown",
"pickup(evt)")
and everything worked fine, then I made scripts in object oriented way
but code
this.obj.onmousedown = function(evt){
this.pickup(evt);
}
won't work as expected, please help!
Thank you
Nazar