refactor: isolate old and preview versions, add lint rule
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import type { ToolEntry } from "../registry";
|
||||
import { ToolError } from "../core/errors";
|
||||
import { field, toolSchema } from "../registry-schema";
|
||||
import {
|
||||
colorMask,
|
||||
extractAlphaMask,
|
||||
@@ -33,16 +32,6 @@ import {
|
||||
import type { Position9 } from "../core/textdraw";
|
||||
import { num, str } from "../registry-helpers";
|
||||
|
||||
interface AddStrokeParams {
|
||||
color: string;
|
||||
thickness: number;
|
||||
}
|
||||
|
||||
const addStrokeSchema = toolSchema<AddStrokeParams>({
|
||||
color: field.color({ default: "#ff0000" }),
|
||||
thickness: field.slider({ min: 1, max: 10, step: 1, default: 3 }),
|
||||
});
|
||||
|
||||
export function alphaEntries(): ToolEntry[] {
|
||||
return [
|
||||
{
|
||||
@@ -412,7 +401,6 @@ export function alphaEntries(): ToolEntry[] {
|
||||
description:
|
||||
"Adds a colored ring outline around the opaque content with the chosen thickness.",
|
||||
category: "alpha",
|
||||
schema: addStrokeSchema,
|
||||
params: [
|
||||
{
|
||||
id: "color",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { ToolEntry } from "../registry";
|
||||
import { ToolError } from "../core/errors";
|
||||
import { field, toolSchema } from "../registry-schema";
|
||||
import {
|
||||
crop,
|
||||
expandCanvas,
|
||||
@@ -25,16 +24,6 @@ import {
|
||||
} from "../core/affine";
|
||||
import { num, str } from "../registry-helpers";
|
||||
|
||||
interface AddBorderParams {
|
||||
thickness: number;
|
||||
color: string;
|
||||
}
|
||||
|
||||
const addBorderSchema = toolSchema<AddBorderParams>({
|
||||
thickness: field.number({ min: 1, max: 500, step: 1, default: 5 }),
|
||||
color: field.color({ default: "#000000" }),
|
||||
});
|
||||
|
||||
export function geometryEntries(): ToolEntry[] {
|
||||
return [
|
||||
{
|
||||
@@ -241,7 +230,6 @@ export function geometryEntries(): ToolEntry[] {
|
||||
description:
|
||||
"Draws a colored frame of the chosen thickness around the image.",
|
||||
category: "geometry",
|
||||
schema: addBorderSchema,
|
||||
params: [
|
||||
{
|
||||
id: "thickness",
|
||||
|
||||
Reference in New Issue
Block a user