Files
lan-manager/web/node_modules/@antv/g-svg/esm/defs/pattern.js
openclaw 0a5f6a8047 Initial commit: Lan-manager project code
- Go backend (server/)
- Frontend (web/, server/static/)
- Database and deployment files
- Scripts and docs

Co-Authored-By: 狸花猫/Claude-Qwen3.6-Plus 🐾
2026-04-20 00:52:58 +08:00

48 lines
1.4 KiB
JavaScript

/**
* @fileoverview pattern
* @author dengfuping_develop@163.com
*/
import { uniqueId } from '@antv/util';
import { createSVGElement } from '../util/dom';
var regexPR = /^p\s*\(\s*([axyn])\s*\)\s*(.*)/i;
var Pattern = /** @class */ (function () {
function Pattern(cfg) {
this.cfg = {};
var el = createSVGElement('pattern');
el.setAttribute('patternUnits', 'userSpaceOnUse');
var child = createSVGElement('image');
el.appendChild(child);
var id = uniqueId('pattern_');
el.id = id;
this.el = el;
this.id = id;
this.cfg = cfg;
var arr = regexPR.exec(cfg);
var source = arr[2];
child.setAttribute('href', source);
var img = new Image();
if (!source.match(/^data:/i)) {
img.crossOrigin = 'Anonymous';
}
img.src = source;
function onload() {
el.setAttribute('width', "" + img.width);
el.setAttribute('height', "" + img.height);
}
if (img.complete) {
onload();
}
else {
img.onload = onload;
// Fix onload() bug in IE9
img.src = img.src;
}
return this;
}
Pattern.prototype.match = function (type, attr) {
return this.cfg === attr;
};
return Pattern;
}());
export default Pattern;
//# sourceMappingURL=pattern.js.map