From 6fcfb7c04d32e1c8b26a312295bf7ac3ec2d2ad7 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Fri, 13 Jul 2018 19:06:45 +0200 Subject: Fixed many permissions and began admin interface --- public/bower_components/jvectormap/src/region.js | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 public/bower_components/jvectormap/src/region.js (limited to 'public/bower_components/jvectormap/src/region.js') diff --git a/public/bower_components/jvectormap/src/region.js b/public/bower_components/jvectormap/src/region.js new file mode 100644 index 0000000..9ed9855 --- /dev/null +++ b/public/bower_components/jvectormap/src/region.js @@ -0,0 +1,45 @@ +jvm.Region = function(config){ + var bbox, + text, + offsets, + labelDx, + labelDy; + + this.config = config; + this.map = this.config.map; + + this.shape = config.canvas.addPath({ + d: config.path, + 'data-code': config.code + }, config.style, config.canvas.rootElement); + this.shape.addClass('jvectormap-region jvectormap-element'); + + bbox = this.shape.getBBox(); + + text = this.getLabelText(config.code); + if (this.config.label && text) { + offsets = this.getLabelOffsets(config.code); + this.labelX = bbox.x + bbox.width / 2 + offsets[0]; + this.labelY = bbox.y + bbox.height / 2 + offsets[1]; + this.label = config.canvas.addText({ + text: text, + 'text-anchor': 'middle', + 'alignment-baseline': 'central', + x: this.labelX, + y: this.labelY, + 'data-code': config.code + }, config.labelStyle, config.labelsGroup); + this.label.addClass('jvectormap-region jvectormap-element'); + } +}; + +jvm.inherits(jvm.Region, jvm.MapObject); + +jvm.Region.prototype.updateLabelPosition = function(){ + if (this.label) { + this.label.set({ + x: this.labelX * this.map.scale + this.map.transX * this.map.scale, + y: this.labelY * this.map.scale + this.map.transY * this.map.scale + }); + } +}; \ No newline at end of file -- cgit v1.2.3