-var AnimateMarkerLayer_class,AnimateMarkerLayer_class2,AnimateMarkerLayer_temp;var initialState={marker:null,_markersElement:[]};var AnimateMarkerLayer_AnimateMarkerLayer=mapGetter(AnimateMarkerLayer_class=(AnimateMarkerLayer_temp=AnimateMarkerLayer_class2=/*#__PURE__*/function(_Component){_inherits(AnimateMarkerLayer,_Component);function AnimateMarkerLayer(){var _getPrototypeOf2;var _this;_classCallCheck(this,AnimateMarkerLayer);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(AnimateMarkerLayer)).call.apply(_getPrototypeOf2,[this].concat(args)));_this.viewModel=void 0;_this.map=void 0;_this.marker=void 0;_this._markersElement=void 0;_this.state=initialState;return _this;}_createClass(AnimateMarkerLayer,[{key:"componentDidMount",value:function componentDidMount(){this.setState({_markersElement:[]});}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(this.viewModel&&!lodash_isequal_default()(prevProps.features,this.props.features)){this.setState({_markersElement:[]});this._getMarkerElement();this.props.features&&this.viewModel.setFeatures(this.props.features,this.state._markersElement);}if(this.viewModel&&!lodash_isequal_default()(prevProps.type,this.props.type)){this.setState({_markersElement:[]});this._getMarkerElement();this.viewModel.setType(this.state._markersElement);}if(this.viewModel&&this.props.width&&prevProps.width!==this.props.width){this.state.marker&&this.state.marker.setMarkersWidth(this.props.width);}if(this.viewModel&&this.props.height&&prevProps.height!==this.props.height){this.state.marker&&this.state.marker.setMarkersHeight&&this.state.marker.setMarkersHeight(this.props.height);}if(this.viewModel&&this.props.textColor&&prevProps.textColor!==this.props.textColor){this.state.marker&&this.state.marker.setMarkersTextColor(this.props.textColor);}if(this.viewModel&&this.props.textFontSize&&prevProps.textFontSize!==this.props.textFontSize){this.state.marker&&this.state.marker.setMarkersTextFontSize(this.props.textFontSize);}if(this.viewModel&&this.props.colors&&this.props.colors.length&&this.props.colors.length>0&&!lodash_isequal_default()(prevProps.colors,this.props.colors)){this.state.marker&&this.state.marker.setMarkersTextFontSize(this.props.textFontSize);}if(this.viewModel&&this.props.textField&&prevProps.textField!==this.props.textField){this.state.marker&&this.state.marker.setMarkersTextField(this.props.textField);}}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.viewModel&&this.viewModel.clearMarkerLayer();}},{key:"loaded",value:function loaded(map){this.props.features&&this._getMarkerElement();this.viewModel=new AnimateMarkerLayerViewModel_AnimateMarkerLayerViewModel(map,this.props.features,this.state._markersElement,this.props.fitBounds);}},{key:"_getMarkerElement",value:function _getMarkerElement(){this.setState({marker:null});var _this$props=this.props,features=_this$props.features,width=_this$props.width,height=_this$props.height,colors=_this$props.colors,textFontSize=_this$props.textFontSize,textColor=_this$props.textColor,textField=_this$props.textField,type=_this$props.type;if(!features||JSON.stringify(features)==='{}'||!features.features){this.viewModel&&this.viewModel.clearMarkerLayer();return;}switch(type){case'rotatingAperture':this.setState({marker:new RotatingApertureMarker_RotatingApertureMarker(features,{width:width,colors:colors,textField:textField,textColor:textColor,textFontSize:textFontSize})});break;case'haloRing':this.setState({marker:new HaloRingMarker_HaloRingMarker(features,{width:width,colors:colors,textField:textField,textColor:textColor,textFontSize:textFontSize})});break;case'breathingAperture':this.setState({marker:new BreathingApertureMarker_BreathingApertureMarker(features,{width:width,colors:colors,textField:textField,textColor:textColor,textFontSize:textFontSize})});break;case'diffusedAperture':this.setState({marker:new DiffusedApertureMarker_DiffusedApertureMarker(features,{width:width,colors:colors,textField:textField,textColor:textColor,textFontSize:textFontSize})});break;case'rotatingTextBorder':this.setState({marker:new RotatingTextBorderMarker_RotatingTextBorderMarker(features,{width:width,height:height,colors:colors,textField:textField,textColor:textColor,textFontSize:textFontSize})});break;case'fluorescence':this.setState({marker:new FluorescenceMarker_FluorescenceMarker(features,{width:width,colors:colors,textField:textField,textColor:textColor,textFontSize:textFontSize})});break;}if(this.state.marker){this.setState({_markersElement:this.state.marker.getMarkersElement()});}}},{key:"render",value:function render(){return null;}}]);return AnimateMarkerLayer;}(external_root_React_commonjs_React_commonjs2_React_amd_React_["Component"]),AnimateMarkerLayer_class2.defaultProps={type:'breathingAperture',textFontSize:14},AnimateMarkerLayer_temp))||AnimateMarkerLayer_class;
0 commit comments