UNPKG

advanced-cropper

Version:

The core of the advanced cropper libraries family

20 lines (15 loc) 685 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); require('tslib'); var helpers = require('../service/helpers.js'); require('../types/index.js'); require('../state/setCoordinates.js'); function defaultPosition(state) { var visibleArea = state.visibleArea, coordinates = state.coordinates; var area = visibleArea || helpers.getTransformedImageSize(state); return { left: (visibleArea ? visibleArea.left : 0) + area.width / 2 - (coordinates ? coordinates.width / 2 : 0), top: (visibleArea ? visibleArea.top : 0) + area.height / 2 - (coordinates ? coordinates.height / 2 : 0), }; } exports.defaultPosition = defaultPosition;