'use strict';

Object.defineProperty(exports, "__esModule", {
	value: true
});

var _slider = require('antd/lib/slider');

var _slider2 = _interopRequireDefault(_slider);

var _extends2 = require('babel-runtime/helpers/extends');

var _extends3 = _interopRequireDefault(_extends2);

var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');

var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

require('antd/lib/slider/style');

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _ImgsCrop = require('./ImgsCrop');

var _ImgsCrop2 = _interopRequireDefault(_ImgsCrop);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Basic = function (_Component) {
	(0, _inherits3.default)(Basic, _Component);

	function Basic(props, context) {
		(0, _classCallCheck3.default)(this, Basic);

		var _this = (0, _possibleConstructorReturn3.default)(this, (Basic.__proto__ || Object.getPrototypeOf(Basic)).call(this, props, context));

		_this.handleScale = function (scale) {
			_this.setState({
				scale: scale
			});
		};

		_this.state = {
			scale: 1,
			rotate: 0
		};
		return _this;
	}

	(0, _createClass3.default)(Basic, [{
		key: 'render',
		value: function render() {
			var _this2 = this;

			var _state = this.state,
			    scale = _state.scale,
			    rotate = _state.rotate;
			var _props = this.props,
			    src = _props.src,
			    rest = (0, _objectWithoutProperties3.default)(_props, ['src']);

			return _react2.default.createElement(
				'div',
				null,
				_react2.default.createElement(_ImgsCrop2.default, (0, _extends3.default)({
					ref: function ref(instance) {
						return _this2.imgCrop = instance;
					},
					src: src,
					scale: scale,
					rotate: rotate
				}, rest)),
				_react2.default.createElement(_slider2.default, { onChange: this.handleScale, min: 0.3, max: 3, step: 0.01 })
			);
		}
	}]);
	return Basic;
}(_react.Component);

exports.default = Basic;