"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _MapContext = require("../modules/MapContext");
var _themed = require("@rneui/themed");
var _config = require("../config");
var _MSlot = _interopRequireDefault(require("./slots/MSlot"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
// import Icon from 'react-native-vector-icons/FontAwesome';
// import Icon from 'react-native-vector-icons/Ionicons';

/**
 * ZoomInOut props
 *
 * @category Props
 */

/**
 * 地图放大、缩小组件
 *
 * @category Component
 */
const ZoomInOut = props => {
  const {
    style = 'right'
  } = props;
  const {
    map
  } = (0, _react.useContext)(_MapContext.MapContext);
  const onZoomIn = () => {
    // console.log('onZoomIn', map);
    map.zoomTo(_config.zoomStep);
  };
  const onZoomOut = () => {
    map.zoomTo(-_config.zoomStep);
  };

  // 显示位置可通过插槽扩展灵活适配
  /**
   * <MapSlot postion="right-top" style={customStyle}>
   * {{ children }}
   * </MapSlot>
   */

  return /*#__PURE__*/_react.default.createElement(_MSlot.default, {
    style: style
  }, /*#__PURE__*/_react.default.createElement(_reactNative.View, null, /*#__PURE__*/_react.default.createElement(_themed.Button, {
    type: "outline",
    style: styles.button,
    size: "md",
    onPress: onZoomIn
  }, /*#__PURE__*/_react.default.createElement(_themed.Icon, {
    name: "plus",
    type: 'antdesign',
    size: _config.buttonSize,
    color: "#000"
  })), /*#__PURE__*/_react.default.createElement(_themed.Button, {
    type: "outline",
    style: styles.button,
    size: "md",
    onPress: onZoomOut
  }, /*#__PURE__*/_react.default.createElement(_themed.Icon, {
    name: "minus",
    type: 'antdesign',
    size: _config.buttonSize,
    color: "#000"
  }))));
};
var _default = exports.default = ZoomInOut;
const styles = _reactNative.StyleSheet.create({
  container: {
    position: 'absolute',
    right: 5,
    top: 5
  },
  button: {
    backgroundColor: '#fff',
    marginBottom: 3
  }
});
//# sourceMappingURL=ZoomInOut.js.map