updated slideshow and deconstruct scripts

This commit is contained in:
zsviczian
2023-01-02 16:09:21 +01:00
parent 8d8f7a7866
commit 5c11e5733e
4 changed files with 11 additions and 10 deletions

View File

@@ -67,5 +67,6 @@ setTimeout(async ()=>{
ea.deleteViewElements(els);
ea.clear();
await ea.addImage(bb.topX,bb.topY,file,false);
ea.addElementsToView(false, true, true);
await ea.addElementsToView(false, true, true);
ea.getExcalidrawAPI().history.clear(); //to avoid undo/redo messing up the decomposition
},1000);

View File

@@ -36,8 +36,8 @@ if(!lineEl || !["line","arrow"].contains(lineEl.type)) {
if(app.isMobile) {
ea.viewToggleFullScreen(true);
} else {
await contentEl.requestFullscreen();
await sleep(50);
await contentEl.webkitRequestFullscreen();
await sleep(500);
ea.setViewModeEnabled(true);
}
const deltaWidth = () => contentEl.clientWidth-api.getAppState().width;
@@ -64,7 +64,7 @@ const slideCount = Math.floor(lineEl.points.length/2)-1;
const getNextSlide = (forward) => {
slide = forward
? slide < slideCount ? slide + 1 : 0
: slide <= 0 ? slideCount : slide - 1;
: slide <= 0 ? slideCount : slide - 1;
return {pointA:lineEl.points[slide*2], pointB:lineEl.points[slide*2+1]}
}
@@ -129,7 +129,7 @@ const navigate = async (dir) => {
exitPresentation();
return;
}
if(slideNumberEl) slideNumberEl.innerText = (slide+1).toString();
if(slideNumberEl) slideNumberEl.innerText = `${slide+1}/${slideCount+1}`;
const nextRect = getSlideRect(nextSlide);
await scrollToNextRect(nextRect);
}
@@ -279,4 +279,4 @@ if(!app.isMobile) {
}
//navigate to the first slide on start
setTimeout(()=>navigate("fwd"));
setTimeout(()=>navigate("fwd"));

File diff suppressed because one or more lines are too long

View File

@@ -80,7 +80,7 @@ const getIMG = async (
withTheme: forceTheme ? true : plugin.settings.exportWithTheme,
};
const img = createEl("img");
let style = `max-width:${imgAttributes.fwidth}${imgAttributes.fwidth.match(/\d$/) ? "px":""}; width:100%;`; //removed !important https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/886
let style = `max-width:${imgAttributes.fwidth}${imgAttributes.fwidth.match(/\d$/) ? "px":""}; `; //width:100%;`; //removed !important https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/886
if (imgAttributes.fheight) {
style += `height:${imgAttributes.fheight}px;`;
}
@@ -180,8 +180,8 @@ const getIMG = async (
return null;
}
svg = embedFontsInSVG(svg, plugin);
svg.removeAttribute("width");
svg.removeAttribute("height");
//svg.removeAttribute("width");
//svg.removeAttribute("height");
img.setAttribute("src", svgToBase64(svg.outerHTML));
return img;
};