mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-12 10:45:54 +00:00
fix(Core): Fixed system select after tab switch
This commit is contained in:
@@ -49,9 +49,7 @@ export const useMapHandlers = (ref: ForwardedRef<MapHandlers>, onSelectionChange
|
|||||||
const { charactersUpdated, presentCharacters, characterAdded, characterRemoved, characterUpdated } =
|
const { charactersUpdated, presentCharacters, characterAdded, characterRemoved, characterUpdated } =
|
||||||
useCommandsCharacters();
|
useCommandsCharacters();
|
||||||
|
|
||||||
useImperativeHandle(
|
useImperativeHandle(ref, () => {
|
||||||
ref,
|
|
||||||
() => {
|
|
||||||
return {
|
return {
|
||||||
command(type, data) {
|
command(type, data) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -133,7 +131,5 @@ export const useMapHandlers = (ref: ForwardedRef<MapHandlers>, onSelectionChange
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
}, []);
|
||||||
[],
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,36 +1,36 @@
|
|||||||
import { Map, MAP_ROOT_ID } from '@/hooks/Mapper/components/map/Map.tsx';
|
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
||||||
import { CommandSelectSystems, OutCommand, OutCommandHandler, SolarSystemConnection } from '@/hooks/Mapper/types';
|
|
||||||
import { MapRootData, useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
|
||||||
import { OnMapAddSystemCallback, OnMapSelectionChange } from '@/hooks/Mapper/components/map/map.types.ts';
|
|
||||||
import isEqual from 'lodash.isequal';
|
|
||||||
import { ContextMenuSystem, useContextMenuSystemHandlers } from '@/hooks/Mapper/components/contexts';
|
import { ContextMenuSystem, useContextMenuSystemHandlers } from '@/hooks/Mapper/components/contexts';
|
||||||
|
import { Map, MAP_ROOT_ID } from '@/hooks/Mapper/components/map/Map.tsx';
|
||||||
|
import { OnMapAddSystemCallback, OnMapSelectionChange } from '@/hooks/Mapper/components/map/map.types.ts';
|
||||||
import {
|
import {
|
||||||
SystemCustomLabelDialog,
|
SystemCustomLabelDialog,
|
||||||
SystemLinkSignatureDialog,
|
SystemLinkSignatureDialog,
|
||||||
SystemSettingsDialog,
|
SystemSettingsDialog,
|
||||||
} from '@/hooks/Mapper/components/mapInterface/components';
|
} from '@/hooks/Mapper/components/mapInterface/components';
|
||||||
import { Connections } from '@/hooks/Mapper/components/mapRootContent/components/Connections';
|
import { Connections } from '@/hooks/Mapper/components/mapRootContent/components/Connections';
|
||||||
import { ContextMenuSystemMultiple, useContextMenuSystemMultipleHandlers } from '../contexts/ContextMenuSystemMultiple';
|
|
||||||
import { getSystemById } from '@/hooks/Mapper/helpers';
|
import { getSystemById } from '@/hooks/Mapper/helpers';
|
||||||
|
import { MapRootData, useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
|
import { CommandSelectSystems, OutCommand, OutCommandHandler, SolarSystemConnection } from '@/hooks/Mapper/types';
|
||||||
import { Commands } from '@/hooks/Mapper/types/mapHandlers.ts';
|
import { Commands } from '@/hooks/Mapper/types/mapHandlers.ts';
|
||||||
|
import isEqual from 'lodash.isequal';
|
||||||
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { Node, useReactFlow, Viewport, XYPosition } from 'reactflow';
|
import { Node, useReactFlow, Viewport, XYPosition } from 'reactflow';
|
||||||
|
import { ContextMenuSystemMultiple, useContextMenuSystemMultipleHandlers } from '../contexts/ContextMenuSystemMultiple';
|
||||||
|
|
||||||
import { useCommandsSystems } from '@/hooks/Mapper/mapRootProvider/hooks/api';
|
|
||||||
import { emitMapEvent, useMapEventListener } from '@/hooks/Mapper/events';
|
import { emitMapEvent, useMapEventListener } from '@/hooks/Mapper/events';
|
||||||
|
import { useCommandsSystems } from '@/hooks/Mapper/mapRootProvider/hooks/api';
|
||||||
|
|
||||||
import { useDeleteSystems } from '@/hooks/Mapper/components/contexts/hooks';
|
import { useDeleteSystems } from '@/hooks/Mapper/components/contexts/hooks';
|
||||||
import { useCommonMapEventProcessor } from '@/hooks/Mapper/components/mapWrapper/hooks/useCommonMapEventProcessor.ts';
|
|
||||||
import {
|
import {
|
||||||
AddSystemDialog,
|
AddSystemDialog,
|
||||||
SearchOnSubmitCallback,
|
SearchOnSubmitCallback,
|
||||||
} from '@/hooks/Mapper/components/mapInterface/components/AddSystemDialog';
|
} from '@/hooks/Mapper/components/mapInterface/components/AddSystemDialog';
|
||||||
import { useHotkey } from '../../hooks/useHotkey';
|
|
||||||
import { PingType } from '@/hooks/Mapper/types/ping.ts';
|
|
||||||
import { SystemPingDialog } from '@/hooks/Mapper/components/mapInterface/components/SystemPingDialog';
|
import { SystemPingDialog } from '@/hooks/Mapper/components/mapInterface/components/SystemPingDialog';
|
||||||
import { MiniMapPlacement } from '@/hooks/Mapper/mapRootProvider/types.ts';
|
import { useCommonMapEventProcessor } from '@/hooks/Mapper/components/mapWrapper/hooks/useCommonMapEventProcessor.ts';
|
||||||
import { MINIMAP_PLACEMENT_MAP } from '@/hooks/Mapper/constants.ts';
|
import { MINIMAP_PLACEMENT_MAP } from '@/hooks/Mapper/constants.ts';
|
||||||
|
import { MiniMapPlacement } from '@/hooks/Mapper/mapRootProvider/types.ts';
|
||||||
|
import { PingType } from '@/hooks/Mapper/types/ping.ts';
|
||||||
import type { PanelPosition } from '@reactflow/core';
|
import type { PanelPosition } from '@reactflow/core';
|
||||||
|
import { useHotkey } from '../../hooks/useHotkey';
|
||||||
import { MINI_MAP_PLACEMENT_OFFSETS } from './constants.ts';
|
import { MINI_MAP_PLACEMENT_OFFSETS } from './constants.ts';
|
||||||
|
|
||||||
// TODO: INFO - this component needs for abstract work with Map instance
|
// TODO: INFO - this component needs for abstract work with Map instance
|
||||||
@@ -106,7 +106,7 @@ export const MapWrapper = () => {
|
|||||||
|
|
||||||
runCommand({
|
runCommand({
|
||||||
name: Commands.selectSystems,
|
name: Commands.selectSystems,
|
||||||
data: { systems: selectedSystems } as CommandSelectSystems,
|
data: { systems: selectedSystems, delay: 200 } as CommandSelectSystems,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -703,18 +703,6 @@ defmodule WandererAppWeb.MapCoreEventHandler do
|
|||||||
|
|
||||||
Process.send_after(self(), %{event: :load_map_pings}, 200)
|
Process.send_after(self(), %{event: :load_map_pings}, 200)
|
||||||
|
|
||||||
Process.send_after(
|
|
||||||
self(),
|
|
||||||
%{
|
|
||||||
event: :maybe_select_system,
|
|
||||||
payload: %{
|
|
||||||
character_id: nil,
|
|
||||||
solar_system_id: nil
|
|
||||||
}
|
|
||||||
},
|
|
||||||
200
|
|
||||||
)
|
|
||||||
|
|
||||||
if needs_tracking_setup do
|
if needs_tracking_setup do
|
||||||
Process.send_after(self(), %{event: :show_tracking}, 10)
|
Process.send_after(self(), %{event: :show_tracking}, 10)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user