Skip to content

Commit

Permalink
fix vue type and add size variables
Browse files Browse the repository at this point in the history
  • Loading branch information
MokujinMap committed Jul 15, 2024
1 parent e9f1d49 commit 14515f8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
15 changes: 11 additions & 4 deletions src/markers/MMapDefaultMarker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ const HINT_SUBTITLE_CLASS = 'mappable--hint-subtitle';
const HINT_STABLE = 'mappable--hint__stable';
const HINT_HOVERED = 'mappable--hint__hovered';

const NORMAL_SIZE_MARKER_HEIGHT = 59;
const NORMAL_SIZE_MARKER_WIDTH = 44;

const SMALL_SIZE_MARKER_WIDTH = 24;

const MICRO_SIZE_MARKER_WIDTH = 14;

const DISTANCE_BETWEEN_POPUP_AND_MARKER = 8;

export type ThemesColor = {day: string; night: string};
Expand Down Expand Up @@ -302,19 +309,19 @@ export class MMapDefaultMarker extends mappable.MMapComplexEntity<MMapDefaultMar
const popupPosition = this._props.popup.position ?? 'top';

if (popupPosition.includes('top')) {
offset = 59 + DISTANCE_BETWEEN_POPUP_AND_MARKER;
offset = NORMAL_SIZE_MARKER_HEIGHT + DISTANCE_BETWEEN_POPUP_AND_MARKER;
} else if (popupPosition.includes('bottom')) {
offset = DISTANCE_BETWEEN_POPUP_AND_MARKER;
} else {
offset = 44 / 2 + DISTANCE_BETWEEN_POPUP_AND_MARKER;
offset = NORMAL_SIZE_MARKER_WIDTH / 2 + DISTANCE_BETWEEN_POPUP_AND_MARKER;
}

break;
case 'small':
offset = 24 / 2 + DISTANCE_BETWEEN_POPUP_AND_MARKER;
offset = SMALL_SIZE_MARKER_WIDTH / 2 + DISTANCE_BETWEEN_POPUP_AND_MARKER;
break;
case 'micro':
offset = 14 / 2 + DISTANCE_BETWEEN_POPUP_AND_MARKER;
offset = MICRO_SIZE_MARKER_WIDTH / 2 + DISTANCE_BETWEEN_POPUP_AND_MARKER;
break;
}
return offset;
Expand Down
9 changes: 7 additions & 2 deletions src/markers/MMapDefaultMarker/vue/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import type TVue from '@vue/runtime-core';
import {MMapDefaultMarker, MMapDefaultMarkerProps, MarkerColorProps, MarkerPopupProps, MarkerSizeProps} from '../';
import {IconName} from '../../../icons';

export const MMapDefaultMarkerVuefyOptions: CustomVuefyOptions<MMapDefaultMarker> = {
type VuefyMarkerPopup = Omit<MarkerPopupProps, 'content'>;

export const MMapDefaultMarkerVuefyOptions: CustomVuefyOptions<
MMapDefaultMarker,
Omit<MMapDefaultMarkerProps, 'popup'> & {popup: VuefyMarkerPopup}
> = {
props: {
coordinates: {type: Object, required: true},
source: String,
Expand All @@ -29,7 +34,7 @@ export const MMapDefaultMarkerVuefyOptions: CustomVuefyOptions<MMapDefaultMarker
title: {type: String},
subtitle: {type: String},
staticHint: {type: Boolean, default: true},
popup: {type: Object as TVue.PropType<MarkerPopupProps>}
popup: {type: Object as TVue.PropType<VuefyMarkerPopup>}
}
};

Expand Down

0 comments on commit 14515f8

Please sign in to comment.