diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 00000000..f91e3437
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,5 @@
+# These are supported funding model platforms
+
+patreon: placeAtlas
+ko_fi: placeatlas
+custom: ['https://paypal.me/placeAtlas/5']
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9c49f986..d9b5fa85 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -32,4 +32,4 @@ To contribute to the map, we require a certain format for artwork region and lab
## Cleaning Contributions
-If you spot a duplicate, please PR against `/cleanup`. To help find duplicates, run the code locally, changing line 92 of `main.js` to `overlap`.
\ No newline at end of file
+If you spot a duplicate, please PR against `/cleanup`. To help find duplicates, append `?mode=overlap` to the url: [`https://place-atlas.stefanocoding.me?mode=overlap`](https://place-atlas.stefanocoding.me?mode=overlap).
\ No newline at end of file
diff --git a/README.md b/README.md
index b818bfe4..31cea496 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,13 @@
+[![Entry count](https://img.shields.io/badge/dynamic/json?color=blue&label=count&query=%24.length&url=https%3A%2F%2Fgithub.com%2FplaceAtlas%2Fatlas%2Fblob%2Fmaster%2Fweb%2Fatlas.json%3Fraw%3Dtrue)](https://place-atlas.stefanocoding.me/)
+![Commit activity](https://img.shields.io/github/commit-activity/w/placeAtlas/atlas)
+[![Netlify](https://img.shields.io/netlify/1e7291ce-0680-45ed-9843-47a32a992bbb?logo=netlify&logoColor=white)](https://app.netlify.com/sites/place-atlas/deploys)
+[![License](https://img.shields.io/github/license/placeAtlas/atlas)](https://github.com/placeAtlas/atlas/blob/master/LICENSE)
+[![Discord](https://img.shields.io/discord/960791635342524496?color=%235865F2&logo=discord&logoColor=white)](https://discord.gg/pJkm23b2nA)
+[![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/placeAtlas2?color=%23FF4500&label=r%2FplaceAtlas2&logo=reddit&logoColor=white)](https://www.reddit.com/r/placeAtlas2/)
+[![Website](https://img.shields.io/static/v1?label=website&message=place-atlas.stefanocoding.me&color=blue)](https://place-atlas.stefanocoding.me/)
+
# The 2022 Place Atlas
+
The /r/place Atlas is a project aiming to catalog all the artworks created during Reddit's 2022 /r/place event.
This project was created by Roland Rytz and is licensed under the GNU Affero General Public License v3.0.
@@ -12,7 +21,7 @@ If you don't know GitHub and wanted to submit new entries or request changes to
### Map Contributions
-
WE ONLY ACCEPT NEW CONTRIBUTIONS ON REDDIT
+**WE ONLY ACCEPT NEW CONTRIBUTIONS ON REDDIT!**
To contribute to the map, we require a certain format for artwork region and labels. This can be generated on the [contributing page](https://place-atlas.stefanocoding.me/index.html?mode=draw) on the website.
@@ -36,8 +45,8 @@ To contribute to the map, we require a certain format for artwork region and lab
1. Create a fork of our repo.
2. Enter your data into the `web/atlas.json` file, with the correct format and ID number.
-3. Create a Pull Request against the `/cleanup` branch.
+3. Create a Pull Request against the `cleanup` branch.
### Cleaning Contributions
-If you spot a duplicate, please PR against `/cleanup`. To help find duplicates, run the code locally, changing line 92 of `main.js` to `overlap`.
+If you spot a duplicate, please PR against the `cleanup` branch. To help find duplicates, append `?mode=overlap` to the url: [`https://place-atlas.stefanocoding.me?mode=overlap`](https://place-atlas.stefanocoding.me?mode=overlap).
diff --git a/tools/less-md-links.py b/tools/less-md-links.py
index 8dfb86a8..d9178c83 100644
--- a/tools/less-md-links.py
+++ b/tools/less-md-links.py
@@ -5,19 +5,21 @@
def go(path):
+ print(f"Fixing {path}...")
+
with open(path, "r+", encoding='UTF-8') as f1:
contents = f1.read()
- for match in pattern.finditer(contents):
- if match.group(1) == match.group(2):
- contents = contents.replace(match.group(0), match.group(2), 1)
-
- for match in pattern.finditer(contents):
- if match.group(1) == match.group(2):
- contents = contents.replace(match.group(0), match.group(2), 1)
+ for i in range(2):
+ for match in pattern.finditer(contents):
+ if match.group(1) == match.group(2):
+ contents = contents.replace(match.group(0), match.group(2), 1)
+ print(f"Stage {i+1} completed.")
with open(path, "w", encoding='UTF-8') as f2:
f2.write(contents)
+ print("Writing completed. All done.")
+
go("../web/atlas.json")
-go("../web/atlas-before-ids-migration.json")
\ No newline at end of file
+go("../web/atlas-before-ids-migration.json")
\ No newline at end of file
diff --git a/tools/misc-formats.py b/tools/misc-formats.py
new file mode 100644
index 00000000..fc654d1f
--- /dev/null
+++ b/tools/misc-formats.py
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+import re
+
+def go(path):
+
+ print(f"Fixing {path}...")
+
+ with open(path, "r+", encoding='UTF-8') as f1:
+ contents = f1.read()
+
+ contents = re.sub(r'": "(\s+)', r'": "', contents)
+ contents = re.sub(r'(\s+)"(, |,|\})', r'"\2', contents)
+ print("Leading and trailing spaces removed.")
+
+ contents = re.sub(r' {2,}', r' ', contents)
+ print("Double spaces removed.")
+
+ contents = re.sub(r',{2,}', r',', contents)
+ print("Double commas removed.")
+
+ contents = re.sub(r'"n/a"', '""', contents)
+ contents = re.sub(r'"N/A"', '""', contents)
+ contents = re.sub(r'"-"', '""', contents)
+ contents = re.sub(r'"none"', '""', contents)
+ contents = re.sub(r'"null"', '""', contents)
+ print("Psuedo-empty strings converted into empty strings.")
+
+ contents = re.sub(r'R\/', 'r/', contents)
+ print("Capitalization of r/ has been fixed.")
+
+ with open(path, "w", encoding='UTF-8') as f2:
+ f2.write(contents)
+ print("Writing completed. All done.")
+
+go("../web/atlas.json")
+go("../web/atlas-before-ids-migration.json")
\ No newline at end of file
diff --git a/tools/redditcrawl.py b/tools/redditcrawl.py
index 6be23e56..1f7b2f9b 100755
--- a/tools/redditcrawl.py
+++ b/tools/redditcrawl.py
@@ -3,6 +3,7 @@
import json
import time
import re
+import os
outfile = open('temp_atlas.json', 'w', encoding='utf-8')
failfile = open('manual_atlas.json', 'w', encoding='utf-8')
@@ -15,6 +16,7 @@
failcount = 0
successcount = 0
+totalcount = 0
jsonfile = open("../web/atlas.json", "r", encoding='utf-8')
existing = json.load(jsonfile)
@@ -24,7 +26,9 @@
for item in existing:
existing_ids.append(item['id'])
-
+total_all_flairs = 0
+duplicate_count = 0
+outfile.write("[\n")
for submission in reddit.subreddit('placeAtlas2').new(limit=2000):
"""
Auth setup
@@ -46,10 +50,14 @@
4. Pull Request
"""
- #print(dir(submission))
+ total_all_flairs += 1
if (submission.id in existing_ids):
print("Found first duplicate!")
- break
+ duplicate_count += 1
+ if (duplicate_count > 10):
+ break
+ else:
+ continue
if(submission.link_flair_text == "New Entry"):
text = submission.selftext
#Old backslash filter:
@@ -58,7 +66,7 @@
# Two escape it again in the regex parser, so \\\\ is \
# Then anything but " or n is replaced with the first capture group (anything but " or n)
# Test in repl: re.sub("\\\\([^\"n])", "\\1", "\\t < removed slash, t stays and > stays \\n \\\"")
- re.sub("\\\\([^\"n])", "\\1", text)
+ text = re.sub("\\\\([^\"n])", "\\1", text)
try:
text = text.replace("\"id\": 0,", "\"id\": 0,\n\t\t\"submitted_by\": \""+submission.author.name+"\",")
except AttributeError:
@@ -72,11 +80,18 @@
lines[i] = line.replace("\"id\": 0", "\"id\": "+"\""+str(submission.id)+"\"")
text = "\n".join(lines)
try:
- outfile.write(json.dumps(json.loads(text))+",\n")
+ outfile.write(json.dumps(json.loads(text))+" ,\n")
+ successcount += 1
except json.JSONDecodeError:
failfile.write(text+",\n")
failcount += 1
print("written "+submission.id+" submitted "+str(round(time.time()-submission.created_utc))+" seconds ago")
- successcount += 1
+ totalcount += 1
-print(f"\n\nSuccess: {successcount}\nFail: {failcount}\nPlease check manual_atlas.txt for failed entries to manually resolve.")
+# Remove ,\n
+outfile.seek(outfile.tell()-4, os.SEEK_SET)
+outfile.truncate()
+
+outfile.write("\n]")
+
+print(f"\n\nTotal all flairs:{total_all_flairs}\nSuccess: {successcount}/{totalcount}\nFail: {failcount}/{totalcount}\nPlease check manual_atlas.txt for failed entries to manually resolve.")
diff --git a/tools/subreddit-format.py b/tools/subreddit-format.py
index 41ca2744..1af9052d 100644
--- a/tools/subreddit-format.py
+++ b/tools/subreddit-format.py
@@ -1,38 +1,65 @@
#!/usr/bin/python
import re
-pattern1 = re.compile(r'"subreddit": "\/r\/(.+?)/?"')
-pattern2 = re.compile(r'"subreddit": "r\/(.+?)/?"')
-pattern3 = re.compile(r'"subreddit": "\/?r(?!\/)(.+?)/?"')
-pattern4 = re.compile(r'"subreddit": "(?:(?:https:\/\/)?www.)?reddit.com\/r\/(.+?)(/[^"]*)*"')
-pattern5 = re.compile(r'"subreddit": "\[(?:(?:https:\/\/)?www.)?reddit.com\/r\/(.+?)(/[^"]*)*\]\((?:(?:https:\/\/)?www.)?reddit.com\/r\/(.+?)(/[^"]*)*\)"')
+
+patternParent = re.compile(r'"subreddit": ?"(?!")(.+?)"')
+patternCommatization = re.compile(r',* +')
+pattern1 = re.compile(r'\/?[rR]\/([A-Za-z0-9][A-Za-z0-9_]{1,20})(?:\/$)?')
+pattern2 = re.compile(r'^\/?[rR](?!\/)([A-Za-z0-9][A-Za-z0-9_]{1,20})(?:\/$)?')
+pattern3 = re.compile(r'(?:(?:https?:\/\/)?(?:(?:www|old|new|np)\.)?)?reddit\.com\/r\/([A-Za-z0-9][A-Za-z0-9_]{1,20})(?:\/[^" ]*)*')
+pattern4 = re.compile(r'\[[A-Za-z0-9][A-Za-z0-9_]{1,20}\]\((?:(?:https:\/\/)?(?:(?:www|old|new|np)\.)?)?reddit\.com\/r\/([A-Za-z0-9][A-Za-z0-9_]{1,20})(?:\/[^" ]*)*\)')
+# pattern5 = re.compile(r'(?:https?:\/\/)?(?!^www\.)(.+)\.reddit\.com(?:\/[^"]*)*')
+# pattern6 = re.compile(r'\[(?:https?:\/\/)?(?!^www\.)(.+)\.reddit\.com(?:\/[^"]*)*\]\((?:https:\/\/)?(?!^www\.)(.+)\.reddit\.com(?:\/[^"]*)*\)"')
+"""
+Examples:
+1. - /r/place
+ - r/place
+2. /rplace
+3. - https://www.reddit.com/r/place
+ - www.reddit.com/r/place
+ - reddit.com/r/place
+4. - [https://www.reddit.com/r/place](https://www.reddit.com/r/place)
+ - [www.reddit.com/r/place](www.reddit.com/r/place)
+ - [reddit.com/r/place](reddit.com/r/place)
+UNUSED AND FAULTY
+5. - https://place.reddit.com
+ - place.reddit.com
+6. - [https://place.reddit.com](https://place.reddit.com)
+ - [place.reddit.com](https://place.reddit.com)
+"""
+
+def replaceStage1(contents: str):
+ contents = re.sub(patternCommatization, ', ', contents)
+
+ # r/... to /r/.. (change if not needed)
+ template = r"/r/\1"
+ contents = re.sub(pattern4, template, contents)
+ contents = re.sub(pattern3, template, contents)
+ contents = re.sub(pattern1, template, contents)
+ contents = re.sub(pattern2, template, contents)
+ return contents
def go(path):
+ print(f"Fixing {path}...")
+
with open(path, "r+", encoding='UTF-8') as f1:
contents = f1.read()
- for match in pattern5.finditer(contents):
- contents = contents.replace(match.group(0), '"subreddit": "r/' + match.group(2) + '"', 1)
-
- for match in pattern4.finditer(contents):
- contents = contents.replace(match.group(0), '"subreddit": "r/' + match.group(1) + '"', 1)
-
- for match in pattern1.finditer(contents):
- contents = contents.replace(match.group(0), '"subreddit": "r/' + match.group(1) + '"', 1)
-
- for match in pattern2.finditer(contents):
- contents = contents.replace(match.group(0), '"subreddit": "r/' + match.group(1) + '"', 1)
-
- for match in pattern3.finditer(contents):
- contents = contents.replace(match.group(0), '"subreddit": "r/' + match.group(1) + '"', 1)
-
- # # r/... to /r/.. (comment if not needed)
- for match in pattern2.finditer(contents):
- contents = contents.replace(match.group(0), '"subreddit": "/r/' + match.group(1) + '"', 1)
+ # Convert to r/... format first.
+ for matchParent in patternParent.finditer(contents):
+ subredditLink = matchParent.group(1)
+ subredditLink = replaceStage1(subredditLink)
+ if not subredditLink:
+ continue
+ if path == "../web/atlas-before-ids-migration.json":
+ contents = contents.replace(matchParent.group(0), '"subreddit":"' + subredditLink + '"', 1)
+ else:
+ contents = contents.replace(matchParent.group(0), '"subreddit": "' + subredditLink + '"', 1)
with open(path, "w", encoding='UTF-8') as f2:
f2.write(contents)
+ print("Writing completed. All done.")
go("../web/atlas.json")
go("../web/atlas-before-ids-migration.json")
\ No newline at end of file
diff --git a/tools/validate_json.py b/tools/validate_json.py
index 64e5b7c8..aa8ba5a2 100644
--- a/tools/validate_json.py
+++ b/tools/validate_json.py
@@ -9,6 +9,6 @@
if (len(sys.argv) > 1):
path = sys.argv[1]
-json.load(open(path))
+json.load(open(path, "r", encoding='utf-8'))
print("JSON is valid")
\ No newline at end of file
diff --git a/web/_css/style.css b/web/_css/style.css
index 9c6eefde..5e4b73fb 100644
--- a/web/_css/style.css
+++ b/web/_css/style.css
@@ -78,6 +78,7 @@ a:hover {
}
button,
+#exportDirectPost,
#aboutBackButton,
#drawBackButton {
background-image: linear-gradient(to bottom, #888, #666);
@@ -103,6 +104,7 @@ button:disabled:hover {
}
button:hover,
+#exportDirectPost:hover,
#aboutBackButton:hover,
#drawBackButton:hover {
background-image: linear-gradient(to bottom, #999, #777);
diff --git a/web/_img/place-indexed-final-place.png b/web/_img/place-indexed-final-place.png
new file mode 100644
index 00000000..95881e91
Binary files /dev/null and b/web/_img/place-indexed-final-place.png differ
diff --git a/web/_img/place-indexed.png b/web/_img/place-indexed.png
index bbeddaea..c11ff2e2 100644
Binary files a/web/_img/place-indexed.png and b/web/_img/place-indexed.png differ
diff --git a/web/_js/atlas.js b/web/_js/atlas.js
index 72b75f33..dc60e0de 100644
--- a/web/_js/atlas.js
+++ b/web/_js/atlas.js
@@ -29,86 +29,39 @@ window.addEventListener("error", function (e) {
document.getElementById("loadingContent").innerHTML = errorMessage;
});
-function pointIsInPolygon (point, polygon) {
- // ray-casting algorithm based on
- // http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
+function getPositionOfEntry(entry){
+ let startX = 2000, startY = 2000;
+ for(let [x, y] of entry.path){
+ startX = Math.min(x, startX);
+ startY = Math.min(y, startY)
+ }
+ if(startX === 2000 || startY === 2000) return null;
+ return [parseInt(startX), parseInt(startY)];
+}
+
+const areaMap = new Map();
+
+// Modified from https://stackoverflow.com/a/33670691
+function calcPolygonArea(vertices) {
+ var hit = areaMap.get(vertices);
+ if (hit != null) {
+ return hit;
+ }
+
+ var total = 0;
+
+ for (var i = 0, l = vertices.length; i < l; i++) {
+ var addX = vertices[i][0];
+ var addY = vertices[i == vertices.length - 1 ? 0 : i + 1][1];
+ var subX = vertices[i == vertices.length - 1 ? 0 : i + 1][0];
+ var subY = vertices[i][1];
+
+ total += (addX * addY * 0.5);
+ total -= (subX * subY * 0.5);
+ }
+
+ var area = Math.floor(Math.abs(total));
+ areaMap.set(vertices, area);
- var x = point[0], y = point[1];
-
- var inside = false;
- for (var i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
- var xi = polygon[i][0], yi = polygon[i][1];
- var xj = polygon[j][0], yj = polygon[j][1];
-
- var intersect = ((yi > y) != (yj > y))
- && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
- if (intersect) inside = !inside;
- }
- return inside;
-};
-
-//console.log("There are "+atlas.length+" entries in the Atlas.");
-
-/*
-atlas.sort(function(a, b) {
- if (a.id < b.id) {
- return -1;
- }
- if (a.id > b.id) {
- return 1;
- }
- // a must be equal to b
- return 0;
-});
-
-for(var i = 0; i < atlas.length; i++) {
- if(atlas[i-1]){
- if(atlas[i-1].id == atlas[i].id) {
- console.log(atlas[i-1].id + ": "+ atlas[i-1].name);
- console.log(atlas[i ].id + ": "+ atlas[i ].name);
- }
- }
-}
-
-console.log("biggest id: "+atlas[atlas.length-1].id + ", " + atlas[atlas.length-1].name);
-*/
-
-/*
-for(var i = 0; i < atlas.length; i++) {
- if(typeof atlas[i].website == "undefined") {
- console.log(atlas[i].name);
- } else if(atlas[i].website.trim() != "") {
- if(atlas[i].website.trim().substring(0, 4) != "http") {
- console.log(atlas[i].name + ": " + atlas[i].website);
- }
- }
-}
-*/
-
-// sort by center.y, so that lines will overlap less
-
-/*
-
-// Populate with test data
-
-for(var i = 0; i < 10000; i++) {
- var x = ~~(Math.random() * 1000)+0.5;
- var y = ~~(Math.random() * 1000)+0.5;
- var w = ~~(Math.random()*100);
- var h = ~~(Math.random()*100);
- atlas.push( {
- "id": 5,
- "name": "test"+(i+3),
- "website": "",
- "subreddit": "",
- "center": [0, 0],
- "path":[
- [x, y],
- [x+w, y],
- [x+w, y+h],
- [x, y+h]
- ]
- });
-}
-
-*/
+ return area;
+}
\ No newline at end of file
diff --git a/web/_js/infoblock.js b/web/_js/infoblock.js
index edbaccb1..759e0e32 100644
--- a/web/_js/infoblock.js
+++ b/web/_js/infoblock.js
@@ -1,4 +1,16 @@
function createInfoBlock(entry) {
+ function createInfoParagraph(name, value){
+ let entryParagraphPositionElement = document.createElement("p");
+ let nameElement = document.createElement("span");
+ nameElement.style.fontWeight = "bold";
+ nameElement.innerText = name;
+ let valueElement = document.createElement("span");
+ valueElement.innerText = value;
+ entryParagraphPositionElement.appendChild(nameElement);
+ entryParagraphPositionElement.appendChild(valueElement);
+ return entryParagraphPositionElement;
+ }
+
var element = document.createElement("div");
element.className = "object";
@@ -15,6 +27,15 @@ function createInfoBlock(entry) {
descElement.innerText = entry.description;
element.appendChild(descElement);
}
+
+ let [x, y] = entry.center;
+ element.appendChild(createInfoParagraph("Position: ", `${Math.floor(x)}x${Math.floor(y)}`));
+
+ if(entry.path){
+ let area = calcPolygonArea(entry.path);
+ element.appendChild(createInfoParagraph("Area: ", `${area} pixels`));
+ }
+
if (entry.website) {
let websiteLinkElement = document.createElement("a");
websiteLinkElement.target = "_blank";
@@ -39,9 +60,8 @@ function createInfoBlock(entry) {
element.appendChild(subredditLinkElement);
}
}
- let idElement = document.createElement("p");
+ let idElement = createInfoParagraph("ID: ", entry.id);
idElement.style.fontFamily = "Dejavu Sans Mono, sans, Sans-Serif;";
- idElement.innerText = "id: " + entry.id;
element.appendChild(idElement);
return element;
diff --git a/web/_js/main.js b/web/_js/main.js
index f14b7fee..15c4f628 100644
--- a/web/_js/main.js
+++ b/web/_js/main.js
@@ -47,7 +47,7 @@ var lastPosition = [0, 0];
var viewportSize = [0, 0];
document.getElementById("donateButton").addEventListener("click", function(e){
- document.getElementById("bitcoinQR").src = "./_img/bitcoinQR.png?from=index";
+// document.getElementById("bitcoinQR").src = "./_img/bitcoinQR.png?from=index";
document.getElementById("donateOverlay").style.display = "flex";
});
@@ -78,7 +78,8 @@ var atlas = null;
init();
async function init(){
-
+ // For Reviewing Reddit Changes
+ //let resp = await fetch("../tools/temp_atlas.json");
let resp = await fetch("./atlas.json");
atlas = await resp.json();
atlas.sort(function (a, b) {
@@ -135,6 +136,33 @@ async function init(){
initOverlap();
}
}
+
+ function changeOverlapMode(){
+ console.log(mode)
+ switch(mode){
+ case "overlap":
+ window.location.href = "?mode=explore"
+ break;
+ case "explore":
+ window.location.href = "?"
+ break;
+ default:
+ window.location.href = "?mode=overlap"
+ break;
+ }
+
+ return false;
+ }
+
+ const modeMap = {
+ "view": "Overlap",
+ "overlap": "Explore",
+ "explore": "Atlas"
+ }
+
+ const toggleMode = document.getElementById("toggleMode");
+ toggleMode.onclick = changeOverlapMode;
+ toggleMode.innerHTML = modeMap[mode];
document.getElementById("loading").style.display = "none";
@@ -243,14 +271,23 @@ async function init(){
initialPinchZoom = zoom;
lastPosition = [x, y];
-
- if(e.deltaY > 0){
- zoom = zoom / 2;
-
- } else if(e.deltaY < 0){
-
- zoom = zoom * 2;
+ // Check if we are zooming by pixels
+ // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaMode
+ if (e.deltaMode === 0) {
+ // Scale the pixel delta by the current zoom factor
+ // We want to zoom faster when closer, and slower when further
+ // This creates a smoother experience
+ zoom -= e.deltaY * (0.001 * zoom);
+ } else {
+ if(e.deltaY > 0){
+
+ zoom = zoom / 2;
+
+ } else if(e.deltaY < 0){
+
+ zoom = zoom * 2;
+ }
}
zoom = Math.max(minZoom, Math.min(maxZoom, zoom));
diff --git a/web/_js/stats.js b/web/_js/stats.js
index b75bafcb..2a88e87f 100644
--- a/web/_js/stats.js
+++ b/web/_js/stats.js
@@ -21,13 +21,6 @@ for(var q = 0; q < atlas.length; q++){
area = Math.abs(area/2);
- if(atlas[q].name == "Companion Cube"){
- var w = atlas[q].path[1][0] - atlas[q].path[0][0];
- var h = atlas[q].path[2][1] - atlas[q].path[1][1];
- console.log(w, h, w*h);
- console.log(area, Math.sqrt(area));
- }
-
areasSum += area;
areas.push(area);
diff --git a/web/_js/view.js b/web/_js/view.js
index 51c107e0..91344f2c 100644
--- a/web/_js/view.js
+++ b/web/_js/view.js
@@ -273,12 +273,12 @@ function initView(){
//var id = parseInt(window.location.hash.substring(3));
- var entry = atlas.filter(function(e){
+ var entries = atlas.filter(function(e){
return e.id === id;
});
- if (entry.length === 1){
- entry = entry[0];
+ if (entries.length === 1){
+ let entry = entries[0];
document.title = entry.name + " on the 2022 /r/place Atlas";
@@ -345,7 +345,9 @@ function initView(){
}
if(changed){
- hovered = newHovered;
+ hovered = newHovered.sort(function(a, b){
+ return calcPolygonArea(a.path) - calcPolygonArea(b.path);
+ });
objectsContainer.innerHTML = "";
@@ -449,6 +451,11 @@ function initView(){
return 0;
}
break;
+ case "area":
+ sortFunction = function(a, b){
+ return calcPolygonArea(b.path) - calcPolygonArea(a.path);
+ }
+ break;
case "relevant":
sortFunction = function(a, b){
if(a.name.toLowerCase().indexOf(filter) !== -1 && b.name.toLowerCase().indexOf(filter) !== -1){
@@ -532,7 +539,6 @@ function initView(){
applyView();
}
if(document.documentElement.clientWidth < 500){
-
objectsContainer.innerHTML = "";
entriesListShown = false;
@@ -591,7 +597,7 @@ function initView(){
}
}
- function render(){
+ async function render(){
context.clearRect(0, 0, canvas.width, canvas.height);
@@ -636,6 +642,29 @@ function initView(){
context.globalCompositeOperation = "source-out";
context.drawImage(backgroundCanvas, 0, 0);
+ if(hovered.length === 1 && hovered[0].path.length && hovered[0].overrideImage){
+ let undisputableHovered = hovered[0];
+ // Find the left-topmost point of all the paths
+ let entryPosition = getPositionOfEntry(undisputableHovered);
+ if(entryPosition){
+ const [startX, startY] = entryPosition;
+ let overrideImage = new Image();
+ const loadingPromise = new Promise((res, rej) => {
+ overrideImage.onerror = rej;
+ overrideImage.onload = res;
+ });
+ overrideImage.src = "imageOverrides/" + undisputableHovered.overrideImage;
+ try{
+ await loadingPromise;
+ context.globalCompositeOperation = "source-over";
+ context.drawImage(overrideImage, startX, startY);
+ }catch(ex){
+ console.log("Cannot override image.");
+ console.log(ex);
+ }
+ }
+ }
+
for(var i = 0; i < hovered.length; i++){
var path = hovered[i].path;
diff --git a/web/about.html b/web/about.html
index 23e97adc..d36a46c5 100644
--- a/web/about.html
+++ b/web/about.html
@@ -34,7 +34,7 @@
-
+
Maintaining and updating the website takes work, but I enjoy doing it for free and giving this to people. But if you would like to support me, or the people who helped me with contributions to this project. You're free to support us though Paypal. (I don't have bitcoin)
To maintain the same tradition, I will also be offering stickers to anyone donating more then 20$ (Due to the size increase). But, you're not forced to do anything! This only shows appreciation to us and the people who've worked on this project
Roland Rytz worked on the Atlas full-time (and more!) for over two weeks during the 2017 r/place event.
-
If you'd like to support Roland, you can do so by PayPal or via Bitcoin.
+
If you'd like to support Roland, you can do so by PayPal.
If you donate more than 10(€/$/CHF/mBTC), He'll (hopefully) send you a nice sticker of the Place canvas! (2017 one)
-
If you donate by Bitcoin and want a 2017 sticker, please send him a message with your Bitcoin address before you make the transaction!
+
How to contribute
The /r/Place Atlas project relies on user contributions.
To contribute a label for an artwork, please read this post on reddit to learn how to submit a new entry.
-
Alternatively, contributions can be made directly on GitHub.
+
Alternatively, contributions can be made directly on GitHub.
The /r/placeAtlas2 subreddit is also the place to submit all bug reports, feature requests or questions.
@@ -103,785 +93,12 @@
r/placeAtlas2 (Current) Contributors and Maintainers
The 2022 Atlas would not have been possible without the help of our reddit contributors. This section will be updated with all of the contributor's usernames.
Thank you to everyone who submitted new entries, amended existing ones, reported bugs and just supported the project in general.
-
r/placeAtlas Contributors
-
The original Atlas project would not have been possible without the help of the following 775 reddit users.
-
Thank you to everyone who submitted new entries, amended existing ones, reported bugs and just supported the project in general.