How is the input not floating when there is a pull-down resistor?
I guess you are getting the doubt because of confusion that the moving part of the switch is opened and this is making you think that it is floating and so D2 must also be floating. No no no. The moving part of the switch and so D2 are at zero volts.

D2 is input. And GND is zero volts. There is no current through R1. So no potential difference across R1. So the voltage at D2 is also zero when the switch is opened.

In other words, Voltage at D2 = Voltage across R1 + GND voltage = 0 + 0 = 0 Volts.