diff --git a/scss/_print.scss b/scss/_print.scss index 5966bcc54..5e759a1b7 100644 --- a/scss/_print.scss +++ b/scss/_print.scss @@ -10,6 +10,12 @@ $print-scale-line-color: $grey-darker; $print-scale-line-inner-border-radius: $print-control-border-radius; $print-scale-line-font-size: $font-size-smallest; +#o-print-tools-left > .collapse-scroll.expanded { + background-color: white; + border-radius: 0.25rem; + overflow: hidden; +} + // scale-line .print-scale-line { background: $print-control-bg-color; diff --git a/src/controls/editor/drawtools.js b/src/controls/editor/drawtools.js index 681b215b4..93c05b347 100644 --- a/src/controls/editor/drawtools.js +++ b/src/controls/editor/drawtools.js @@ -63,7 +63,10 @@ const drawToolsSelector = function drawToolsSelector(tools, defaultLayer, v) { if (state) { if (drawTools.length > 1) { active = true; - document.getElementById(target).getElementsByTagName('ul')[0].parentNode.removeChild(document.getElementById(target).getElementsByTagName('ul')[0]); + const ul = document.getElementById(target).getElementsByTagName('ul'); + if (ul.length > 0) { + ul[0].parentNode.removeChild(document.getElementById(target).getElementsByTagName('ul')[0]); + } addDropDown(createDropDownOptions()); document.getElementById(target).classList.add(activeCls); map.once('click', close); @@ -81,7 +84,7 @@ const drawToolsSelector = function drawToolsSelector(tools, defaultLayer, v) { cls: 'o-popover' }); const { body: popoverHTML } = new DOMParser().parseFromString(popover, 'text/html'); - document.getElementById('o-editor-draw').insertAdjacentElement('afterend', popoverHTML); + document.getElementById('o-editor-draw').insertAdjacentElement('afterend', popoverHTML.firstElementChild); setActive(false); } diff --git a/src/controls/editor/editdispatcher.js b/src/controls/editor/editdispatcher.js index ed8374857..631e978eb 100644 --- a/src/controls/editor/editdispatcher.js +++ b/src/controls/editor/editdispatcher.js @@ -1,5 +1,5 @@ function emitChangeEdit(tool, state) { - const changeEdit = new CustomEvent('', { + const changeEdit = new CustomEvent('changeEdit', { detail: { tool, active: state diff --git a/src/controls/editor/edithandler.js b/src/controls/editor/edithandler.js index 34e91afa1..d23591120 100644 --- a/src/controls/editor/edithandler.js +++ b/src/controls/editor/edithandler.js @@ -310,7 +310,7 @@ function cancelDraw() { } function onChangeShape(e) { - setInteractions(e.shape); + setInteractions(e.detail.shape); startDraw(); } diff --git a/src/controls/print/print-interaction-toggle.js b/src/controls/print/print-interaction-toggle.js index 48ca44d39..881726a0c 100644 --- a/src/controls/print/print-interaction-toggle.js +++ b/src/controls/print/print-interaction-toggle.js @@ -42,7 +42,7 @@ export default function PrintInteractionToggle(options = {}) { return Component({ onInit() { mapInteractionToggleButton = Button({ - cls: 'padding-small icon-smaller rounded light box-shadow', + cls: 'padding-small icon-smaller round light box-shadow', icon: toggleIcon, tooltipText: 'Ändra kartans läge', tooltipPlacement: 'east', diff --git a/src/controls/print/print-settings.js b/src/controls/print/print-settings.js index 8e675b236..d5e83111e 100644 --- a/src/controls/print/print-settings.js +++ b/src/controls/print/print-settings.js @@ -88,7 +88,7 @@ const PrintSettings = function PrintSettings(options = {}) { close, onInit() { openButton = Button({ - cls: 'padding-small icon-smaller light text-normal', + cls: 'padding-small icon-smaller round light box-shadow', icon: openIcon, tooltipText: 'Visa inställningar', tooltipPlacement: 'east', @@ -182,7 +182,7 @@ const PrintSettings = function PrintSettings(options = {}) { if (rotationControl) { components.push(rotationControl); } contentComponent.addComponents(components); printSettingsContainer = Collapse({ - cls: 'flex column rounded box-shadow bg-white', + cls: 'flex column', containerCls: 'collapse-container no-margin height-full', collapseX: true, collapseY: true, diff --git a/src/controls/print/print-settings.template.js b/src/controls/print/print-settings.template.js index e3013285b..e714e63a4 100644 --- a/src/controls/print/print-settings.template.js +++ b/src/controls/print/print-settings.template.js @@ -14,7 +14,7 @@ export default function printTemplate({ showScaleControl }) { return ` -
+
${titleControl.render()}
${descriptionControl.render()} @@ -51,7 +51,8 @@ export default function printTemplate({
Visa norrpil
${northArrowControl.render()}
- ${rotationControl ? rotationControl.render() : ''} -
 
+
+ ${rotationControl ? rotationControl.render() : ''} +
`; } diff --git a/src/utils/download.js b/src/utils/download.js index 496894f99..b4562c72d 100644 --- a/src/utils/download.js +++ b/src/utils/download.js @@ -56,8 +56,7 @@ export const html2canvas = function html2canvas(el) { backgroundColor: null, logging: false, height: el.offsetHeight, - width: el.offsetWidth, - scale: 4 + width: el.offsetWidth }); }; @@ -67,7 +66,11 @@ export const dom2image = function dom2image(el, exportOptions) { export const getImageBlob = async function getImageBlob(el) { if (el) { - const canvas = await html2canvas(el); + const transformScale = el.style.transform; + const printEl = el; + printEl.style.transform = 'scale(1)'; + const canvas = await html2canvas(printEl); + printEl.style.transform = transformScale; const blob = await canvasToBlob(canvas); return blob; }