xref: /webtrees/resources/views/modules/fanchart/chart.phtml (revision 9ed80f829cfb208ae92f7928345696619569bf4e)
1<?= $html ?>
2
3<map id="fan-chart-map" name="fan-chart-map">
4	<?= $areas ?>
5</map>
6
7<div class="text-center">
8	<img class="wt-chart-fan-img" src="data:image/png;base64,<?= base64_encode($png) ?>" width="<?= $fanw ?>" height="<?= $fanh ?>" alt="<?= strip_tags($title) ?>" usemap="#fan-chart-map">
9</div>
10
11<script>
12  jQuery("area")
13    .click(function (e) {
14      e.stopPropagation();
15      e.preventDefault();
16      var target = jQuery(this.hash);
17      // position the menu centered immediately above the mouse click position and
18      // make sure it doesn’t end up off the screen
19      target
20        .css({
21          left: Math.max(0, e.pageX - (target.outerWidth() / 2)),
22          top:  Math.max(0, e.pageY - target.outerHeight())
23        })
24        .toggle()
25        .siblings(".fan_chart_menu").hide();
26    });
27  jQuery(".fan_chart_menu")
28    .on("click", "a", function (e) {
29      e.stopPropagation();
30    });
31  jQuery("#fan_chart")
32    .click(function (e) {
33      jQuery(".fan_chart_menu").hide();
34    });
35</script>
36