@@ -362,6 +362,7 @@ var TOPPATH = 'm0,1l' + (CLEN / 2) + ',' + (CLEN * 0.87) +
362
362
'l2.6,-1.5l-' + ( CLEN / 2 + 2.6 ) + ',-' + ( CLEN * 0.87 + 4.5 ) +
363
363
'l-' + ( CLEN / 2 + 2.6 ) + ',' + ( CLEN * 0.87 + 4.5 ) +
364
364
'l2.6,1.5l' + ( CLEN / 2 ) + ',-' + ( CLEN * 0.87 ) + 'Z' ;
365
+ var STARTMARKER = 'm0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z' ;
365
366
366
367
// I guess this could be shared with cartesian... but for now it's separate.
367
368
var SHOWZOOMOUTTIP = true ;
@@ -440,12 +441,16 @@ proto.init_interactions = function() {
440
441
clearSelect ( ) ;
441
442
}
442
443
444
+ function getAFrac ( x , y ) { return 1 - ( y / _this . h ) ; }
445
+ function getBFrac ( x , y ) { return 1 - ( ( x + ( _this . h - y ) / Math . sqrt ( 3 ) ) / _this . w ) ; }
446
+ function getCFrac ( x , y ) { return ( ( x - ( _this . h - y ) / Math . sqrt ( 3 ) ) / _this . w ) ; }
447
+
443
448
function zoomMove ( dx0 , dy0 ) {
444
449
var x1 = x0 + dx0 ,
445
450
y1 = y0 + dy0 ,
446
- afrac = Math . max ( 0 , 1 - Math . max ( y0 , y1 ) / _this . h ) ,
447
- bfrac = Math . max ( 0 , 1 - Math . max ( x0 + y0 / Math . sqrt ( 3 ) , x1 + y1 / Math . sqrt ( 3 ) ) / _this . w ) ,
448
- cfrac = Math . max ( 0 , Math . min ( x0 - y0 / Math . sqrt ( 3 ) , x1 - y1 / Math . sqrt ( 3 ) ) / _this . w ) ,
451
+ afrac = Math . max ( 0 , Math . min ( 1 , getAFrac ( x0 , y0 ) , getAFrac ( x1 , y1 ) ) ) ,
452
+ bfrac = Math . max ( 0 , Math . min ( 1 , getBFrac ( x0 , y0 ) , getBFrac ( x1 , y1 ) ) ) ,
453
+ cfrac = Math . max ( 0 , Math . min ( 1 , getCFrac ( x0 , y0 ) , getCFrac ( x1 , y1 ) ) ) ,
449
454
xLeft = ( ( afrac / 2 ) + cfrac ) * _this . w ,
450
455
xRight = ( 1 - ( afrac / 2 ) - bfrac ) * _this . w ,
451
456
xCenter = ( xLeft + xRight ) / 2 ,
@@ -467,7 +472,8 @@ proto.init_interactions = function() {
467
472
zb . attr ( 'd' , path0 + 'M' + xLeft + ',' + yBottom +
468
473
'H' + xRight + 'L' + xCenter + ',' + yTop +
469
474
'L' + xLeft + ',' + yBottom + 'Z' ) ;
470
- corners . attr ( 'd' , 'M' + xLeft + ',' + yBottom + BLPATH +
475
+ corners . attr ( 'd' , 'M' + x0 + ',' + y0 + STARTMARKER +
476
+ 'M' + xLeft + ',' + yBottom + BLPATH +
471
477
'M' + xRight + ',' + yBottom + BRPATH +
472
478
'M' + xCenter + ',' + yTop + TOPPATH ) ;
473
479
}
0 commit comments