这显示了如何添加自定义裁剪,但我无法让它们显示出来: https://docs.photoeditorsdk.com/guides/html5/v4-DesktopUI/features/transform
我意识到有一个文档错误,其中的controlsOptions对象必须在编辑器对象中,但无论我把它放在哪里,自定义裁剪都不会出现。
编辑:通过反复试验,我发现这是正确的格式:
editor: {
controlsOptions: {
transform: {
categories: [
{
identifier: 'my_transform', // A unique identifier for this transform category
defaultName: 'My Transform', // The default translation for this transform category
ratios: [
{
identifier: 'my_custom_ratio', // A unique identifier for this ratio
defaultName: 'Custom Ratio', // The default translation for this ratio
ratio: 5 / 4, // The image ratio (a floating point number)
dimensions: new PhotoEditorSDK.Math.Vector2(50, 40) // Optional fixed
}]
}]
}
}
}