add option to change the background image grid

This commit is contained in:
raphael 2020-05-22 15:45:11 +02:00
parent 4134c4130a
commit a33973eeb6
7 changed files with 18 additions and 2 deletions

BIN
assets/images/bg_dots.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -31,6 +31,9 @@ frontend:
# draw the background grid to images on download ? (If True, even PNGs are also not transparent anymore) -- boolean # draw the background grid to images on download ? (If True, even PNGs are also not transparent anymore) -- boolean
drawBackgroundGrid: false drawBackgroundGrid: false
# Background Image; Can be "bg_grid.png" or "bg_dots.png" -- string
backgroundGridImage: "bg_grid.png"
# Frontend performance tweaks # Frontend performance tweaks
performance: performance:
# Refresh frequency of the debug / info div (in Hz i.e. /s) -- number # Refresh frequency of the debug / info div (in Hz i.e. /s) -- number

View File

@ -54,6 +54,9 @@
"drawBackgroundGrid": { "drawBackgroundGrid": {
"type": "boolean" "type": "boolean"
}, },
"backgroundGridImage": {
"type": "string"
},
"performance": { "performance": {
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,

View File

@ -140,6 +140,7 @@ function initWhiteboard() {
//Load the whiteboard //Load the whiteboard
whiteboardId: whiteboardId, whiteboardId: whiteboardId,
username: btoa(myUsername), username: btoa(myUsername),
backgroundGridUrl: "./images/" + ConfigService.backgroundGridImage,
sendFunction: function (content) { sendFunction: function (content) {
if (ReadOnlyService.readOnlyActive) return; if (ReadOnlyService.readOnlyActive) return;
//ADD IN LATER THROUGH CONFIG //ADD IN LATER THROUGH CONFIG

View File

@ -48,6 +48,14 @@ class ConfigService {
return this.#drawBackgroundGrid; return this.#drawBackgroundGrid;
} }
/**
* @type {string}
*/
#backgroundGridImage = "bg_grid.png";
get backgroundGridImage() {
return this.#backgroundGridImage;
}
/** /**
* @type {{minDistDelta: number, minTimeDelta: number}} * @type {{minDistDelta: number, minTimeDelta: number}}
*/ */
@ -78,6 +86,7 @@ class ConfigService {
showSmallestScreenIndicator, showSmallestScreenIndicator,
imageDownloadFormat, imageDownloadFormat,
drawBackgroundGrid, drawBackgroundGrid,
backgroundGridImage,
performance, performance,
} = common; } = common;
@ -85,6 +94,7 @@ class ConfigService {
this.#showSmallestScreenIndicator = showSmallestScreenIndicator; this.#showSmallestScreenIndicator = showSmallestScreenIndicator;
this.#imageDownloadFormat = imageDownloadFormat; this.#imageDownloadFormat = imageDownloadFormat;
this.#drawBackgroundGrid = drawBackgroundGrid; this.#drawBackgroundGrid = drawBackgroundGrid;
this.#backgroundGridImage = backgroundGridImage;
this.#refreshInfoInterval = 1000 / performance.refreshInfoFreq; this.#refreshInfoInterval = 1000 / performance.refreshInfoFreq;
console.log("Whiteboard config from server:", configFromServer, "parsed:", this); console.log("Whiteboard config from server:", configFromServer, "parsed:", this);

View File

@ -4,7 +4,6 @@ import ReadOnlyService from "./services/ReadOnlyService";
import InfoService from "./services/InfoService"; import InfoService from "./services/InfoService";
import ThrottlingService from "./services/ThrottlingService"; import ThrottlingService from "./services/ThrottlingService";
import ConfigService from "./services/ConfigService"; import ConfigService from "./services/ConfigService";
import { fillTextMultiLine } from "./utils";
import html2canvas from "html2canvas"; import html2canvas from "html2canvas";
const RAD_TO_DEG = 180.0 / Math.PI; const RAD_TO_DEG = 180.0 / Math.PI;
@ -51,7 +50,7 @@ const whiteboard = {
whiteboardId: "0", whiteboardId: "0",
username: "unknown", username: "unknown",
sendFunction: null, sendFunction: null,
backgroundGridUrl: "./images/KtEBa2.png", backgroundGridUrl: "./images/gb_grid.png",
}, },
lastPointerSentTime: 0, lastPointerSentTime: 0,
/** /**