I drag the event after I release the mouse I need to detect the collision events, if I found collision events I’ll rollback the operation and all changes, but I didn’t know how to cancel a operation in currently codes.
And call it in mouse_up function:
scheduler._on_mouse_up=function(e){
if (this._drag_mode && this._drag_id){
this._els[“dhx_cal_data”][0].style.cursor=“default”;
//drop
var ev=this.getEvent(this._drag_id);
if (!this._drag_event.start_date || ev.start_date.valueOf()!=this._drag_event.start_date.valueOf() || ev.end_date.valueOf()!=this._drag_event.end_date.valueOf()){
this.callEvent(“onBeforeEventChanged”,[this._drag_event.start_date, this._drag_event.end_date]);
…
Then make the collision detect and rollback my operation and changes:
this.attachEvent(“onEventChanged”,function(id){
if (getCollision(id)){
scheduler.getEvent(id).start_date=collisionStartDate;
scheduler.getEvent(id).end_date=collisionEndDate;
}
if (!this._loading && this.validId(id)){
dp.setUpdated(id,true,“updated”);
}
});
But I didn’t thinks this was a high efficient way to implement this, so have any other idea on this?