Skip to content

Commit

Permalink
fix draw timing
Browse files Browse the repository at this point in the history
  • Loading branch information
qazsato committed Jul 27, 2024
1 parent 4219c67 commit 0a604ed
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 103 deletions.
14 changes: 7 additions & 7 deletions docs/200.html

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions docs/404.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/_payload.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"data":1,"prerenderedAt":3},["ShallowReactive",2],{},1722084082668]
[{"data":1,"prerenderedAt":3},["ShallowReactive",2],{},1722084855323]
2 changes: 1 addition & 1 deletion docs/assets/Di1SuN-O.js → docs/assets/BAXeh9PG.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/assets/Djj1s0de.js → docs/assets/CO7BEIdq.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions docs/assets/1LWmkWKD.js → docs/assets/DGAPDmwC.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/d-UY-aAO.js → docs/assets/DNUVdy4O.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/assets/builds/latest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"id":"7c1674ba-d3ab-42f8-a69a-13907389b823","timestamp":1722084073691}
{"id":"c3c07807-23c8-44e3-8c81-d82fca11e41f","timestamp":1722084846061}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"c3c07807-23c8-44e3-8c81-d82fca11e41f","timestamp":1722084846061,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":["/"]}

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions docs/index.html

Large diffs are not rendered by default.

108 changes: 48 additions & 60 deletions packages/docs/components/MeshMap.vue
Original file line number Diff line number Diff line change
@@ -1,52 +1,51 @@
<template>
<div class="relative">
<div class="absolute top-2 left-2 z-10 flex items-center">
<UInput
v-model="selectedCode"
name="selectedCode"
placeholder="メッシュコード"
icon="i-heroicons-magnifying-glass-20-solid"
autocomplete="off"
size="md"
:ui="{ icon: { trailing: { pointer: '' } } }"
>
<template #trailing>
<UButton
v-show="selectedCode !== ''"
color="gray"
variant="link"
icon="i-heroicons-x-mark-20-solid"
:padded="false"
@click="selectedCode = ''"
/>
</template>
</UInput>
<UButton
v-if="isValidCode"
:icon="copyButtonIcon"
color="white"
variant="solid"
size="md"
class="ml-2"
@click="onCopy">
{{ copyButtonText }}
</UButton>
</div>
<div class="absolute top-2 right-2 z-10 flex items-center">
<USelectMenu v-model="selectedLevel" :options="MESH_LEVELS" class="w-80" :disabled="fixedLevel">
<template #label>
<UBadge variant="outline" class="w-12 justify-center">{{ selectedLevel.level }}</UBadge>
<span class="truncate">{{ selectedLevel.name }}</span>
</template>
<template #option="{ option: mesh }">
<UBadge variant="outline" class="w-12 justify-center">{{ mesh.level }}</UBadge>
<span class="truncate">{{ mesh.name }}</span>
</template>
</USelectMenu>
<!-- <UTooltip text="メッシュレベルを固定する">
<UToggle v-model="fixedLevel" class="mx-2"/>
</UTooltip> -->
</div>
<template v-if="loaded">
<div class="absolute top-2 left-2 z-10 flex items-center">
<UInput
v-model="selectedCode"
name="selectedCode"
placeholder="メッシュコード"
icon="i-heroicons-magnifying-glass-20-solid"
autocomplete="off"
size="md"
:ui="{ icon: { trailing: { pointer: '' } } }"
>
<template #trailing>
<UButton
v-show="selectedCode !== ''"
color="gray"
variant="link"
icon="i-heroicons-x-mark-20-solid"
:padded="false"
@click="selectedCode = ''"
/>
</template>
</UInput>
<UButton
v-if="isValidCode"
:icon="copyButtonIcon"
color="white"
variant="solid"
size="md"
class="ml-2"
@click="onCopy">
{{ copyButtonText }}
</UButton>
</div>
<div class="absolute top-2 right-2 z-10 flex items-center">
<USelectMenu v-model="selectedLevel" :options="MESH_LEVELS" class="w-80">
<template #label>
<UBadge variant="outline" class="w-12 justify-center">{{ selectedLevel.level }}</UBadge>
<span class="truncate">{{ selectedLevel.name }}</span>
</template>
<template #option="{ option: mesh }">
<UBadge variant="outline" class="w-12 justify-center">{{ mesh.level }}</UBadge>
<span class="truncate">{{ mesh.name }}</span>
</template>
</USelectMenu>
</div>
</template>
<div id="map" />
</div>
</template>
Expand All @@ -65,9 +64,9 @@ const colorMode = useColorMode()
const selectedCode = ref<string>(route.query.code as string || '')
const selectedLevel = ref(MESH_LEVELS[0])
const fixedLevel = ref(false)
let map: Map | null = null
const loaded = ref(false)
const copied = ref(false)
const mapStyleUrl = computed(() => colorMode.preference === 'light' ? MAP_STYLE.LIGHT : MAP_STYLE.DARK)
Expand Down Expand Up @@ -102,24 +101,12 @@ watch(selectedCode, (code) => {
watch(selectedLevel, (mesh) => {
if (!map) return
fixedLevel.value = false
const zoom = map.getZoom()
if (zoom <= mesh.minZoom || zoom > mesh.maxZoom) {
map.setZoom(mesh.maxZoom)
}
})
watch(fixedLevel, (value) => {
if (!map) return
if (value) {
map.setMinZoom(selectedLevel.value.minZoom)
map.setMaxZoom(selectedLevel.value.maxZoom)
} else {
map.setMinZoom(4)
map.setMaxZoom(18)
}
})
onMounted(() => {
let defaultCenter: maplibregl.LngLatLike = [138.517821, 34.380147]
let defaultZoom = 4
Expand All @@ -145,6 +132,7 @@ onMounted(() => {
map.on('load', () => {
if (!map) return
loaded.value = true
drawMesh(map, defaultLevel)
map.on('click', `polygon-mesh-fill`, (e) => {
const features = e.features as maplibregl.MapGeoJSONFeature[];
Expand Down

0 comments on commit 0a604ed

Please sign in to comment.