Position fix for texts
This commit is contained in:
parent
b2266f5a10
commit
a92675e4c0
6
package-lock.json
generated
6
package-lock.json
generated
@ -6115,9 +6115,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/sass": {
|
||||
"version": "1.79.3",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.79.3.tgz",
|
||||
"integrity": "sha512-m7dZxh0W9EZ3cw50Me5GOuYm/tVAJAn91SUnohLRo9cXBixGUOdvmryN+dXpwR831bhoY3Zv7rEFt85PUwTmzA==",
|
||||
"version": "1.79.4",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.79.4.tgz",
|
||||
"integrity": "sha512-K0QDSNPXgyqO4GZq2HO5Q70TLxTH6cIT59RdoCHMivrC8rqzaTw5ab9prjz9KUN1El4FLXrBXJhik61JR4HcGg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user