From 9f5c5b2f30c0b965d57c6a4f61e546da3bee6acf Mon Sep 17 00:00:00 2001 From: Florent Chehab Date: Mon, 20 Apr 2020 11:18:52 +0200 Subject: [PATCH] fix(fa icons): should render everywhere * setup is not perfect but should do the trick for now * Suggestion: add all the icon the dom and reuse them so that we don't have to do dom.i2svg(); everytime --- src/js/main.js | 3 +++ src/js/whiteboard.js | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/js/main.js b/src/js/main.js index 8d676fc..02e34ec 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -3,6 +3,7 @@ import io from 'socket.io-client'; import whiteboard from "./whiteboard"; import keybinds from "./keybinds"; import Picker from "vanilla-picker"; +import { dom } from "@fortawesome/fontawesome-svg-core"; function main(){ @@ -382,6 +383,8 @@ function main(){ okBtnText: "cancel", headercolor: "#0082c9" }) + // render newly added icons + dom.i2svg(); }); // upload json containing steps diff --git a/src/js/whiteboard.js b/src/js/whiteboard.js index 9f608bb..4e7a3ee 100644 --- a/src/js/whiteboard.js +++ b/src/js/whiteboard.js @@ -1,3 +1,5 @@ +import { dom } from "@fortawesome/fontawesome-svg-core"; + const whiteboard = { canvas: null, ctx: null, @@ -69,6 +71,10 @@ const whiteboard = { .append(_this.cursorContainer) .append(_this.textContainer) .append(_this.mouseOverlay); + + // render newly added icons + dom.i2svg() + this.canvas = $("#whiteboardCanvas")[0]; this.canvas.height = $(window).height(); this.canvas.width = $(window).width(); @@ -596,6 +602,9 @@ const whiteboard = { _this.mouseOverlay.append(imgDiv); imgDiv.draggable(); imgDiv.resizable(); + + // render newly added icons + dom.i2svg(); }, drawImgToBackground(url, width, height, left, top) { this.imgContainer.append('') @@ -654,6 +663,9 @@ const whiteboard = { if (this.tool === "text") { textBox.addClass("active"); } + + // render newly added icons + dom.i2svg(); }, setTextboxText(txId, text) { $("#" + txId).find(".textContent").html(decodeURIComponent(escape(atob(text)))); //Set decoded base64 as html