Skip to content

Commit 814c1ba

Browse files
committed
fix(positioning): remove indicacao [F10] do botao de fechar e handler duplicado no React
O F10 ja e tratado exclusivamente pelo keymapping do Lua (positioningMode); o handler duplicado no React causava comportamentos inconsistentes quando o NUI estava com foco por outros motivos (ex: menu de settings aberto). - Remove handler de F10 em web/src/App.tsx - Remove sufixo [F10] dos textos de posicionamento em pt-BR e en - Rebuild html/ com as alteracoes - Remove package.json da raiz (redundante; o real esta em web/package.json)
1 parent 95ff46a commit 814c1ba

9 files changed

Lines changed: 12 additions & 47 deletions

File tree

client/main.lua

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,15 +321,7 @@ RegisterCommand('menu', function()
321321
SendNUIMessage({ action = "open" })
322322
end)
323323

324-
RegisterCommand('positioningMode', function()
325-
if positioningMode then return end
326-
if not Config.Positioning.enabled then return end
327-
positioningMode = true
328-
Wait(50)
329-
TriggerEvent("hud:client:playOpenMenuSounds")
330-
SetNuiFocus(true, true)
331-
SendNUIMessage({ action = "positioning", topic = "open" })
332-
end)
324+
333325

334326
RegisterNUICallback('closeMenu', function(_, cb)
335327
cb({})
@@ -357,7 +349,7 @@ RegisterNUICallback('closePositioningMode', function(_, cb)
357349
end)
358350

359351
RegisterKeyMapping('menu', Lang:t('info.open_menu'), 'keyboard', Config.OpenMenu)
360-
RegisterKeyMapping('positioningMode', Lang:t('info.positioning_mode'), 'keyboard', Config.PositioningKey)
352+
-- RegisterKeyMapping('positioningModeInternal', Lang:t('info.positioning_mode'), 'keyboard', Config.PositioningKey)
361353

362354
-- Reset hud
363355
local function restartHud()

html/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,5 @@
103103
"resetAllPositionsDescription": "Resets every element back to its default position and size",
104104
"positioningModeTitle": "Positioning Mode — Drag elements to reposition them",
105105
"positioningResetAll": "Reset All",
106-
"positioningClose": "Done [F10]"
106+
"positioningClose": "Done"
107107
}

html/index.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

html/pt-br.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,5 @@
103103
"resetAllPositionsDescription": "Restaura a posição e o tamanho padrão de todos os elementos",
104104
"positioningModeTitle": "Modo de Posicionamento — Arraste os elementos para reposicioná-los",
105105
"positioningResetAll": "Resetar tudo",
106-
"positioningClose": "Concluir [F10]"
106+
"positioningClose": "Concluir"
107107
}

package.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

web/src/App.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,6 @@ export default function App() {
5353

5454
useEffect(() => {
5555
const handler = (e: KeyboardEvent) => {
56-
// F10 no NUI so FECHA o modo de posicionamento (quando ativo).
57-
// Abrir e trabalho do keymapping do Lua ('positioningMode'), que tem
58-
// suas proprias guardas. Sem o gate em store.active, o F10 ativava o
59-
// positioning sempre que o NUI tinha foco por outro motivo (ex: menu
60-
// de settings aberto) — ativando coisa que nao devia.
61-
if (e.key === "F10") {
62-
const store = usePositioningStore.getState();
63-
if (store.active) {
64-
fetchNui("closePositioningMode");
65-
togglePositioning();
66-
}
67-
return;
68-
}
6956
// ESC no modo de posicionamento: fecha o modo (libera foco NUI no
7057
// Lua + reseta o estado). Sem isso, o ESC nativo do FiveM tira o
7158
// foco mas deixa active=true no React e positioningMode=true no

web/src/locale/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,5 @@
103103
"resetAllPositionsDescription": "Resets every element back to its default position and size",
104104
"positioningModeTitle": "Positioning Mode — Drag elements to reposition them",
105105
"positioningResetAll": "Reset All",
106-
"positioningClose": "Done [F10]"
106+
"positioningClose": "Done"
107107
}

web/src/locale/pt-br.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,5 @@
103103
"resetAllPositionsDescription": "Restaura a posição e o tamanho padrão de todos os elementos",
104104
"positioningModeTitle": "Modo de Posicionamento — Arraste os elementos para reposicioná-los",
105105
"positioningResetAll": "Resetar tudo",
106-
"positioningClose": "Concluir [F10]"
106+
"positioningClose": "Concluir"
107107
}

web/src/utils/i18n.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ const defaultTranslations: Translation = {
122122
resetAllPositionsDescription: "Resets every element back to its default position and size",
123123
positioningModeTitle: "Positioning Mode — Drag elements to reposition them",
124124
positioningResetAll: "Reset All",
125-
positioningClose: "Done [F10]",
125+
positioningClose: "Done",
126126
};
127127

128128
export const useI18nStore = create<I18nState>((set) => ({

0 commit comments

Comments
 (0)