react-simple-maps
Advanced tools
Comparing version 0.11.2 to 0.12.0
@@ -67,3 +67,6 @@ "use strict"; | ||
var isHidden = (0, _d3Geo.geoLength)(lineString) > 1.5708; | ||
var radians = Math.PI / 2, | ||
degrees = 90; | ||
var isGlobe = projection.clipAngle() === degrees; | ||
var isHidden = isGlobe && (0, _d3Geo.geoLength)(lineString) > radians; | ||
@@ -70,0 +73,0 @@ return _react2.default.createElement( |
@@ -7,3 +7,3 @@ "use strict"; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
@@ -14,56 +14,28 @@ var _react = require("react"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _MapGroup = require("./MapGroup"); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var _MapGroup2 = _interopRequireDefault(_MapGroup); | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var Annotations = function (_Component) { | ||
_inherits(Annotations, _Component); | ||
var Annotations = function Annotations(_ref) { | ||
var groupName = _ref.groupName, | ||
itemName = _ref.itemName, | ||
componentIdentifier = _ref.componentIdentifier, | ||
restProps = _objectWithoutProperties(_ref, ["groupName", "itemName", "componentIdentifier"]); | ||
function Annotations() { | ||
_classCallCheck(this, Annotations); | ||
return _react2.default.createElement(_MapGroup2.default, _extends({ | ||
groupName: groupName, | ||
itemName: itemName | ||
}, restProps)); | ||
}; | ||
return _possibleConstructorReturn(this, (Annotations.__proto__ || Object.getPrototypeOf(Annotations)).apply(this, arguments)); | ||
} | ||
_createClass(Annotations, [{ | ||
key: "render", | ||
value: function render() { | ||
var _props = this.props, | ||
children = _props.children, | ||
projection = _props.projection, | ||
style = _props.style, | ||
width = _props.width, | ||
height = _props.height; | ||
return _react2.default.createElement( | ||
"g", | ||
{ className: "rsm-annotations", style: style }, | ||
!children ? null : children.length === undefined ? _react2.default.cloneElement(children, { | ||
projection: projection, | ||
width: width, | ||
height: height | ||
}) : children.map(function (child, i) { | ||
return !child ? null : _react2.default.cloneElement(child, { | ||
key: child.key || "annotation-" + i, | ||
projection: projection, | ||
width: width, | ||
height: height | ||
}); | ||
}) | ||
); | ||
} | ||
}]); | ||
return Annotations; | ||
}(_react.Component); | ||
Annotations.defaultProps = { | ||
componentIdentifier: "Annotations" | ||
componentIdentifier: "Annotations", | ||
groupName: "annotations", | ||
itemName: "annotation" | ||
}; | ||
exports.default = Annotations; |
@@ -70,2 +70,29 @@ "use strict"; | ||
var _Line = require("./Line"); | ||
Object.defineProperty(exports, "Line", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_Line).default; | ||
} | ||
}); | ||
var _Lines = require("./Lines"); | ||
Object.defineProperty(exports, "Lines", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_Lines).default; | ||
} | ||
}); | ||
var _MapGroup = require("./MapGroup"); | ||
Object.defineProperty(exports, "MapGroup", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_MapGroup).default; | ||
} | ||
}); | ||
var _Annotation = require("./Annotation"); | ||
@@ -72,0 +99,0 @@ |
@@ -189,3 +189,6 @@ "use strict"; | ||
var isHidden = (0, _d3Geo.geoLength)(lineString) > 1.5708; | ||
var radians = Math.PI / 2, | ||
degrees = 90; | ||
var isGlobe = projection.clipAngle() === degrees; | ||
var isHidden = isGlobe && (0, _d3Geo.geoLength)(lineString) > radians; | ||
@@ -192,0 +195,0 @@ return _react2.default.createElement( |
@@ -7,3 +7,3 @@ "use strict"; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
@@ -14,58 +14,28 @@ var _react = require("react"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _MapGroup = require("./MapGroup"); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var _MapGroup2 = _interopRequireDefault(_MapGroup); | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var Markers = function (_Component) { | ||
_inherits(Markers, _Component); | ||
var Markers = function Markers(_ref) { | ||
var groupName = _ref.groupName, | ||
itemName = _ref.itemName, | ||
componentIdentifier = _ref.componentIdentifier, | ||
restProps = _objectWithoutProperties(_ref, ["groupName", "itemName", "componentIdentifier"]); | ||
function Markers() { | ||
_classCallCheck(this, Markers); | ||
return _react2.default.createElement(_MapGroup2.default, _extends({ | ||
groupName: groupName, | ||
itemName: itemName | ||
}, restProps)); | ||
}; | ||
return _possibleConstructorReturn(this, (Markers.__proto__ || Object.getPrototypeOf(Markers)).apply(this, arguments)); | ||
} | ||
_createClass(Markers, [{ | ||
key: "render", | ||
value: function render() { | ||
var _props = this.props, | ||
children = _props.children, | ||
projection = _props.projection, | ||
style = _props.style, | ||
zoom = _props.zoom, | ||
width = _props.width, | ||
height = _props.height; | ||
return _react2.default.createElement( | ||
"g", | ||
{ className: "rsm-markers", style: style }, | ||
!children ? null : children.length === undefined ? _react2.default.cloneElement(children, { | ||
projection: projection, | ||
zoom: zoom, | ||
width: width, | ||
height: height | ||
}) : children.map(function (child, i) { | ||
return !child ? null : _react2.default.cloneElement(child, { | ||
key: child.key || "marker-" + i, | ||
projection: projection, | ||
zoom: zoom, | ||
width: width, | ||
height: height | ||
}); | ||
}) | ||
); | ||
} | ||
}]); | ||
return Markers; | ||
}(_react.Component); | ||
Markers.defaultProps = { | ||
componentIdentifier: "Markers" | ||
componentIdentifier: "Markers", | ||
groupName: "markers", | ||
itemName: "marker" | ||
}; | ||
exports.default = Markers; |
@@ -41,4 +41,4 @@ "use strict"; | ||
function isChildOfType(child, expectedType) { | ||
return child.props.componentIdentifier === expectedType; | ||
function isChildOfType(child, expectedTypes) { | ||
return expectedTypes.indexOf(child.props.componentIdentifier) !== -1; | ||
} | ||
@@ -49,9 +49,11 @@ | ||
if (!children.length) { | ||
return isChildOfType(children, "Geographies") ? _react2.default.cloneElement(children, { | ||
return isChildOfType(children, ["Geographies"]) ? _react2.default.cloneElement(children, { | ||
projection: props.projection | ||
}) : isChildOfType(children, "Markers") || isChildOfType(children, "Annotations") || isChildOfType(children, "Annotation") || isChildOfType(child, "Graticule") ? _react2.default.cloneElement(children, { | ||
}) : isChildOfType(children, ["Group", "Markers", "Lines", "Annotations", "Annotation", "Graticule"]) ? _react2.default.cloneElement(children, { | ||
projection: props.projection, | ||
zoom: props.zoom, | ||
width: props.width, | ||
height: props.height | ||
height: props.height, | ||
groupName: props.groupName, | ||
itemName: props.itemName | ||
}) : children; | ||
@@ -61,6 +63,6 @@ } else { | ||
if (!child) return; | ||
return isChildOfType(child, "Geographies") ? _react2.default.cloneElement(child, { | ||
return isChildOfType(child, ["Geographies"]) ? _react2.default.cloneElement(child, { | ||
key: "zoomable-child-" + i, | ||
projection: props.projection | ||
}) : isChildOfType(child, "Markers") || isChildOfType(child, "Annotations") || isChildOfType(child, "Annotation") || isChildOfType(child, "Graticule") ? _react2.default.cloneElement(child, { | ||
}) : isChildOfType(child, ["Group", "Markers", "Lines", "Annotations", "Annotation", "Graticule"]) ? _react2.default.cloneElement(child, { | ||
key: "zoomable-child-" + i, | ||
@@ -70,3 +72,5 @@ projection: props.projection, | ||
width: props.width, | ||
height: props.height | ||
height: props.height, | ||
groupName: props.groupName, | ||
itemName: props.itemName | ||
}) : child; | ||
@@ -73,0 +77,0 @@ }); |
{ | ||
"name": "react-simple-maps", | ||
"version": "0.11.2", | ||
"version": "0.12.0", | ||
"description": "An svg map component built with and for React", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
111892
22
1946