feat: 새 지도 모듈 마무리

This commit is contained in:
2022-04-20 03:29:48 +09:00
parent 5a9322f003
commit 6bee1c1440
3 changed files with 16 additions and 25 deletions
+4 -4
View File
@@ -642,10 +642,10 @@ $smV: calc(500 / 700);
.city_state {
position: absolute;
width: 10px;
height: 10px;
top: -2px;
left: -4px;
width: 8px;
height: 8px;
top: -3px;
left: -5px;
background-color: white;
}
+5 -1
View File
@@ -80,11 +80,15 @@ watch(
left: `${x - 20}px`,
top: `${y - 15}px`,
};
} else {
cityPos.value = {
left: `${(x * 5) / 7 - 20}px`,
top: `${(y * 5) / 7 - 18}px`,
};
}
},
{ immediate: true }
);
function getCityState(): string {
const state = city.value.state;
if (state < 10) {
@@ -61,6 +61,7 @@
:image-path="imagePath"
:is-my-city="city.id === drawableMap.myCity"
:isFullWidth="isFullWidth"
:href="props.genHref?.call(city, city.id)"
@click="cityClick(city, $event)"
@mouseenter="mouseenter(city, $event)"
@mouseleave="mouseleave(city, $event)"
@@ -73,6 +74,7 @@
:city="city"
:is-my-city="city.id === drawableMap.myCity"
:isFullWidth="isFullWidth"
:href="props.genHref?.call(city, city.id)"
@click="cityClick(city, $event)"
@mouseenter="mouseenter(city, $event)"
@mouseleave="mouseleave(city, $event)"
@@ -152,7 +154,6 @@ export type CityPositionMap = {
</script>
<script lang="ts" setup>
import "@/../scss/map.scss";
import type { loadMapOption } from "@/map";
import { type PropType, toRef, inject, type Ref, ref, watch, type ComponentPublicInstance } from "vue";
import { v4 as uuidv4 } from "uuid";
import type { MapResult } from "@/defs";
@@ -205,14 +206,6 @@ const props = defineProps({
default: undefined,
required: false,
},
serverNick: {
type: String,
required: true,
},
serverID: {
type: String,
required: true,
},
imagePath: {
type: String,
required: true,
@@ -223,17 +216,11 @@ const props = defineProps({
},
isDetailMap: { type: Boolean, default: undefined, required: false },
disallowClick: { type: Boolean, default: undefined, required: false },
hrefTemplate: { type: String, default: "#", required: false },
/// clickable, ,
neutralView: { type: Boolean, default: false, required: false },
/// . neutralView
showMe: { type: Boolean, default: true, required: false },
callback: {
type: Function as PropType<loadMapOption["callback"]>,
genHref: {
type: Function as PropType<(cityID: number) => string>,
default: undefined,
required: false,
},
startYear: { type: Number, default: undefined, required: false },
cityPosition: {
type: Object as PropType<CityPositionMap>,
@@ -456,7 +443,7 @@ function cityClick(city: MapCityParsed, $event: MouseEvent | TouchEvent): void {
function clickOutside($event: MouseEvent): void {
$event.preventDefault();
$event.stopPropagation();
if(touchState.value == 1) {
if (touchState.value == 1) {
touchState.value = 0;
activatedCity.value = undefined;
}
@@ -475,4 +462,4 @@ function mouseleave(city: MapCityParsed, $event: MouseEvent): void {
touchState.value = 0;
}
}
</script>
</script>