I'm building an application where you can zoom in on the mandelbrot by clicking at a point in the mandelbrot. When clicked, the position of the click will be the center of the canvas and the scale will be multiplied by 2 (so you zoom in). But it doesn't work. It does not zoom in at the point where you click.
canvas = new Canvas(GRID_WIDTH, GRID_HEIGHT);
canvas.setOnMouseClicked(e -> {
if(!e.isShiftDown()) {
scale = scale * 2;
xCoordinate = e.getX()/GRID_WIDTH;
yCoordinate = e.getY()/GRID_HEIGHT;
areaFiller.fill2( canvas , xCoordinate, yCoordinate, scale); // creates the mandelbrot with coordinates from the center
}
else {
if(e.isShiftDown()) {
scale = scale / 2;
xCoordinate = e.getX()/GRID_WIDTH;
yCoordinate = e.getY()/GRID_HEIGHT;
areaFiller.fill2( canvas , xCoordinate, yCoordinate, scale);
}
}
});