I have a map created using OpenLayers 4 ,i want to take a print out of the map , before taking the print , i want to see its preview , So I need to clone the map to another container without making any problem with parent map , so i ve tried all these ,
let map2=this.createMapWithExistingView('previewmap',this.parentMap.getView());
createMapWithExistingView(t,v) {
let mapObj = new olMap({
layers: [
],
target: t,
controls: olControls.defaults({ attribution: false }),
interactions: [
new olDragPanInteraction(),
new olMouseWheelZoomInteraction(),
new dragrotateandzoom()
],
view:v
});
return mapObj;
}
but its not showing the map , only default zoom controls , when i clicked on zoom of preview map, zooming occurs on parent map.