Missing mode in droppable?
I've found the need to add a mode which calculates strict intersection
between two blocks (based on whether their sides cross).
To add the new mode, you can just include the extra 3 lines shown in
the toleranceMode switch below. Then choose 'sidescross' in the
tolerance.
Did I somehow miss that this is the same as some other mode?
Intersect, which you would think is the same as 'sidescross' seems to
require that a quarter of the block is covering the other.
The modified tolerance switch code is readable at http://pastebin.org/16741
in case the code below is gibberish.
switch (toleranceMode) {
case 'sidescross':
return ! ( l > x2 || r < x1 || t > y2
|| b < y1 ); //added by cefn (http://cefn.com)
break;
case 'fit':
return ( l < x1 && x2 < r
&& t < y1 && y2 < b);
break;
case 'intersect':
return ( l < x1 +
(oDrag.helperSize.width / 2) // Right Half
&& x2 -
(oDrag.helperSize.width / 2) < r // Left Half
&& t < y1 +
(oDrag.helperSize.height / 2) // Bottom Half
&& y2 -
(oDrag.helperSize.height / 2) < b ); // Top Half
break;
case 'pointer':
return ( l < oDrag.rpos[0] &&
oDrag.rpos[0] < r
&& t < oDrag.rpos[1] &&
oDrag.rpos[1] < b);
break;
case 'touch':
return ( (l < x1 && x1 < r && t < y1
&& y1 < b) // Top-Left Corner
|| (l < x1 && x1 < r && t < y2
&& y2 < b) // Bottom-Left Corner
|| (l < x2 && x2 < r && t < y1
&& y1 < b) // Top-Right Corner
|| (l < x2 && x2 < r && t < y2
&& y2 < b) ); // Bottom-Right Corner
break;
default:
return false;
break;
}