xlfsummer / mp-painter

声明式地创建适用于 uniapp, 原生微信小程序和原生H5的 canvas 海报

Home Page:https://mp-painter.xlf-summer.cn/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

在 left:0 和 top:0 的情况下,图片类型渲染 objectFit: 'cover' 异常

auven opened this issue · comments

问题描述

使用版本 1.0.0-beta.1

复现步骤

链接

{
  "type": "container",
  "direction": "vertical",
  "top": 0,
  "left": 0,
  "children": [
    {
      "type": "image",
      "src": "/static/demo.png",
      "width": 200,
      "height": 300,
      "top": 0,
      "left": 0,
      "objectFit": "cover",
      "objectPosition": [
        "center",
        "top"
      ]
    }
  ]
}

要给 top 和 left 设置大于0才正常,如下两种情况都可以

链接

{
  "type": "container",
  "direction": "vertical",
  "top": 0.01,
  "left": 0.01,
  "children": [
    {
      "type": "image",
      "src": "/static/demo.png",
      "width": 200,
      "height": 300,
      "top": 0,
      "left": 0,
      "objectFit": "cover",
      "objectPosition": [
        "center",
        "top"
      ]
    }
  ]
}

链接

{
  "type": "container",
  "direction": "vertical",
  "top": 0,
  "left": 0,
  "children": [
    {
      "type": "image",
      "src": "/static/demo.png",
      "width": 200,
      "height": 300,
      "top": 0.01,
      "left": 0.01,
      "objectFit": "cover",
      "objectPosition": [
        "center",
        "top"
      ]
    }
  ]
}

小程序和H5端都会。