🚨(frontend) fix linting errors
- Fix linting errors in FaceLandmarksProcessor - Fix linting errors in EffectsConfiguration - Fix linting errors in useHasFaceLandmarksAccess
This commit is contained in:
committed by
aleb_the_flash
parent
7405011cd2
commit
672ca7dfe4
@@ -182,7 +182,7 @@ export class FaceLandmarksProcessor implements BackgroundProcessorInterface {
|
|||||||
// Calculate distance between points
|
// Calculate distance between points
|
||||||
const distance = Math.sqrt(
|
const distance = Math.sqrt(
|
||||||
Math.pow(rightPoint.x - leftPoint.x, 2) +
|
Math.pow(rightPoint.x - leftPoint.x, 2) +
|
||||||
Math.pow(rightPoint.y - leftPoint.y, 2)
|
Math.pow(rightPoint.y - leftPoint.y, 2)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Scale image based on distance
|
// Scale image based on distance
|
||||||
@@ -259,11 +259,24 @@ export class FaceLandmarksProcessor implements BackgroundProcessorInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (leftMoustache && rightMoustache && this.options.showFrench) {
|
if (leftMoustache && rightMoustache && this.options.showFrench) {
|
||||||
this.drawEffect(leftMoustache, rightMoustache, this.mustacheImage!, 1.5, 0.5)
|
this.drawEffect(
|
||||||
|
leftMoustache,
|
||||||
|
rightMoustache,
|
||||||
|
this.mustacheImage!,
|
||||||
|
1.5,
|
||||||
|
0.5
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leftForehead && rightForehead && this.options.showFrench) {
|
if (leftForehead && rightForehead && this.options.showFrench) {
|
||||||
this.drawEffect(leftForehead, rightForehead, this.beretImage!, 2.1, 0.7, -0.1)
|
this.drawEffect(
|
||||||
|
leftForehead,
|
||||||
|
rightForehead,
|
||||||
|
this.beretImage!,
|
||||||
|
2.1,
|
||||||
|
0.7,
|
||||||
|
-0.1
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,12 +28,16 @@ export interface BackgroundProcessorInterface
|
|||||||
export enum ProcessorType {
|
export enum ProcessorType {
|
||||||
BLUR = 'blur',
|
BLUR = 'blur',
|
||||||
VIRTUAL = 'virtual',
|
VIRTUAL = 'virtual',
|
||||||
FACE_LANDMARKS = 'faceLandmarks'
|
FACE_LANDMARKS = 'faceLandmarks',
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BackgroundProcessorFactory {
|
export class BackgroundProcessorFactory {
|
||||||
static isSupported() {
|
static isSupported() {
|
||||||
return ProcessorWrapper.isSupported || BackgroundCustomProcessor.isSupported || FaceLandmarksProcessor.isSupported
|
return (
|
||||||
|
ProcessorWrapper.isSupported ||
|
||||||
|
BackgroundCustomProcessor.isSupported ||
|
||||||
|
FaceLandmarksProcessor.isSupported
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
static getProcessor(
|
static getProcessor(
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
BackgroundProcessorFactory,
|
BackgroundProcessorFactory,
|
||||||
BackgroundProcessorInterface,
|
BackgroundProcessorInterface,
|
||||||
ProcessorType,
|
ProcessorType,
|
||||||
BackgroundOptions
|
BackgroundOptions,
|
||||||
} from '../blur'
|
} from '../blur'
|
||||||
import { css } from '@/styled-system/css'
|
import { css } from '@/styled-system/css'
|
||||||
import { Text, P, ToggleButton, H } from '@/primitives'
|
import { Text, P, ToggleButton, H } from '@/primitives'
|
||||||
@@ -15,7 +15,11 @@ import { BlurOnStrong } from '@/components/icons/BlurOnStrong'
|
|||||||
import { useTrackToggle } from '@livekit/components-react'
|
import { useTrackToggle } from '@livekit/components-react'
|
||||||
import { Loader } from '@/primitives/Loader'
|
import { Loader } from '@/primitives/Loader'
|
||||||
import { useSyncAfterDelay } from '@/hooks/useSyncAfterDelay'
|
import { useSyncAfterDelay } from '@/hooks/useSyncAfterDelay'
|
||||||
import { RiProhibited2Line, RiGlassesLine, RiGoblet2Fill } from '@remixicon/react'
|
import {
|
||||||
|
RiProhibited2Line,
|
||||||
|
RiGlassesLine,
|
||||||
|
RiGoblet2Fill,
|
||||||
|
} from '@remixicon/react'
|
||||||
import { useHasFaceLandmarksAccess } from '../../hooks/useHasFaceLandmarksAccess'
|
import { useHasFaceLandmarksAccess } from '../../hooks/useHasFaceLandmarksAccess'
|
||||||
|
|
||||||
enum BlurRadius {
|
enum BlurRadius {
|
||||||
@@ -143,7 +147,9 @@ export const EffectsConfiguration = ({
|
|||||||
const tooltipLabel = (type: ProcessorType, options: BackgroundOptions) => {
|
const tooltipLabel = (type: ProcessorType, options: BackgroundOptions) => {
|
||||||
if (type === ProcessorType.FACE_LANDMARKS) {
|
if (type === ProcessorType.FACE_LANDMARKS) {
|
||||||
const effect = options.showGlasses ? 'glasses' : 'french'
|
const effect = options.showGlasses ? 'glasses' : 'french'
|
||||||
return t(`faceLandmarks.${effect}.${isSelected(type, options) ? 'clear' : 'apply'}`)
|
return t(
|
||||||
|
`faceLandmarks.${effect}.${isSelected(type, options) ? 'clear' : 'apply'}`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return t(`${type}.${isSelected(type, options) ? 'clear' : 'apply'}`)
|
return t(`${type}.${isSelected(type, options) ? 'clear' : 'apply'}`)
|
||||||
}
|
}
|
||||||
@@ -151,7 +157,10 @@ export const EffectsConfiguration = ({
|
|||||||
const getFaceLandmarksOptions = () => {
|
const getFaceLandmarksOptions = () => {
|
||||||
const processor = getProcessor()
|
const processor = getProcessor()
|
||||||
if (processor?.serialize().type === ProcessorType.FACE_LANDMARKS) {
|
if (processor?.serialize().type === ProcessorType.FACE_LANDMARKS) {
|
||||||
return processor.serialize().options as { showGlasses?: boolean; showFrench?: boolean }
|
return processor.serialize().options as {
|
||||||
|
showGlasses?: boolean
|
||||||
|
showFrench?: boolean
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return { showGlasses: false, showFrench: false }
|
return { showGlasses: false, showFrench: false }
|
||||||
}
|
}
|
||||||
@@ -160,7 +169,8 @@ export const EffectsConfiguration = ({
|
|||||||
const currentOptions = getFaceLandmarksOptions()
|
const currentOptions = getFaceLandmarksOptions()
|
||||||
const newOptions = {
|
const newOptions = {
|
||||||
...currentOptions,
|
...currentOptions,
|
||||||
[effect === 'glasses' ? 'showGlasses' : 'showFrench']: !currentOptions[effect === 'glasses' ? 'showGlasses' : 'showFrench']
|
[effect === 'glasses' ? 'showGlasses' : 'showFrench']:
|
||||||
|
!currentOptions[effect === 'glasses' ? 'showGlasses' : 'showFrench'],
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!newOptions.showGlasses && !newOptions.showFrench) {
|
if (!newOptions.showGlasses && !newOptions.showFrench) {
|
||||||
@@ -363,7 +373,9 @@ export const EffectsConfiguration = ({
|
|||||||
showFrench: false,
|
showFrench: false,
|
||||||
})}
|
})}
|
||||||
isDisabled={processorPendingReveal}
|
isDisabled={processorPendingReveal}
|
||||||
onChange={async () => await toggleFaceLandmarkEffect('glasses')}
|
onChange={async () =>
|
||||||
|
await toggleFaceLandmarkEffect('glasses')
|
||||||
|
}
|
||||||
isSelected={getFaceLandmarksOptions().showGlasses}
|
isSelected={getFaceLandmarksOptions().showGlasses}
|
||||||
data-attr="toggle-glasses"
|
data-attr="toggle-glasses"
|
||||||
>
|
>
|
||||||
@@ -380,7 +392,9 @@ export const EffectsConfiguration = ({
|
|||||||
showFrench: true,
|
showFrench: true,
|
||||||
})}
|
})}
|
||||||
isDisabled={processorPendingReveal}
|
isDisabled={processorPendingReveal}
|
||||||
onChange={async () => await toggleFaceLandmarkEffect('french')}
|
onChange={async () =>
|
||||||
|
await toggleFaceLandmarkEffect('french')
|
||||||
|
}
|
||||||
isSelected={getFaceLandmarksOptions().showFrench}
|
isSelected={getFaceLandmarksOptions().showFrench}
|
||||||
data-attr="toggle-french"
|
data-attr="toggle-french"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user