// FIXME: need to handle grab mode and extrapolate coords outside map
if (grab && !inside) return EINA_FALSE;
- int i, j, edges, edge[m->count][2];
+ int i, j, edges, edgesx, edge[m->count][2], edgex[m->count][2];
Eina_Bool douv = EINA_FALSE;
double xe[2];
double u[2] = { 0.0, 0.0 };
double v[2] = { 0.0, 0.0 };
+ double xc = 0.0, yc = 0.0;
/*
if (grab)
}
*/
edges = EINA_FALSE;
+ edgesx = EINA_FALSE;
for (i = 0; i < m->count; i++)
{
j = (i + 1) % m->count;
edge[edges][1] = i;
edges++;
}
+ if ((m->points[i].x <= x) && (m->points[j].x > x))
+ {
+ edgex[edgesx][0] = i;
+ edgex[edgesx][1] = j;
+ edgesx++;
+ }
+ else if ((m->points[j].x <= x) && (m->points[i].x > x))
+ {
+ edgex[edgesx][0] = j;
+ edgex[edgesx][1] = i;
+ edgesx++;
+ }
}
+ if (edges > 1) {
+ if (edge[0][1] < edge[0][0]) xc = -1.0;
+ }
+ if (edgesx > 1) {
+ if (edgex[0][1] < edgex[0][0]) yc = -1.0;
+ }
if ((mx) || (my)) douv = EINA_TRUE;
for (i = 0; i < (edges - 1); i+= 2)
{
if (douv)
{
if (mx)
- *mx = u[0] + (((x - xe[0]) * (u[1] - u[0])) /
- (xe[1] - xe[0]));
+ *mx = u[0] + xc + (((x - xe[0]) * (u[1] - u[0])) /
+ (xe[1] - xe[0]));
if (my)
- *my = v[0] + (((x - xe[0]) * (v[1] - v[0])) /
- (xe[1] - xe[0]));
+ *my = v[0] + yc + (((x - xe[0]) * (v[1] - v[0])) /
+ (xe[1] - xe[0]));
}
return EINA_TRUE;
}