Template works

This commit is contained in:
SwingTheVine 2025-07-30 07:40:48 -04:00
parent fe62f14357
commit 0c3e4d65f6
7 changed files with 19 additions and 18 deletions

File diff suppressed because one or more lines are too long

View file

@ -35,7 +35,7 @@
<a href="https://github.com/SwingTheVine/Wplace-BlueMarble/blob/main/LICENSE.txt" target="_blank"><img alt="Software License: MPL-2.0" src="https://img.shields.io/badge/Software_License-MPL--2.0-brightgreen?style=flat"></a>
<a href="https://discord.gg/tpeBPy46hf" target="_blank"><img alt="Contact Me" src="https://img.shields.io/badge/Contact_Me-gray?style=flat&logo=Discord&logoColor=white&logoSize=auto&labelColor=cornflowerblue"></a>
<a href="" target="_blank"><img alt="WakaTime" src="https://img.shields.io/badge/Coding_Time-59hrs_0mins-blue?style=flat&logo=wakatime&logoColor=black&logoSize=auto&labelColor=white"></a>
<a href="" target="_blank"><img alt="Total Patches" src="https://img.shields.io/badge/Total_Patches-327-black?style=flat"></a>
<a href="" target="_blank"><img alt="Total Patches" src="https://img.shields.io/badge/Total_Patches-332-black?style=flat"></a>
<a href="" target="_blank"><img alt="Total Lines of Code" src="https://tokei.rs/b1/github/SwingTheVine/Wplace-BlueMarble?category=code"></a>
<a href="" target="_blank"><img alt="Total Comments" src="https://tokei.rs/b1/github/SwingTheVine/Wplace-BlueMarble?category=comments"></a>
<a href="" target="_blank"><img alt="Compression" src="https://img.shields.io/badge/Compression-70.19%25-blue"></a>

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "wplace-bluemarble",
"version": "0.63.53",
"version": "0.63.58",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wplace-bluemarble",
"version": "0.63.53",
"version": "0.63.58",
"devDependencies": {
"esbuild": "^0.25.0",
"terser": "^5.43.1"

View file

@ -1,6 +1,6 @@
{
"name": "wplace-bluemarble",
"version": "0.63.53",
"version": "0.63.58",
"type": "module",
"scripts": {
"build": "node build/build.js",

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name Blue Marble
// @namespace https://github.com/SwingTheVine/
// @version 0.63.53
// @version 0.63.58
// @description A userscript to automate and/or enhance the user experience on Wplace.live. Make sure to comply with the site's Terms of Service, and rules! This script is not affiliated with Wplace.live in any way, use at your own risk. This script is not affiliated with TamperMonkey. The author of this userscript is not responsible for any damages, issues, loss of data, or punishment that may occur as a result of using this script. This script is provided "as is" under the MPL-2.0 license. The "Blue Marble" icon is licensed under CC0 1.0 Universal (CC0 1.0) Public Domain Dedication. The image is owned by NASA.
// @author SwingTheVine
// @license MPL-2.0

View file

@ -110,21 +110,21 @@ export default class ApiManager {
const blobUUID = data['blobID'];
const blobData = data['blobData'];
let templateBlob = blobData; // By default, apply no template
// let templateBlob = blobData; // By default, apply no template
console.log(`templateState: ${this.templateManager.templateState || null}`);
let templateBlob = !!this.templateManager.templateState ? await this.templateManager.drawTemplate(blobData) : blobData;
// Only apply the template if a template is loaded
// Otherwise, draw the template so the next attempted load will not need a re-draw
switch (this.templateManager.templateState) {
case 'file': // Draw the template
console.log(`Attempting to draw template...`);
templateBlob = await this.templateManager.drawTemplate(blobData);
break;
case 'template': // The template is already processed, pass it in
templateBlob = this.templateManager.template;
break;
}
// switch (this.templateManager.templateState) {
// case 'file': // Draw the template
// console.log(`Attempting to draw template...`);
// templateBlob = await this.templateManager.drawTemplate(blobData);
// break;
// case 'template': // The template is already processed, pass it in
// templateBlob = this.templateManager.template;
// break;
// }
window.postMessage({
source: 'blue-marble',

View file

@ -8,6 +8,7 @@ export default class TemplateManager {
*/
constructor() {
this.canvasTemplate = null; // Our canvas
this.canvasTemplateZoomed = null; // The template when zoomed out
this.canvasTemplateID = 'bm-canvas'; // Our canvas ID
this.canvasMainID = 'div#map canvas.maplibregl-canvas'; // The selector for the main canvas
this.template = null; // The template image.