Update script.js

fix use elements sizing
This commit is contained in:
Azgaar 2018-12-06 01:22:56 +03:00 committed by GitHub
parent 168cb3cdab
commit 1087930e11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6643,11 +6643,16 @@ function fantasyMap() {
} }
// to fix use elements sizing // to fix use elements sizing
clone.selectAll("use").each(function() { clone.select("#icons").selectAll("use").each(function() {
const size = this.parentNode.getAttribute("size") || 1; const size = this.parentNode.getAttribute("size") || 1;
this.setAttribute("width", size + "px"); this.setAttribute("width", size + "px");
this.setAttribute("height", size + "px"); this.setAttribute("height", size + "px");
}); });
clone.select("#terrain").selectAll("use").each(function() {
const size = this.getAttribute("width") || 1;
this.setAttribute("width", size + "px");
this.setAttribute("height", size + "px");
});
// clean attributes // clean attributes
//clone.selectAll("*").each(function() { //clone.selectAll("*").each(function() {