File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed
Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 11# PDF Editor
22
3- No install. No server. ¯\_ (ツ)\_ /¯ https://pdf-editor.now.sh
3+ No install. No server. ¯\\\ _ (ツ)\_ /¯ https://pdf-editor.now.sh
44
55## How to use pdf-editor?
66
Original file line number Diff line number Diff line change 55 let canvas;
66 let width;
77 let height;
8- let clientWidth = width;
9- $: if (clientWidth && width) {
10- console .log (clientWidth, width);
8+ let clientWidth;
9+ let mounted;
10+ $: if (mounted) {
11+ console .log (" Container size changed:" , clientWidth);
12+ console .log (" Canvas size:" , canvas .clientWidth );
1113 dispatch (" measure" , {
12- scale: clientWidth / width
14+ scale: canvas . clientWidth / width
1315 });
1416 }
1517 async function render () {
1820 const viewport = _page .getViewport ({ scale: 1 });
1921 width = viewport .width ;
2022 height = viewport .height ;
21- _page .render ({
23+ await _page .render ({
2224 canvasContext: context,
2325 viewport: viewport
26+ }).promise ;
27+ mounted = true ;
28+ console .log (" First measure canvas size:" , canvas .clientWidth );
29+ dispatch (" measure" , {
30+ scale: canvas .clientWidth / width
2431 });
25- setTimeout (() => {
26- console .log (canvas .clientWidth );
27- }, 1000 );
2832 }
2933 onMount (render);
3034 </script >
You can’t perform that action at this time.
0 commit comments