mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-25 07:16:00 +02:00
modified walter zorns wz_dragdrop.js to have a defined focus on the draggables (e.g. top left or center center) - sent these changes to walter zorn as he thought himself about implementing that, set calendar events to focus now on top center with a border of 2 pixels to make dragging more logical for the user - modified dragdrop class to take focus as e.g. 'top left 5' focuses draggable on top left with a border of 5 pixels inside
This commit is contained in:
@@ -374,6 +374,9 @@ dd.addProps = function(d_o)
|
||||
d_o._setCrs(d_o.nodrag? 'auto' : d_o.cursor);
|
||||
d_o.diaphan = d_o.diaphan || dd.diaphan || 0;
|
||||
d_o.opacity = 1.0;
|
||||
d_o.focus_x = 'center';
|
||||
d_o.focus_y = 'center';
|
||||
d_o.focus_border = 0;
|
||||
d_o.visible = true;
|
||||
};
|
||||
dd.initz = function()
|
||||
@@ -865,6 +868,12 @@ DDObj.prototype._setOpaRel = function(d_x, d_kd, d_y, d_o)
|
||||
if(!(d_o = this.children[d_i]).detached) d_o._setOpaRel(d_x, 1);
|
||||
}
|
||||
};
|
||||
DDObj.prototype.setFocus = function(d_y, d_x,d_b)
|
||||
{
|
||||
this.focus_y = d_y;
|
||||
this.focus_x = d_x;
|
||||
this.focus_border = d_b;
|
||||
};
|
||||
DDObj.prototype.setCursor = function(d_x)
|
||||
{
|
||||
this._setCrs(this.cursor = (d_x.indexOf('c:')+1)? d_x.substring(2) : d_x);
|
||||
@@ -890,11 +899,38 @@ DDObj.prototype.setScalable = function(d_x)
|
||||
};
|
||||
DDObj.prototype.getEltBelow = function(d_ret, d_x, d_y)
|
||||
{
|
||||
switch(this.focus_y)
|
||||
{
|
||||
case 'top':
|
||||
var f_y = 0 + this.focus_border;
|
||||
break;
|
||||
case 'bottom':
|
||||
var f_y = this.h - this.focus_border;
|
||||
break;
|
||||
case 'center':
|
||||
default:
|
||||
var f_y = this.h/2;
|
||||
break;
|
||||
}
|
||||
switch(this.focus_x)
|
||||
{
|
||||
case 'left':
|
||||
var f_x = 0 + this.focus_border;
|
||||
break;
|
||||
case 'right':
|
||||
var f_x = this.w - this.focus_border;
|
||||
break;
|
||||
case 'center':
|
||||
default:
|
||||
var f_x = this.w/2;
|
||||
break;
|
||||
}
|
||||
|
||||
var d_o, d_cmp = -1, d_i = dd.elements.length; while(d_i--)
|
||||
{
|
||||
d_o = dd.elements[d_i];
|
||||
d_x = d_o.x-this.w/2;
|
||||
d_y = d_o.y-this.h/2;
|
||||
d_x = d_o.x-f_x;
|
||||
d_y = d_o.y-f_y;
|
||||
if(d_o.visible && d_o.z < this.z && this.x >= d_x && this.x <= d_x+d_o.w && this.y >= d_y && this.y <= d_y+d_o.h)
|
||||
{
|
||||
if(d_o.z > d_cmp)
|
||||
|
Reference in New Issue
Block a user