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