Client: Branding: add offset for editor logo

This commit is contained in:
Viktor Fomin 2024-07-22 14:38:58 +03:00
parent 367f583e7d
commit 4c68b330db
2 changed files with 10 additions and 2 deletions

View File

@ -179,6 +179,7 @@ const WhiteLabel = (props) => {
options.fontSize,
isDocsEditorName ? "#fff" : "#000",
options.alignCenter,
options.isEditor,
);
const logoDark = generateLogo(
options.width,
@ -187,6 +188,7 @@ const WhiteLabel = (props) => {
options.fontSize,
"#fff",
options.alignCenter,
options.isEditor,
);
newLogos[i].path.light = logoLight;
newLogos[i].path.dark = logoDark;

View File

@ -34,14 +34,16 @@ export const generateLogo = (
text,
fontSize = 18,
fontColor = "#000",
alignCenter,
alignCenter = false,
isEditor = false,
) => {
const canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
console.log("isEditor", isEditor);
const ctx = canvas.getContext("2d");
const x = alignCenter ? width / 2 : 0;
const x = alignCenter ? width / 2 : isEditor ? 10 : 0;
const y = (height - fontSize) / 2;
ctx.fillStyle = "transparent";
ctx.clearRect(0, 0, width, height);
@ -87,6 +89,8 @@ export const getLogoOptions = (index, text, width, height) => {
text,
width,
height,
alignCenter: false,
isEditor: true,
};
case 4:
return {
@ -94,6 +98,8 @@ export const getLogoOptions = (index, text, width, height) => {
text,
width,
height,
alignCenter: false,
isEditor: true,
};
case 5:
return {