forked from noxious/client
#202 - Enable / disable placed map object preview
This commit is contained in:
parent
cbd111a05b
commit
390187f353
@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<SelectedPlacedMapObjectComponent v-if="mapEditor.selectedPlacedObject.value" :key="mapEditor.selectedPlacedObject.value.id" :map :placedMapObject="mapEditor.selectedPlacedObject.value" @move="moveMapObject" @rotate="rotatePlacedMapObject" @delete="deletePlacedMapObject" />
|
<SelectedPlacedMapObjectComponent v-if="mapEditor.selectedPlacedObject.value" :key="mapEditor.selectedPlacedObject.value.id" :map :placedMapObject="mapEditor.selectedPlacedObject.value" @move="moveMapObject" @rotate="rotatePlacedMapObject" @delete="deletePlacedMapObject" />
|
||||||
<PlacedMapObject v-for="placedMapObject in mapEditor.currentMap.value?.placedMapObjects" :tileMap :tileMapLayer :placedMapObject @pointerdown="clickPlacedMapObject(placedMapObject)" />
|
<PlacedMapObject v-for="placedMapObject in mapEditor.currentMap.value?.placedMapObjects" :tileMap :tileMapLayer :placedMapObject @pointerdown="clickPlacedMapObject(placedMapObject)" />
|
||||||
<PlacedMapObject v-if="
|
<PlacedMapObject
|
||||||
mapEditor.tool.value === 'pencil' &&
|
v-if="mapEditor.tool.value === 'pencil' && mapEditor.drawMode.value === 'map_object' && mapEditor.isPlacedMapObjectPreviewEnabled.value && mapEditor.selectedPlacedObject.value && previewPlacedMapObject"
|
||||||
mapEditor.drawMode.value === 'map_object' &&
|
:tileMap
|
||||||
mapEditor.isPlacedMapObjectPreviewEnabled.value &&
|
:tileMapLayer
|
||||||
mapEditor.selectedPlacedObject.value && previewPlacedMapObject" :tileMap :tileMapLayer
|
|
||||||
:key="previewPlacedMapObject?.id"
|
:key="previewPlacedMapObject?.id"
|
||||||
:placedMapObject="previewPlacedMapObject" />
|
:placedMapObject="previewPlacedMapObject as PlacedMapObjectT"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@ -37,7 +37,9 @@ const props = defineProps<{
|
|||||||
const previewPosition = ref({ x: 0, y: 0 })
|
const previewPosition = ref({ x: 0, y: 0 })
|
||||||
|
|
||||||
const previewPlacedMapObject = computed(() => ({
|
const previewPlacedMapObject = computed(() => ({
|
||||||
...mapEditor.selectedPlacedObject.value!,
|
id: uuidv4(),
|
||||||
|
mapObject: mapEditor.selectedMapObject.value?.id,
|
||||||
|
isRotated: false,
|
||||||
positionX: previewPosition.value.x,
|
positionX: previewPosition.value.x,
|
||||||
positionY: previewPosition.value.y
|
positionY: previewPosition.value.y
|
||||||
}))
|
}))
|
||||||
|
@ -93,7 +93,7 @@
|
|||||||
<label for="continuous-drawing" class="text-sm font-medium text-gray-200 cursor-pointer"> Continuous Drawing </label>
|
<label for="continuous-drawing" class="text-sm font-medium text-gray-200 cursor-pointer"> Continuous Drawing </label>
|
||||||
</div>
|
</div>
|
||||||
<div class="m-4 flex items-center space-x-2">
|
<div class="m-4 flex items-center space-x-2">
|
||||||
<input id="show-placed-map-object-preview" @change="toggleShowPlacedMapObjectPreview" v-model="isShowPlacedMapObjectPreviewEnabled" type="checkbox" class="h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500" />
|
<input id="show-placed-map-object-preview" @change="mapEditor.togglePlacedMapObjectPreview()" v-model="isShowPlacedMapObjectPreviewEnabled" type="checkbox" class="h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500" />
|
||||||
<label for="show-placed-map-object-preview" class="text-sm font-medium text-gray-200 cursor-pointer"> Show placed map object preview </label>
|
<label for="show-placed-map-object-preview" class="text-sm font-medium text-gray-200 cursor-pointer"> Show placed map object preview </label>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -116,7 +116,7 @@ const isMapEditorSettingsModalOpen = ref(false)
|
|||||||
const selectPencilOpen = ref(false)
|
const selectPencilOpen = ref(false)
|
||||||
const selectEraserOpen = ref(false)
|
const selectEraserOpen = ref(false)
|
||||||
const isContinuousDrawingEnabled = ref<Boolean>(false)
|
const isContinuousDrawingEnabled = ref<Boolean>(false)
|
||||||
const isShowPlacedMapObjectPreviewEnabled = ref<Boolean>(false)
|
const isShowPlacedMapObjectPreviewEnabled = ref<Boolean>(mapEditor.isPlacedMapObjectPreviewEnabled.value)
|
||||||
const listOpen = computed(() => mapEditor.tool.value === 'pencil' && (mapEditor.drawMode.value === 'tile' || mapEditor.drawMode.value === 'map_object'))
|
const listOpen = computed(() => mapEditor.tool.value === 'pencil' && (mapEditor.drawMode.value === 'tile' || mapEditor.drawMode.value === 'map_object'))
|
||||||
|
|
||||||
// drawMode
|
// drawMode
|
||||||
@ -141,10 +141,6 @@ function toggleContinuousDrawing() {
|
|||||||
mapEditor.setInputMode(isContinuousDrawingEnabled.value ? 'hold' : 'tap')
|
mapEditor.setInputMode(isContinuousDrawingEnabled.value ? 'hold' : 'tap')
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleShowPlacedMapObjectPreview() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleModeClick(mode: string, type: 'pencil' | 'eraser') {
|
function handleModeClick(mode: string, type: 'pencil' | 'eraser') {
|
||||||
setDrawMode(mode)
|
setDrawMode(mode)
|
||||||
type === 'pencil' ? setPencilMode() : setEraserMode()
|
type === 'pencil' ? setPencilMode() : setEraserMode()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user