ly525/luban-h5

[Bug Report] 背景组件的辅助线位置错误

kevinhwu opened this issue · 0 comments

问题描述
背景组件(lbp-background)的辅助线位置错误。

追踪到下面的代码中,获取到的背景尺寸是错误的。

calcVHLine (isPointMove) {
      const uuid = this.editingElement.uuid
      const referElements = this.elements.filter(e => e.uuid !== uuid)
      let referElementsXCoords = []
      let referElementsYCoords = []
      referElements.forEach(e => {
        const width = e.commonStyle.width // 读到的背景宽度是100,实际是320,下面几行读到的都是错误的。
        const left = e.commonStyle.left
        const height = e.commonStyle.height
        const top = e.commonStyle.top

        referElementsXCoords = [
          ...referElementsXCoords,
          left,
          left + (width / 2),
          left + width
        ]
        referElementsYCoords = [
          ...referElementsYCoords,
          top,
          top + (height / 2),
          top + height
        ]
      })

环境描述/版本信息 (请完成如下信息)

  • OS: windows
  • Browser: chrome
  • 本地开发版本最近版本(2021/9/21)

如何复现
复现步骤

  1. 编辑一个页面,添加一个组件
  2. 在背景上拖动组件,显示辅助线

预期结果

背景辅助线位置应该正确