代码迁移

This commit is contained in:
zh
2025-07-03 13:54:01 +08:00
parent b04de8a084
commit 2a4da33e62
985 changed files with 358292 additions and 13 deletions

26
src/Obj/Element/svg.js Normal file
View File

@ -0,0 +1,26 @@
let list = ['icon-py', 'icon-edit', 'icon-add', 'icon-add2', 'icon-minus', 'icon-play', 'icon-pause', 'icon-updateheight', 'icon-draw', 'icon-positions', 'icon-reset', 'icon-xj', 'icon-yj', 'icon-zj', 'icon-close', 'icon-query', 'icon-route', 'icon-copy', 'icon-load', 'icon-rubric']
function setSvg() {
let svgElm = document.createElement('svg');
svgElm.xmlns = 'http://www.w3.org/2000/svg'
svgElm.style.width = 0
svgElm.style.height = 0
svgElm.style.position = 'absolute'
svgElm.style.overflow = 'hidden'
document.body.appendChild(svgElm)
const parser = new DOMParser()
for (let i = 0; i < list.length; i++) {
let name = list[i]
fetch(Cesium.buildModuleUrl(`../custom/img/${name}.svg`))
.then(r => r.text())
.then(b => {
const xmlDoc = parser.parseFromString(b, 'text/xml').getElementsByTagName('svg')[0]
if(xmlDoc) {
xmlDoc.id = 'yj-' + name
svgElm.appendChild(xmlDoc)
}
}
);
}
}
export { setSvg }