ofrohn / d3-celestial

A star map with d3.js
BSD 3-Clause "New" or "Revised" License
631 stars 179 forks source link

Bug when specifying zoomlevel in config #113

Open eisenfaust12 opened 3 years ago

eisenfaust12 commented 3 years ago

Hi,

there appears to be a bug when specifying a zoomlevel in the config that is passed to Celestial.display where the size and exponent values for stars are not properly evaluated. The stars are rendered much too tiny. Take a look at the following two pictures. The first one didn't have a zoomlevel specified and I zoomed in manually with the mouse-wheel. The second one has a specified zoomlevel of 5.

Does Anyone have an idea how to fix this? Thanks! good bad

eisenfaust12 commented 3 years ago

Well, I seemingly "fixed" it by commenting out line 71 in Celestial.display in celestial.js , i.e.

  mapProjection = Celestial.projection(cfg.projection).rotate(rotation).translate([canvaswidth/2, canvasheight/2]).scale(scale * zoomlevel);

  zoom = d3.geo.zoom().projection(mapProjection).center([canvaswidth/2, canvasheight/2]).scaleExtent([scale, scale * zoomextent]).on("zoom.redraw", redraw);
  // Set initial zoom level
//  scale *= zoomlevel;

  var canvas = d3.select(parentElement).selectAll("canvas"),
      culture = (cfg.culture !== "" && cfg.culture !== "iau") ? cfg.culture : "";

But I don't understand the code well enough and I assume this line is there for a reason. Maybe you can have a look @ofrohn ? Thanks!