mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-23 12:09:30 -07:00
portrait regional forecast #167
This commit is contained in:
@@ -209,14 +209,14 @@ const getMinMaxLatitudeLongitudeHI = (X, Y, OffsetX, OffsetY) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const getXYForCity = (City, MaxLatitude, MinLongitude, state, maxX = 580) => {
|
const getXYForCity = (City, MaxLatitude, MinLongitude, state, maxX = 580, maxY = 282) => {
|
||||||
if (state === 'AK') getXYForCityAK(City, MaxLatitude, MinLongitude);
|
if (state === 'AK') getXYForCityAK(City, MaxLatitude, MinLongitude);
|
||||||
if (state === 'HI') getXYForCityHI(City, MaxLatitude, MinLongitude);
|
if (state === 'HI') getXYForCityHI(City, MaxLatitude, MinLongitude);
|
||||||
let x = (City.lon - MinLongitude) * 57;
|
let x = (City.lon - MinLongitude) * 57;
|
||||||
let y = (MaxLatitude - City.lat) * 70;
|
let y = (MaxLatitude - City.lat) * 70;
|
||||||
|
|
||||||
if (y < 30) y = 30;
|
if (y < 30) y = 30;
|
||||||
if (y > 282) y = 282;
|
if (y > maxY) y = maxY;
|
||||||
|
|
||||||
if (x < 40) x = 40;
|
if (x < 40) x = 40;
|
||||||
if (x > maxX) x = maxX;
|
if (x > maxX) x = maxX;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const scaling = () => {
|
|||||||
// available space
|
// available space
|
||||||
const available = {
|
const available = {
|
||||||
x: 640,
|
x: 640,
|
||||||
|
y: 282,
|
||||||
};
|
};
|
||||||
|
|
||||||
// map offset
|
// map offset
|
||||||
@@ -29,9 +30,16 @@ const scaling = () => {
|
|||||||
y: 117,
|
y: 117,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (settings.wide?.value && settings.enhanced?.value) {
|
if (settings.enhanced?.value) {
|
||||||
mapOffsetXY.x = 320;
|
if (settings.wide?.value) {
|
||||||
available.x = 854;
|
mapOffsetXY.x = 320;
|
||||||
|
available.x = 854;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.portrait?.value) {
|
||||||
|
mapOffsetXY.y = 400;
|
||||||
|
available.y = 970;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
mapOffsetXY,
|
mapOffsetXY,
|
||||||
@@ -121,7 +129,7 @@ class RegionalForecast extends WeatherDisplay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get XY on map for city
|
// get XY on map for city
|
||||||
const cityXY = utils.getXYForCity(city, minMaxLatLon.maxLat, minMaxLatLon.minLon, this.weatherParameters.state, available - 60);
|
const cityXY = utils.getXYForCity(city, minMaxLatLon.maxLat, minMaxLatLon.minLon, this.weatherParameters.state, available.x - 60, available.y);
|
||||||
|
|
||||||
// wait for the regional observation if it's not done yet
|
// wait for the regional observation if it's not done yet
|
||||||
const observation = await observationPromise;
|
const observation = await observationPromise;
|
||||||
|
|||||||
Reference in New Issue
Block a user