Update lint rules
This commit is contained in:
@@ -6,9 +6,10 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { MessageDescriptor } from '@lingui/core';
|
||||
import type { MessageDescriptor } from '@lingui/core';
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { TapZoneLayouts, TapZoneRegion, TapZoneRegionType } from '@/features/reader/tap-zones/TapZoneLayout.types.ts';
|
||||
import type { TapZoneRegion } from '@/features/reader/tap-zones/TapZoneLayout.types.ts';
|
||||
import { TapZoneLayouts, TapZoneRegionType } from '@/features/reader/tap-zones/TapZoneLayout.types.ts';
|
||||
|
||||
export const READER_TAP_ZONE_LAYOUTS: Record<TapZoneLayouts, TapZoneRegion[]> = {
|
||||
/**
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { CSSProperties } from 'react';
|
||||
import {
|
||||
import type { CSSProperties } from 'react';
|
||||
import type {
|
||||
ReaderTapZoneRect,
|
||||
TapZoneInvertMode,
|
||||
TapZoneLayouts,
|
||||
TapZoneRegion,
|
||||
TapZoneRegionType,
|
||||
} from '@/features/reader/tap-zones/TapZoneLayout.types.ts';
|
||||
import { TapZoneRegionType } from '@/features/reader/tap-zones/TapZoneLayout.types.ts';
|
||||
import {
|
||||
READER_TAP_ZONE_LAYOUTS,
|
||||
TAP_ZONE_REGION_TYPE_DATA,
|
||||
@@ -25,6 +25,10 @@ interface InvertMode extends TapZoneInvertMode {
|
||||
isRTL: boolean;
|
||||
}
|
||||
|
||||
const calcActualValue = (value: number, size: number) => (value / 100) * size;
|
||||
|
||||
const calcRectCenter = (pos1: number, pos2: number) => (pos1 + pos2) * 0.5 + pos1 * 0.5;
|
||||
|
||||
export class ReaderTapZoneService {
|
||||
private static layout: TapZoneLayouts | null = null;
|
||||
|
||||
@@ -108,13 +112,10 @@ export class ReaderTapZoneService {
|
||||
const { text: translation, color } = TAP_ZONE_REGION_TYPE_DATA[type];
|
||||
const text = i18n._(translation);
|
||||
|
||||
const calcActualValue = (value: number, size: number) => (value / 100) * size;
|
||||
const x = calcActualValue(rectX, canvasWidth);
|
||||
const y = calcActualValue(rectY, canvasHeight);
|
||||
const width = calcActualValue(rectWidth, canvasWidth);
|
||||
const height = calcActualValue(rectHeight, canvasHeight);
|
||||
|
||||
const calcRectCenter = (pos1: number, pos2: number) => (pos1 + pos2) * 0.5 + pos1 * 0.5;
|
||||
const rectCenterX = calcRectCenter(x, width);
|
||||
const rectCenterY = calcRectCenter(y, height);
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { SliceCreator } from '@/lib/zustand/Zustand.types.ts';
|
||||
import { TReaderTapZoneContext } from '@/features/reader/tap-zones/TapZoneLayout.types.ts';
|
||||
import type { SliceCreator } from '@/lib/zustand/Zustand.types.ts';
|
||||
import type { TReaderTapZoneContext } from '@/features/reader/tap-zones/TapZoneLayout.types.ts';
|
||||
|
||||
export interface ReaderTapZoneStoreSlice {
|
||||
tapZone: TReaderTapZoneContext & {
|
||||
|
||||
@@ -14,7 +14,7 @@ import { useNavBarContext } from '@/features/navigation-bar/NavbarContext.tsx';
|
||||
import { useResizeObserver } from '@/base/hooks/useResizeObserver.tsx';
|
||||
import { ReadingDirection } from '@/features/reader/Reader.types.ts';
|
||||
import { withPropsFrom } from '@/base/hoc/withPropsFrom.tsx';
|
||||
import { NavbarContextType } from '@/features/navigation-bar/NavigationBar.types.ts';
|
||||
import type { NavbarContextType } from '@/features/navigation-bar/NavigationBar.types.ts';
|
||||
import { useReaderSettingsStore, useReaderTapZoneStore } from '@/features/reader/stores/ReaderStore.ts';
|
||||
|
||||
const CANVAS_ID = 'reader-tap-zone-layout-canvas';
|
||||
|
||||
Reference in New Issue
Block a user