chore: extract MASK_POS
closes MTQ-43
This commit is contained in:
parent
74f3d53448
commit
31b41c93fc
3 changed files with 17 additions and 17 deletions
|
@ -1,12 +1,11 @@
|
|||
import { TelegramClient } from '../../client'
|
||||
import { InputStickerSet, InputStickerSetItem, normalizeInputStickerSet, StickerSet } from '../../types'
|
||||
|
||||
const MASK_POS = {
|
||||
forehead: 0,
|
||||
eyes: 1,
|
||||
mouth: 2,
|
||||
chin: 3,
|
||||
} as const
|
||||
import {
|
||||
InputStickerSet,
|
||||
InputStickerSetItem,
|
||||
MASK_POSITION_POINT_TO_TL,
|
||||
normalizeInputStickerSet,
|
||||
StickerSet,
|
||||
} from '../../types'
|
||||
|
||||
/**
|
||||
* Add a sticker to a sticker set.
|
||||
|
@ -44,7 +43,7 @@ export async function addStickerToSet(
|
|||
maskCoords: sticker.maskPosition ?
|
||||
{
|
||||
_: 'maskCoords',
|
||||
n: MASK_POS[sticker.maskPosition.point],
|
||||
n: MASK_POSITION_POINT_TO_TL[sticker.maskPosition.point],
|
||||
x: sticker.maskPosition.x,
|
||||
y: sticker.maskPosition.y,
|
||||
zoom: sticker.maskPosition.scale,
|
||||
|
|
|
@ -5,19 +5,13 @@ import {
|
|||
InputFileLike,
|
||||
InputPeerLike,
|
||||
InputStickerSetItem,
|
||||
MASK_POSITION_POINT_TO_TL,
|
||||
StickerSet,
|
||||
StickerSourceType,
|
||||
StickerType,
|
||||
} from '../../types'
|
||||
import { normalizeToInputUser } from '../../utils/peer-utils'
|
||||
|
||||
const MASK_POS = {
|
||||
forehead: 0,
|
||||
eyes: 1,
|
||||
mouth: 2,
|
||||
chin: 3,
|
||||
} as const
|
||||
|
||||
/**
|
||||
* Create a new sticker set.
|
||||
*
|
||||
|
@ -117,7 +111,7 @@ export async function createStickerSet(
|
|||
maskCoords: sticker.maskPosition ?
|
||||
{
|
||||
_: 'maskCoords',
|
||||
n: MASK_POS[sticker.maskPosition.point],
|
||||
n: MASK_POSITION_POINT_TO_TL[sticker.maskPosition.point],
|
||||
x: sticker.maskPosition.x,
|
||||
y: sticker.maskPosition.y,
|
||||
zoom: sticker.maskPosition.scale,
|
||||
|
|
|
@ -6,6 +6,13 @@ import { makeInspectable } from '../../utils'
|
|||
import { StickerSet } from '../misc'
|
||||
import { RawDocument } from './document'
|
||||
|
||||
export const MASK_POSITION_POINT_TO_TL = {
|
||||
forehead: 0,
|
||||
eyes: 1,
|
||||
mouth: 2,
|
||||
chin: 3,
|
||||
} as const
|
||||
|
||||
export interface MaskPosition {
|
||||
/**
|
||||
* The part of the face relative where the mask should be placed
|
||||
|
|
Loading…
Reference in a new issue