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
This commit is contained in:
Florent Chehab 2020-04-20 11:18:52 +02:00
parent 0ef46fea2f
commit 9f5c5b2f30
No known key found for this signature in database
GPG Key ID: 9A0CE018889EA246
2 changed files with 15 additions and 0 deletions

View File

@ -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

View File

@ -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('<img crossorigin="anonymous" style="width:' + width + 'px; height:' + height + 'px; position:absolute; top:' + top + 'px; left:' + left + 'px;" src="' + url + '">')
@ -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