Skip to content

Commit 81fddfb

Browse files
committed
disable map interactions while exporting so potential interaction features won't be exported
1 parent 1a3ddbc commit 81fddfb

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

packages/plugins/Export/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Fix: PDF export with download:false now works correctly.
66
- Fix: Adjust documentation to properly describe optionality of configuration parameters.
7+
- Fix: Map interactions are now disabled during the export process so potential interaction features won't be exported
78
- Chore: Update dependencies to latest versions.
89

910
## 1.2.0

packages/plugins/Export/src/store/actions.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { jsPDF } from 'jspdf'
22
import { PolarActionTree } from '@polar/lib-custom-types'
3+
import { Interaction } from 'ol/interaction'
34
import { ExportFormat, ExportGetters, ExportState } from '../types'
45

56
const actions: PolarActionTree<ExportState, ExportGetters> = {
@@ -25,6 +26,13 @@ const actions: PolarActionTree<ExportState, ExportGetters> = {
2526
// Screenshot canvas
2627
const CANVAS_ID = 'export-canvas'
2728

29+
const disabledInteractions: Array<Interaction> = []
30+
31+
map.getInteractions().forEach((interaction) => {
32+
disabledInteractions.push(interaction)
33+
interaction.setActive(false)
34+
})
35+
2836
map.once('postrender', function () {
2937
// Map properties
3038
const size = map.getSize()
@@ -102,6 +110,10 @@ const actions: PolarActionTree<ExportState, ExportGetters> = {
102110
}
103111
}
104112

113+
disabledInteractions.forEach((interaction) => {
114+
interaction.setActive(true)
115+
})
116+
105117
commit('setExportedMap', src)
106118
})
107119
map.renderSync()

0 commit comments

Comments
 (0)