text: import jQuery from 'jquery'
  
  export default class MapObject {
    constructor (config) {
      this.config = config
    }
  
    getLabelText (key) {
      var text
  
      if (this.config.label) {
        if (typeof this.config.label.render === 'function') {
          text = this.config.label.render(key)
        } else {
          text = key
        }
      } else {
        text = null
      }
      return text
    }
  
    getLabelOffsets (key) {
      var offsets
  
      if (this.config.label) {
        if (typeof this.config.label.offsets === 'function') {
          offsets = this.config.label.offsets(key)
        } else if (typeof this.config.label.offsets === 'object') {
          offsets = this.config.label.offsets[key]
        }
      }
      return offsets || [0, 0]
    }
  
    /**
     * Set hovered state to the element. Hovered state means mouse cursor is over element. Styles will be updates respectively.
     * @param {Boolean} isHovered <code>true</code> to make element hovered, <code>false</code> otherwise.
     */
    setHovered (isHovered) {
      if (this.isHovered !== isHovered) {
        this.isHovered = isHovered
        this.shape.isHovered = isHovered
        this.shape.updateStyle()
        if (this.label) {
          this.label.isHovered = isHovered
          this.label.updateStyle()
        }
      }
    }
  
    /**
     * Set selected state to the element. Styles will be updates respectively.
     * @param {Boolean} isSelected <code>true</code> to make element selected, <code>false</code> otherwise.
     */
    setSelected (isSelected) {
      if (this.isSelected !== isSelected) {
        this.isSelected = isSelected
        this.shape.isSelected = isSelected
        this.shape.updateStyle()
        if (this.label) {
          this.label.isSelected = isSelected
          this.label.updateStyle()
        }
        jQuery(this.shape).trigger('selected', [isSelected])
      }
    }
  
    setStyle () {
      this.shape.setStyle.apply(this.shape, arguments)
    }
  
    remove () {
      this.shape.remove()
      if (this.label) {
        this.label.remove()
      }
    }
  }
  