【问题标题】:photoeditorsdk force crop in photo editorphotoeditorsdk 在照片编辑器中强制裁剪
【发布时间】:2018-02-23 13:10:53
【问题描述】:

我正在尝试在编辑器加载之前使用强制裁剪。我尝试使用文档中给出的示例,但它会引发错误,提示 Could not find control with identifier crop

此外,它不适用于 DesktopUI。只有在我使用 ReactUI 时才会调用它。

【问题讨论】:

    标签: photoeditorsdk


    【解决方案1】:

    标识符为transform

    forceControls: [
      {
        control: "transform",
        options: {
          ratios: [
            {
              identifier: 'imgly_transform_common_9-16', // custom crop
              defaultName: '9:16',
              ratio: 9 / 16,
              dimensions: new this.PhotoEditorSDK.Math.Vector2(720, 1280),
              selected: true
            },
          ]
        }
      }
    ]
    

    【讨论】:

      【解决方案2】:
      editor: {
          controlsOptions: {
            transform: {
              ratios: [
                {
                  name: 'your_custom_dimension_name',
                  ratio: 3 / 1,
                  defaultName: "3:1",
                  dimensions: new PhotoEditorSDK.Math.Vector2(600, 200)
                }
              ],
              replaceRatios: false
            }
          }
        }
      

      将此代码添加到编辑器对象中,然后它将正常工作。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-10-07
        • 2013-01-08
        • 2015-03-18
        • 1970-01-01
        相关资源
        最近更新 更多