rc-bmap
Version:
<p align="center"> <img src="https://bmap.jser-club.com/home.png" width="200px"> </p> <p align="center">基于 React 的百度地图组件</p>
26 lines (21 loc) • 675 B
JavaScript
import Util from '../utils';
import BMapUtil from '../utils/map';
const getSymbolOptions = config => ({
anchor: config.anchor && Util.convert2BSize(config.anchor),
fillColor: config.fillColor,
fillOpacity: config.fillOpacity,
scale: config.scale,
rotation: config.rotation,
strokeColor: config.strokeColor,
strokeOpacity: config.strokeOpacity,
strokeWeight: config.strokeWeight,
});
const processPath = path => (global[path] ? global[path] : path);
class Symbol {
constructor(config = {}) {
const options = getSymbolOptions(config);
const path = processPath(config.path);
return BMapUtil.BSymbol(path, options);
}
}
export default Symbol;