snapEdge()

in packages/core/src/models/SnapLine.ts [115:128]


  snapEdge(rect: Rect) {
    const threshold = TransformHelper.threshold
    if (this.direction === 'h') {
      if (Math.abs(this.start.y - rect.top) < threshold) return 'ht'
      if (Math.abs(this.start.y - (rect.top + rect.height / 2)) < threshold)
        return 'hc'
      if (Math.abs(this.start.y - rect.bottom) < threshold) return 'hb'
    } else {
      if (Math.abs(this.start.x - rect.left) < threshold) return 'vl'
      if (Math.abs(this.start.x - (rect.left + rect.width / 2)) < threshold)
        return 'vc'
      if (Math.abs(this.start.x - rect.right) < threshold) return 'vr'
    }
  }