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,10 +199,12 @@ 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()
const transform = d3.event.transform; .scaleExtent([0.5, 4])
svg.select('g').attr('transform', 'translate(' + transform.x + ',' + transform.y + ') scale(' + transform.k + ')'); .on('zoom', () => {
}); const transform = d3.event.transform;
svg.select('g').attr('transform', 'translate(' + transform.x + ',' + transform.y + ') scale(' + transform.k + ')');
});
svg.call(this.zoomBehavior); svg.call(this.zoomBehavior);
const __this = this; const __this = this;