Position fix for texts
This commit is contained in:
@ -19,7 +19,7 @@ import { type ExtendedCharacter } from '@/types'
|
||||
import { useGameStore } from '@/stores/gameStore'
|
||||
import { useZoneStore } from '@/stores/zoneStore'
|
||||
import { watch, computed, ref, onMounted, onUnmounted } from 'vue'
|
||||
import { Container, refObj, RoundRectangle, Sprite, Text } from 'phavuer'
|
||||
import { Container, refObj, RoundRectangle, Sprite, Text, useGame } from 'phavuer'
|
||||
import { calculateIsometricDepth, tileToWorldX, tileToWorldY } from '@/composables/zoneComposable'
|
||||
|
||||
enum Direction {
|
||||
@ -37,14 +37,15 @@ const charChatContainer = refObj<Phaser.GameObjects.Container>()
|
||||
const charContainer = refObj<Phaser.GameObjects.Container>()
|
||||
const charSprite = refObj<Phaser.GameObjects.Sprite>()
|
||||
|
||||
const game = useGame()
|
||||
const gameStore = useGameStore()
|
||||
const zoneStore = useZoneStore()
|
||||
|
||||
const isometricDepth = ref(1)
|
||||
const currentX = ref(0)
|
||||
const currentY = ref(0)
|
||||
const tween = ref<Phaser.Tweens.Tween | null>(null)
|
||||
const isometricDepth = ref(1)
|
||||
const isInitialPosition = ref(true)
|
||||
const tween = ref<Phaser.Tweens.Tween | null>(null)
|
||||
|
||||
const updateIsometricDepth = (x: number, y: number) => {
|
||||
isometricDepth.value = calculateIsometricDepth(x, y, 28, 94, true)
|
||||
@ -135,11 +136,21 @@ const createChatText = (text: Phaser.GameObjects.Text) => {
|
||||
text.setFontSize(13)
|
||||
text.setFontStyle('bold')
|
||||
text.setFontFamily('Arial')
|
||||
|
||||
// Fix text alignment on Windows
|
||||
if (game.device.os.windows) {
|
||||
text.setOrigin(0.5, 9.8)
|
||||
}
|
||||
}
|
||||
|
||||
const createText = (text: Phaser.GameObjects.Text) => {
|
||||
text.setFontSize(13)
|
||||
text.setFontFamily('Arial')
|
||||
|
||||
// Fix text alignment on Windows
|
||||
if (game.device.os.windows) {
|
||||
text.setOrigin(0.5, 8)
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
|
Reference in New Issue
Block a user