pixso.fieldset
pixso.fieldset
is the frame tool, which differs from other brush tools applied by Pixso in that it does not draw on the canvas to generate a substantial layer, but with the following apis of the Frame tool, it can be used to achieve some complex custom interactions on the plugin.
name
- type:
string
You can get or modify the name displayed by the frame tool button (only custom names can be obtained, not default names).
setIcon
- type:
setIcon(icon: string | Uint8Array): void
The icon displayed by the Frame tool button can be modified.
strokeColor
- type:
{r: number, g: number, b: number, a: number}
You can get or modify the border color drawn by the Frame tool.
strokeWeight
- type:
number
You can get or modify the thickness of the border drawn by the Frame tool.
dashPattern
- type:
ReadonlyArray<number>
You can get or modify the length of the border dash and gap drawn by the Frame tool.
enable
- type:
enable(): void
The Brush Tool button is displayed in the top toolbar of Pixso, but is hidden by default. To use the brush tool, first execute pixso.fieldset.enable()
to show the function.
disable
- type:
disable(): void
Once the brush tool button is displayed through pixso.fieldset.enable()
the function can be hidden by executing pixso.fieldset.disable()
as needed.
remove
- type:
remove(): void
Actively remove the border drawn by the Frame tool.
on
on(type: "drawstart", callback: () => void): void;
on(type: "drawend", callback: (event: FieldsetEvent) => void): void;
on(type: "move", callback: (event: FieldsetEvent) => void): void;
on(type: "disappear", callback: () => void): void;
The on
method allows you to register a handler function for a specific event in the frame tool that executes the callback function when an event occurs. The event type is as follows:
drawstart
: Use the Frame Tool to start drawing a border or re-stretch the drawn border.drawend
:Use the Frame Tool to end drawing borders or end stretching drawn borders.move
: Drag and drop the border drawn using the Frame tool.disappear
: Removes the border drawn by the Frame Tool from the canvas.
once
once(type: "drawstart", callback: () => void): void;
once(type: "drawend", callback: (event: FieldsetEvent) => void): void;
once(type: "move", callback: (event: FieldsetEvent) => void): void;
once(type: "disappear", callback: () => void): void;
The once
method allows you to register a handler for a specific event in the frame tool and execute the callback when the event occurs. The difference with the on
method is that event handlers registered with the once
method are executed only once.
off
off(type: "drawstart", callback: () => void): void;
off(type: "drawend", callback: (event: FieldsetEvent) => void): void;
off(type: "move", callback: (event: FieldsetEvent) => void): void;
off(type: "disappear", callback: () => void): void;
Removes event handlers bound by pixso.fieldset.on
or pixso.fieldset.once
.