-
Notifications
You must be signed in to change notification settings - Fork 466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print Dialog inside body and not shadow root #950
Comments
Maybe you can move it afterwards... map.getTargetElement().appendChild(printControl._printDialog.element) |
Thanks, I think it is more a question for vue3-openlayers Not sure if they create the control or ol-ext? Link to OlPrintDialogControl.vue
|
If the control is created a new button appears on the map. |
Any feedback on this issue? |
I've added a |
The PrintDialog uses a mediaquery to hide all element but the map from print. |
Thanks, I am still not having any luck. Can you please show me sample of how this is done. Even with the targetDialog set the code still injects the "ol-print-document" class to the body and not to the targetDialog. This will create a problem if you have multiple maps with its own print dialogs. The best would be to add a class (for example |
The code is here: https://github.com/Viglino/ol-ext/blob/master/src/control/PrintDialog.css#L253 body.ol-print-document > * {
display: none!important;
} Except the print dialog: body.ol-print-document > .ol-ext-print-dialog {
display: block!important;
} So you have to make it visible (and his hierarchy) if it is not at the body root... Do you have an online example? |
@Viglino Thanks, I do understand how the css handles the visibility. The problem here is not that easy. If you have, for example 2 divs with print previews open. Then, in media print the css does the following:
But, because the print dialog does not live in the body anymore (with the use of
But this will print preview all 2 maps on top of each other with the last map on top. That is why I said, that you have to add a custom class to the print dialog, just before window.print happens and remove it after the print preview was done (hidden or printed). Then it will be much easier to handle css based on only the "active" print preview (in case there are more than one print dialog open). |
I have a ol.map that lives in the shadow root. Problem with the Print Dialog is that it is created in the body of the html and not the same root as where the ol.map element lives. How can this be done?
The text was updated successfully, but these errors were encountered: