Comparing version 1.6.1 to 1.6.2
@@ -15,2 +15,3 @@ "use strict"; | ||
var d3 = require("d3"); | ||
var _ = require("lodash"); | ||
var default_1 = /** @class */ (function (_super) { | ||
@@ -40,2 +41,7 @@ __extends(default_1, _super); | ||
.attr('cy', function (d) { return _this.PROJECTION(_this.BUILDER.getPoint(d.properties.name))[1] - 12; }); | ||
group.selectAll('g._ext') | ||
.attr('style', function (d) { | ||
var tran = _this.PROJECTION(d.pos); | ||
return "transform:translate(" + tran[0] + "px," + tran[1] + "px)"; | ||
}); | ||
}; | ||
@@ -53,31 +59,3 @@ default_1.prototype.setData = function (group, data) { | ||
AREAS.append('path') | ||
.attr('d', path) | ||
.on('click', function (d) { | ||
if (_this.props.onSelected) { | ||
var selected = group.select('#area-' + d.properties.id).classed('_item_area_selected'); | ||
if (selected) { | ||
group.selectAll('g._item_area_selected').classed('_item_area_selected', false).select('circle').remove(); | ||
_this.CurrentArea = ''; | ||
} | ||
else { | ||
group.selectAll('g._item_area_selected').classed('_item_area_selected', false).select('circle').remove(); | ||
_this.CurrentArea = d.properties.name; | ||
var areaContainer = group.select('#area-' + d.properties.id).classed('_item_area_selected', true); | ||
areaContainer.append('circle') | ||
.attr('class', '_area_select_point') | ||
.attr('cx', function (d) { return _this.PROJECTION(_this.BUILDER.getPoint(d.properties.name))[0]; }) | ||
.attr('cy', function (d) { return _this.PROJECTION(_this.BUILDER.getPoint(d.properties.name))[1] - 12; }) | ||
.attr('r', 10) | ||
.append('animate') | ||
.attr('attributeName', 'r') | ||
.attr('attributeType', 'xml') | ||
.attr('form', 10) | ||
.attr('to', 25) | ||
.attr('begin', '0s') | ||
.attr('dur', '1s') | ||
.attr('repeatCount', 'indefinite'); | ||
} | ||
_this.props.onSelected.call(null, _this.CurrentArea); | ||
} | ||
}); | ||
.attr('d', path); | ||
AREAS.append('text') | ||
@@ -92,3 +70,77 @@ .attr('x', function (d) { | ||
}) | ||
.text(function (d) { return d.properties.name; }); | ||
.text(function (d) { return _this.props.nameFormat ? _this.props.nameFormat(d.properties.name) : d.properties.name; }); | ||
if (_.isArray(this.props.extIcons) && this.props.extIcons.length > 0) { | ||
console.log(this.props.extIcons); | ||
} | ||
var exts = group.selectAll('g._ext') | ||
.data(this.props.extIcons) | ||
.enter() | ||
.append('g') | ||
.attr('class', function (d, i) { return "_ext _ext_" + i + " " + (d.className ? d.className : ''); }) | ||
.attr('style', function (d) { | ||
var tran = _this.PROJECTION(d.pos); | ||
return "transform:translate(" + tran[0] + "px," + tran[1] + "px)"; | ||
}) | ||
.attr('id', function (d) { return "area-" + d.name; }); | ||
exts.append('path') | ||
.attr('d', function (d) { return d.icon; }); | ||
exts.append('text') | ||
.text(function (d) { return _this.props.nameFormat ? _this.props.nameFormat(d.name) : d.name; }) | ||
.attr('x', 12) | ||
.attr('y', 4); | ||
if (!_.isFunction(this.props.onSelected)) { | ||
return; | ||
} | ||
AREAS.on('click', function (d) { | ||
var selected = group.select('#area-' + d.properties.id).classed('_item_area_selected'); | ||
if (selected) { | ||
group.selectAll('g._item_area_selected').classed('_item_area_selected', false).select('circle').remove(); | ||
_this.CurrentArea = ''; | ||
} | ||
else { | ||
group.selectAll('g._item_area_selected').classed('_item_area_selected', false).select('circle').remove(); | ||
_this.CurrentArea = d.properties.name; | ||
var areaContainer = group.select('#area-' + d.properties.id).classed('_item_area_selected', true); | ||
areaContainer.append('circle') | ||
.attr('class', '_area_select_point') | ||
.attr('cx', function (d) { return _this.PROJECTION(_this.BUILDER.getPoint(d.properties.name))[0]; }) | ||
.attr('cy', function (d) { return _this.PROJECTION(_this.BUILDER.getPoint(d.properties.name))[1] - 12; }) | ||
.attr('r', 10) | ||
.append('animate') | ||
.attr('attributeName', 'r') | ||
.attr('attributeType', 'xml') | ||
.attr('form', 10) | ||
.attr('to', 25) | ||
.attr('begin', '0s') | ||
.attr('dur', '1s') | ||
.attr('repeatCount', 'indefinite'); | ||
} | ||
_this.props.onSelected.call(null, _this.CurrentArea); | ||
}); | ||
exts.on('click', function (d) { | ||
var selected = group.select('#area-' + d.name).classed('_item_area_selected'); | ||
if (selected) { | ||
group.selectAll('g._item_area_selected').classed('_item_area_selected', false).select('circle').remove(); | ||
_this.CurrentArea = ''; | ||
} | ||
else { | ||
group.selectAll('g._item_area_selected').classed('_item_area_selected', false).select('circle').remove(); | ||
_this.CurrentArea = d.name; | ||
var areaContainer = group.select('#area-' + d.name).classed('_item_area_selected', true); | ||
areaContainer.append('circle') | ||
.attr('class', '_area_select_point') | ||
.attr('cx', 0) | ||
.attr('cy', 0) | ||
.attr('r', 10) | ||
.append('animate') | ||
.attr('attributeName', 'r') | ||
.attr('attributeType', 'xml') | ||
.attr('form', 10) | ||
.attr('to', 25) | ||
.attr('begin', '0s') | ||
.attr('dur', '1s') | ||
.attr('repeatCount', 'indefinite'); | ||
} | ||
_this.props.onSelected.call(null, _this.CurrentArea); | ||
}); | ||
}; | ||
@@ -95,0 +147,0 @@ return default_1; |
{ | ||
"name": "vap", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"description": "vap", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
304402
7870