MCPcopy Index your code
hub / github.com/ajatkj/scriptable / parseCoordinates

Function parseCoordinates

LSWeather.js:827–842  ·  view source on GitHub ↗
(xy,wh,field)

Source from the content-addressed store, hash-verified

825FUNCTION parseCoordinates
826------------------------------------------------------------------*/
827function parseCoordinates(xy,wh,field){
828 const imageSize=DEVICE_RESOLUTION;
829 let left_margin, right_margin, center, top_margin, bottom_margin;
830 if (xy == 'x') {
831 left_margin = 0;
832 right_margin = imageSize.width - wh;
833 center = (imageSize.width/2) - (wh/2);
834 if (field < 0) field = "right_margin - " + (field * -1);
835 } else {
836 top_margin = 0;
837 bottom_margin = imageSize.height - wh;
838 center = (imageSize.height/2) - (wh/2);
839 if (field < 0) field = "bottom_margin - " + (field * -1);
840 }
841 return eval(`${field}`);
842}
843/*------------------------------------------------------------------
844FUNCTION getWeatherSymbol
845------------------------------------------------------------------*/

Callers 1

updateLayoutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected