diff --git a/src/components/molecules/card/AnyWayCard.tsx b/src/components/molecules/card/AnyWayCard.tsx index e49ea696..9216308c 100644 --- a/src/components/molecules/card/AnyWayCard.tsx +++ b/src/components/molecules/card/AnyWayCard.tsx @@ -109,7 +109,7 @@ const AnyWayCard: FC = ({ const imgDownloadHandler = () => { if (element && element instanceof HTMLElement) { - if (widgetType === CardType.Map) { + if (widgetType === CardType.MapAndDesigns) { widgetToImageH2C(widgetName, element); } else { widgetToImageH2I(widgetName, element); diff --git a/src/components/organisms/CardEditorDialog.tsx b/src/components/organisms/CardEditorDialog.tsx index a663fc01..3ff2915a 100644 --- a/src/components/organisms/CardEditorDialog.tsx +++ b/src/components/organisms/CardEditorDialog.tsx @@ -36,7 +36,7 @@ const CardEditor: FC = ({ isOpen, onClose, widgetName, text }) => { const widgetType = getWidgetType(widgetName); const imgDownloadHandler = () => { if (cardElement && cardElement instanceof HTMLElement) { - if (widgetType === CardType.Map) { + if (widgetType === CardType.MapAndDesigns) { widgetToImageH2C(widgetName, cardElement); } else { widgetToImageH2I(widgetName, cardElement); diff --git a/src/services/to-image.service.ts b/src/services/to-image.service.ts index 9df71170..aef5059a 100644 --- a/src/services/to-image.service.ts +++ b/src/services/to-image.service.ts @@ -2,7 +2,7 @@ import { saveAs } from 'file-saver'; import * as htmlToImage from 'html-to-image'; import html2canvas from 'html2canvas'; -const DEFAULT_SCALE = 3; +const DEFAULT_SCALE = 4; const removeMapControllers = (el: Document) => { const elementList = el.querySelectorAll( @@ -16,7 +16,7 @@ export const widgetToImageH2I = (fileName: string, widgetElement: HTMLElement) = }; // https://github.com/bubkoo/html-to-image -const usingHtml2Image = (fileName: string, widgetElement: HTMLElement, scale = DEFAULT_SCALE) => { +const usingHtml2Image = (fileName: string, widgetElement: HTMLElement) => { const canvasWidth = 3300; const canvasHeight = 3300; diff --git a/src/services/widgets.style.service.ts b/src/services/widgets.style.service.ts index f7300f2c..fc494d3a 100644 --- a/src/services/widgets.style.service.ts +++ b/src/services/widgets.style.service.ts @@ -16,7 +16,7 @@ export enum FooterVariant { export enum CardType { None, - Map, + MapAndDesigns, } export interface CardVariant { header: HeaderVariant; @@ -74,8 +74,13 @@ export function getWidgetVariant(widgetName: string) { const widgetTypes: { [index: string]: CardType } = { defaultType: CardType.None, - [WidgetName.most_severe_accidents]: CardType.Map , - [WidgetName.accidents_heat_map]:CardType.Map, + [WidgetName.most_severe_accidents]: CardType.MapAndDesigns , + [WidgetName.accidents_heat_map]:CardType.MapAndDesigns, + [WidgetName.injured_count_by_severity]:CardType.MapAndDesigns, + [WidgetName.accident_count_by_severity]:CardType.MapAndDesigns, + [WidgetName.vision_zero_2_plus_1]:CardType.MapAndDesigns, + [WidgetName.vision_zero_10_50_90]:CardType.MapAndDesigns, + [WidgetName.vision_zero_bike]:CardType.MapAndDesigns, }; export function getWidgetType(widgetName: string) {