From 992c763173919a73d936b6d66c4316232c1cc5d1 Mon Sep 17 00:00:00 2001 From: Yuri Mikhin Date: Wed, 27 Sep 2023 11:03:55 +0300 Subject: [PATCH] fixup! Rename bg part to api. --- manifest.json | 2 +- .../payload/build-pair-selection-payload.ts | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/manifest.json b/manifest.json index 3e3fe9e..9ea24e6 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "Polychrom", "id": "1281280685402026529", "api": "1.0.0", - "main": "dist/bg.js", + "main": "dist/api.js", "ui": "dist/index.html", "editorType": ["figma"], "networkAccess": { diff --git a/src/api/services/payload/build-pair-selection-payload.ts b/src/api/services/payload/build-pair-selection-payload.ts index 9bda250..0974b8f 100644 --- a/src/api/services/payload/build-pair-selection-payload.ts +++ b/src/api/services/payload/build-pair-selection-payload.ts @@ -1,8 +1,7 @@ import { buildColorsPair } from '~api/services/colors/build-colors-pair.ts'; -import { blendLayersColors } from '~api/services/figma/blend/blend-layers-colors.ts'; +import { getComputedNodeFill } from '~api/services/colors/get-computed-node-fill.ts'; import { createFigmaNode } from '~api/services/figma/nodes/create-figma-node.ts'; import { sortNodesByLayers } from '~api/services/figma/nodes/sort-nodes-by-layers.ts'; -import { isLayerHasTransparency } from '~api/services/figma/visibility/is-layer-has-transparency.ts'; import { buildEmptyPayload } from '~api/services/payload/build-empty-payload.ts'; import { type SelectionChangeMessage } from '~types/messages.ts'; import { getFirstVisibleNodeFill } from '~utils/figma/get-first-visible-node-fill.ts'; @@ -20,15 +19,7 @@ export const buildPairSelectionPayload = ( if (!notEmpty(fg) || !notEmpty(bg)) return buildEmptyPayload(); - const isFgHasTransparency = isLayerHasTransparency(fg); - - let fgFill; - - if (isFgHasTransparency) { - fgFill = blendLayersColors([fg]); - } else { - fgFill = getFirstVisibleNodeFill(fg.fills); - } + const fgFill = getComputedNodeFill(fg); const bgFill = getFirstVisibleNodeFill(bg.fills);