diff --git a/tools/formatter.py b/tools/formatter.py index 22dff13d..852ce3ad 100644 --- a/tools/formatter.py +++ b/tools/formatter.py @@ -326,16 +326,12 @@ def update_center(entry: dict): if isinstance(entry['path'], list): path = entry['path'] if len(path) > 1: - calculated_center = calculate_center(path) - if 'center' not in entry or entry['center'] != calculated_center: - entry['center'] = calculated_center + entry['center'] = calculate_center(path) else: for key in entry['path']: path = entry['path'][key] if len(path) > 1: - calculated_center = calculate_center(path) - if 'center' not in entry or key not in entry['center'] or entry['center'][key] != calculated_center: - entry['center'][key] = calculated_center + entry['center'][key] = calculate_center(path) return entry diff --git a/web/_js/draw.js b/web/_js/draw.js index 67f8bb84..fd4a8fdc 100644 --- a/web/_js/draw.js +++ b/web/_js/draw.js @@ -12,8 +12,6 @@ https://place-atlas.stefanocoding.me/license.txt ======================================================================== */ -import polylabel from './polylabel.js'; - const finishButton = document.getElementById("finishButton"); const resetButton = document.getElementById("resetButton"); const undoButton = document.getElementById("undoButton"); @@ -53,6 +51,8 @@ let periodGroupElements = [] let disableDrawingOverride = false let drawing = true; +let undoHistory = []; + const periodClipboard = { "index": null, "path": null @@ -65,6 +65,7 @@ const periodClipboard = { }) }) +window.initDraw = initDraw function initDraw() { wrapper.classList.remove('listHidden') @@ -88,8 +89,6 @@ function initDraw() { container.style.cursor = "crosshair"; - let undoHistory = []; - render(path); container.addEventListener("mousedown", function (e) { @@ -250,7 +249,7 @@ function initDraw() { path: {}, }; - pathWithPeriodsTemp = pathWithPeriods.concat() + const pathWithPeriodsTemp = pathWithPeriods.concat() // console.log(pathWithPeriodsTemp) @@ -442,7 +441,7 @@ function initDraw() { const params = new URLSearchParams(document.location.search) if (params.has('id')) { - entry = getEntry(params.get('id')) + const entry = getEntry(params.get('id')) nameField.value = entry.name descriptionField.value = entry.description websiteField.value = entry.links.website.join('\n') diff --git a/web/_js/polylabel.js b/web/_js/polylabel.js index 849ee569..e6c9d333 100644 --- a/web/_js/polylabel.js +++ b/web/_js/polylabel.js @@ -1,10 +1,14 @@ 'use strict'; -import TinyQueue from './tinyqueue.min.js'; +/** + * Minified by jsDelivr using Terser v5.10.0. + * Original file: /npm/tinyqueue@2.0.3/index.js + * + * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files + */ +class TinyQueue{constructor(t=[],h=defaultCompare){if(this.data=t,this.length=this.data.length,this.compare=h,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],h=this.data.pop();return this.length--,this.length>0&&(this.data[0]=h,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:h,compare:s}=this,e=h[t];for(;t>0;){const a=t-1>>1,i=h[a];if(s(e,i)>=0)break;h[t]=i,t=a}h[t]=e}_down(t){const{data:h,compare:s}=this,e=this.length>>1,a=h[t];for(;t=0)break;h[t]=i,t=e}h[t]=a}}function defaultCompare(t,h){return th?1:0} -if (TinyQueue.default) TinyQueue = TinyQueue.default; // temporary webpack fix - -export default function polylabel(polygon, precision, debug) { +function polylabel(polygon, precision, debug) { precision = precision || 0.5; // find the bounding box of the outer ring diff --git a/web/_js/tinyqueue.min.js b/web/_js/tinyqueue.min.js deleted file mode 100644 index eeee284a..00000000 --- a/web/_js/tinyqueue.min.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Minified by jsDelivr using Terser v5.10.0. - * Original file: /npm/tinyqueue@2.0.3/index.js - * - * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files - */ -export default class TinyQueue{constructor(t=[],h=defaultCompare){if(this.data=t,this.length=this.data.length,this.compare=h,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],h=this.data.pop();return this.length--,this.length>0&&(this.data[0]=h,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:h,compare:s}=this,e=h[t];for(;t>0;){const a=t-1>>1,i=h[a];if(s(e,i)>=0)break;h[t]=i,t=a}h[t]=e}_down(t){const{data:h,compare:s}=this,e=this.length>>1,a=h[t];for(;t=0)break;h[t]=i,t=e}h[t]=a}}function defaultCompare(t,h){return th?1:0} -//# sourceMappingURL=/sm/d66cdc801e31ad5c6f6a7e415184d6559e4e641efd692cca125432b4ff9c4b6e.map \ No newline at end of file diff --git a/web/index.html b/web/index.html index 60c37d11..92bdd96d 100644 --- a/web/index.html +++ b/web/index.html @@ -329,7 +329,8 @@

Donation Links

- + +