Skip to content

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
urdenko committed May 14, 2020
1 parent 4849ff3 commit 8a6ace6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dev/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
top: -20000;
left: 40000;
float: left;
display: none;
display: grid;
visibility: hidden;
opacity: 0;
}
Expand Down
1 change: 0 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
height: 100vh;
align-items: center;
justify-content: center;
z-index: 2147483647;
background-color: white;
visibility: hidden; /* appear only when own print event happened */
}
Expand Down
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ export class WantedPrintForm extends HTMLElement implements PrintWantedForm {

private makeImageFit(): void {
const page = this.componentShadowRoot.getElementById('page');

if (!page?.offsetHeight) {
throw new Error(
'It looks like the <wanted-print-form> element is within hidden container. Check if container has not a rule of style `display: none;`'
);
}

const image = this.componentShadowRoot.getElementById('face') as HTMLImageElement | null;
if (!page || !image) {
throw new Error('Unknown paper size, process aborted');
Expand Down
8 changes: 6 additions & 2 deletions src/print-restriction.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
border: none !important;
background: none !important;
overflow: hidden !important;
opacity: unset !important;
visibility: unset !important;
display: unset !important;
position: unset !important;
}

body *:not(wanted-print-form, style, script) {
z-index: 1 !important;
body *:not(wanted-print-form):not(style):not(script) {
opacity: unset !important;
display: unset !important;
visibility: hidden !important;
}
}

0 comments on commit 8a6ace6

Please sign in to comment.