Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ tech changes will usually be stripped from release notes for the public
### Fixed

- Initiative effect rename losing focus after pressing 1 character
- Initiative effect rename losing focus when moving mouse off initiative entry
- Locked shapes not being selectable directly
- DM only auras where no longer rendered due to a bug in the new access logic

Expand Down
4 changes: 3 additions & 1 deletion client/src/core/components/ResizingTextArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getTarget, getValue } from "../utils";

const { visible = true, disabled = false } = defineProps<{ visible?: boolean; disabled?: boolean }>();
const textArea = useTemplateRef("textarea");
const emit = defineEmits<(e: "change", s: string) => void>();
const emit = defineEmits<{ (e: "change", s: string): void; (e: "focus" | "blur"): void }>();
const text = defineModel<string>({ required: true });

onMounted(async () => {
Expand Down Expand Up @@ -39,6 +39,8 @@ function resizeTextArea(element: HTMLElement): void {
rows="1"
@input="resizeTextArea(getTarget($event))"
@change="emit('change', getValue($event))"
@focus="emit('focus')"
@blur="emit('blur')"
@keyup.enter="getTarget($event).blur()"
@keydown.enter.prevent
/>
Expand Down
27 changes: 23 additions & 4 deletions client/src/game/ui/initiative/Initiative.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ interface ConfirmationDialog {
const confirmationDialog = ref<ConfirmationDialog | null>(null);
const listElement = useTemplateRef<HTMLElement>("list-element");
const addEffect = ref<GlobalId | null>(null);
const showEffectsFor = ref<number | null>(null);
const entryFocus = ref<{ index: number; mouseOver: boolean; focused: boolean }>({
index: 0,
mouseOver: false,
focused: false,
});

const hasVisibleActor = computed(() => initiativeStore.state.locationData.some((actor) => canSee(actor)));

Expand Down Expand Up @@ -343,6 +347,16 @@ function openSettings(): void {
uiSystem.showClientSettings(true);
}

function setEntryFocus(index: number, enable: boolean, mouse: boolean): void {
if (!entryFocus.value.mouseOver && !entryFocus.value.focused) {
entryFocus.value.index = index;
}
if (entryFocus.value.index === index) {
if (mouse) entryFocus.value.mouseOver = enable;
else entryFocus.value.focused = enable;
}
}

// shitty helper because draggable loses all type information :arghfist:
function n(e: any): number {
return e as number;
Expand Down Expand Up @@ -378,8 +392,8 @@ function n(e: any): number {
v-if="canSee(actor)"
class="initiative-entry"
:class="{ 'owned-actor': owns(actor.globalId) && !gameState.reactive.isDm }"
@mouseover="showEffectsFor = index"
@mouseleave="showEffectsFor = null"
@mouseenter="setEntryFocus(index, true, true)"
@mouseleave="setEntryFocus(index, false, true)"
>
<div
class="initiative-actor"
Expand Down Expand Up @@ -511,7 +525,8 @@ function n(e: any): number {
actor.effects.length > 0 &&
(alwaysShowEffects ||
initiativeStore.state.turnCounter === index ||
showEffectsFor === index)
(entryFocus.index === index &&
(entryFocus.mouseOver || entryFocus.focused)))
"
class="initiative-effect"
:class="{
Expand All @@ -531,6 +546,8 @@ function n(e: any): number {
:disabled="!owns(actor.globalId)"
:visible="initiativeStore.state.showInitiative"
@change="setEffectName(actor.globalId, n(e), $event)"
@focus="setEntryFocus(index, true, false)"
@blur="setEntryFocus(index, false, false)"
/>
<input
v-if="effect.turns !== null"
Expand All @@ -543,6 +560,8 @@ function n(e: any): number {
setEffectTurns(actor.globalId, n(e), getValue($event))
"
@keyup.enter="getTarget($event).blur()"
@focus="setEntryFocus(index, true, false)"
@blur="setEntryFocus(index, false, false)"
/>
<div v-else class="effect-turn-counter infinite-placeholder">
&infin;
Expand Down
Loading