%PDF- %PDF-
Direktori : /home/medipszd/public_html/bower_components/jvectormap/src/ |
Current File : /home/medipszd/public_html/bower_components/jvectormap/src/map-object.js |
jvm.MapObject = function(config){}; jvm.MapObject.prototype.getLabelText = function(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; } jvm.MapObject.prototype.getLabelOffsets = function(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. */ jvm.MapObject.prototype.setHovered = function(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. */ jvm.MapObject.prototype.setSelected = function(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(); } jvm.$(this.shape).trigger('selected', [isSelected]); } }; jvm.MapObject.prototype.setStyle = function(){ this.shape.setStyle.apply(this.shape, arguments); }; jvm.MapObject.prototype.remove = function(){ this.shape.remove(); if (this.label) { this.label.remove(); } };