Solar Clock: BUGFIX:Sun sometimes disappearing from view completely until button1 is pressed.
parent
581e2773d7
commit
91a957adeb
|
|
@ -350,7 +350,7 @@ location.addUpdateListener(
|
||||||
// The function also has to detect when the end of the solar
|
// The function also has to detect when the end of the solar
|
||||||
// day has been reached and flip the day over.
|
// day has been reached and flip the day over.
|
||||||
function dayInfo(now) {
|
function dayInfo(now) {
|
||||||
if (day_info == null || now > day_info.day_end) {
|
if (day_info == null || now > day_info.day_end || now < day_info.day_start) {
|
||||||
var coords = location.getCoordinates();
|
var coords = location.getCoordinates();
|
||||||
if(coords != null) {
|
if(coords != null) {
|
||||||
day_info = DateUtils.sunrise_sunset(now, coords[0], coords[1], location.getUTCOffset());
|
day_info = DateUtils.sunrise_sunset(now, coords[0], coords[1], location.getUTCOffset());
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,6 @@ class SolarMode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class NightMode extends SolarMode {
|
class NightMode extends SolarMode {
|
||||||
toString(){return "NightMode";}
|
|
||||||
test(time, day_info, screen_info, img_info) {
|
test(time, day_info, screen_info, img_info) {
|
||||||
return (time < day_info.sunrise_date || time > day_info.sunset_date);
|
return (time < day_info.sunrise_date || time > day_info.sunset_date);
|
||||||
}
|
}
|
||||||
|
|
@ -130,9 +129,6 @@ class NightMode extends SolarMode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class DayLightMode extends SolarMode {
|
class DayLightMode extends SolarMode {
|
||||||
toString(){
|
|
||||||
return "DayLightMode";
|
|
||||||
}
|
|
||||||
test(time, day_info, screen_info){
|
test(time, day_info, screen_info){
|
||||||
var sun_height = screen_info.sunrise_y - screen_info.sun_y;
|
var sun_height = screen_info.sunrise_y - screen_info.sun_y;
|
||||||
/*console.log("DayLightMode " +
|
/*console.log("DayLightMode " +
|
||||||
|
|
@ -190,9 +186,6 @@ class DayLightMode extends SolarMode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class TwiLightMode extends SolarMode {
|
class TwiLightMode extends SolarMode {
|
||||||
toString(){
|
|
||||||
return "TwilightMode";
|
|
||||||
}
|
|
||||||
test(time, day_info, screen_info){
|
test(time, day_info, screen_info){
|
||||||
if(screen_info.sunrise_y == null) {
|
if(screen_info.sunrise_y == null) {
|
||||||
console.log("warning no sunrise_defined");
|
console.log("warning no sunrise_defined");
|
||||||
|
|
@ -233,9 +226,6 @@ class SolarControllerImpl {
|
||||||
this.default_mode = new NightMode();
|
this.default_mode = new NightMode();
|
||||||
this.last = null;
|
this.last = null;
|
||||||
}
|
}
|
||||||
toString(){
|
|
||||||
return "SolarControllerImpl";
|
|
||||||
}
|
|
||||||
// The mode method is responsible for selecting the
|
// The mode method is responsible for selecting the
|
||||||
// correct mode to the time given.
|
// correct mode to the time given.
|
||||||
mode(time, day_info, screen_info){
|
mode(time, day_info, screen_info){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue