View | Details | Raw Unified | Return to bug 239053 | Differences between
and this patch

Collapse All | Expand All

(-)ManhattanConnectionRouter.java (-6 / +11 lines)
Lines 299-304 Link Here
299
	Ray startNormal = getStartDirection(conn);
299
	Ray startNormal = getStartDirection(conn);
300
	Ray endNormal   = getEndDirection(conn);
300
	Ray endNormal   = getEndDirection(conn);
301
301
302
	// Those are used to keep the proper part of a vector (horizontal or vertical) using
303
	// a dot product without changing direction of result.
304
    Ray startOrientation = new Ray(Math.abs(startNormal.x), Math.abs(startNormal.y));
305
    Ray endOrientation = new Ray(Math.abs(endNormal.x), Math.abs(endNormal.y));
306
302
	List positions = new ArrayList(5);
307
	List positions = new ArrayList(5);
303
	boolean horizontal = startNormal.isHorizontal();
308
	boolean horizontal = startNormal.isHorizontal();
304
	if (horizontal) 
309
	if (horizontal) 
Lines 314-320 Link Here
314
		} else {
319
		} else {
315
			// 2
320
			// 2
316
			if (startNormal.dotProduct(direction) < 0)
321
			if (startNormal.dotProduct(direction) < 0)
317
				i = startNormal.similarity(start.getAdded(startNormal.getScaled(10)));
322
				i = startOrientation.dotProduct(start.getAdded(startNormal.getScaled(10)));
318
			else {
323
			else {
319
				if (horizontal) 
324
				if (horizontal) 
320
					i = average.y;
325
					i = average.y;
Lines 325-331 Link Here
325
			horizontal = !horizontal;
330
			horizontal = !horizontal;
326
331
327
			if (endNormal.dotProduct(direction) > 0)
332
			if (endNormal.dotProduct(direction) > 0)
328
				i = endNormal.similarity(end.getAdded(endNormal.getScaled(10)));
333
				i = endOrientation.dotProduct(end.getAdded(endNormal.getScaled(10)));
329
			else {
334
			else {
330
				if (horizontal) 
335
				if (horizontal) 
331
					i = average.y;
336
					i = average.y;
Lines 339-353 Link Here
339
		if (startNormal.dotProduct(endNormal) > 0) {
344
		if (startNormal.dotProduct(endNormal) > 0) {
340
			//1
345
			//1
341
			if (startNormal.dotProduct(direction) >= 0)
346
			if (startNormal.dotProduct(direction) >= 0)
342
				i = startNormal.similarity(start.getAdded(startNormal.getScaled(10)));
347
				i = startOrientation.dotProduct(start.getAdded(startNormal.getScaled(10)));
343
			else
348
			else
344
				i = endNormal.similarity(end.getAdded(endNormal.getScaled(10)));
349
				i = endOrientation.dotProduct(end.getAdded(endNormal.getScaled(10)));
345
			positions.add(new Integer(i));
350
			positions.add(new Integer(i));
346
			horizontal = !horizontal;
351
			horizontal = !horizontal;
347
		} else {
352
		} else {
348
			//3 or 1
353
			//3 or 1
349
			if (startNormal.dotProduct(direction) < 0) {
354
			if (startNormal.dotProduct(direction) < 0) {
350
				i = startNormal.similarity(start.getAdded(startNormal.getScaled(10)));
355
				i = startOrientation.dotProduct(start.getAdded(startNormal.getScaled(10)));
351
				positions.add(new Integer(i));
356
				positions.add(new Integer(i));
352
				horizontal = !horizontal;
357
				horizontal = !horizontal;
353
			}
358
			}
Lines 360-366 Link Here
360
			horizontal = !horizontal;
365
			horizontal = !horizontal;
361
366
362
			if (startNormal.dotProduct(direction) < 0) {
367
			if (startNormal.dotProduct(direction) < 0) {
363
				i = endNormal.similarity(end.getAdded(endNormal.getScaled(10)));
368
				i = endOrientation.dotProduct(end.getAdded(endNormal.getScaled(10)));
364
				positions.add(new Integer(i));
369
				positions.add(new Integer(i));
365
				horizontal = !horizontal;
370
				horizontal = !horizontal;
366
			}
371
			}

Return to bug 239053