HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/shop.komma.nl/node_modules/@vue/cli-ui/src/mixins/OnGrid.js
export default function ({
  gridSize,
  field
}) {
  // @vue/component
  return {
    computed: {
      mainStyle () {
        if (this.moveState) {
          return {
            ...this.getPositionStyle(this.moveState.pxX, this.moveState.pxY),
            ...this.getSizeStyle()
          }
        }
        if (this.resizeState) {
          return {
            ...this.getPositionStyle(this.resizeState.pxX, this.resizeState.pxY),
            ...this.getSizeStyle(this.resizeState.pxWidth, this.resizeState.pxHeight)
          }
        }
        return {
          ...this.getPositionStyle(gridSize * this[field].x, gridSize * this[field].y),
          ...this.getSizeStyle()
        }
      },

      moveGhostStyle () {
        return {
          ...this.getPositionStyle(gridSize * this.moveState.x, gridSize * this.moveState.y),
          ...this.getSizeStyle()
        }
      },

      resizeGhostStyle () {
        return {
          ...this.getPositionStyle(gridSize * this.resizeState.x, gridSize * this.resizeState.y),
          ...this.getSizeStyle(gridSize * this.resizeState.width, gridSize * this.resizeState.height)
        }
      }
    },

    methods: {
      getPositionStyle (x, y) {
        return {
          left: `${x}px`,
          top: `${y}px`
        }
      },

      getSizeStyle (width, height) {
        return {
          width: `${width || gridSize * this[field].width}px`,
          height: `${height || gridSize * this[field].height}px`
        }
      }
    }
  }
}