zoom fixed 0.5x ~ 4x

This commit is contained in:
crusader 2018-09-18 02:12:35 +09:00
parent 46349fb178
commit 485dc7e8c1

View File

@ -199,7 +199,9 @@ export class HomePageComponent implements OnInit, OnDestroy {
const svg = d3.select(this.discoveryTargetRef.nativeElement); const svg = d3.select(this.discoveryTargetRef.nativeElement);
this.zoomBehavior = d3.zoom().on('zoom', () => { this.zoomBehavior = d3.zoom()
.scaleExtent([0.5, 4])
.on('zoom', () => {
const transform = d3.event.transform; const transform = d3.event.transform;
svg.select('g').attr('transform', 'translate(' + transform.x + ',' + transform.y + ') scale(' + transform.k + ')'); svg.select('g').attr('transform', 'translate(' + transform.x + ',' + transform.y + ') scale(' + transform.k + ')');
}); });