PageSourceSearch

https://gea.solar/component/jvectormap/src/svg-shape-element.js

js gea.solar collected 2026-10-03 18:58:18 UTC 1,877 bytes, 49 lines download raw bytes

vendor: 1,877 bytes, lines 1-49
1jvm.SVGShapeElement = function(name, config, style){
2  jvm.SVGShapeElement.parentClass.call(this, name, config);
3  jvm.AbstractShapeElement.apply(this, arguments);
4};
5
6jvm.inherits(jvm.SVGShapeElement, jvm.SVGElement);
7jvm.mixin(jvm.SVGShapeElement, jvm.AbstractShapeElement);
8
9jvm.SVGShapeElement.prototype.applyAttr = function(attr, value){
10  var patternEl,
11      imageEl,
12      that = this;
13
14  if (attr === 'fill' && jvm.isImageUrl(value)) {
15    if (!jvm.SVGShapeElement.images[value]) {
16      jvm.whenImageLoaded(value).then(function(img){
17        imageEl = new jvm.SVGElement('image');
18        imageEl.node.setAttributeNS('http://www.w3.org/1999/xlink', 'href', value);
19        imageEl.applyAttr('x', '0');
20        imageEl.applyAttr('y', '0');
21        imageEl.applyAttr('width', img[0].width);
22        imageEl.applyAttr('height', img[0].height);
23
24        patternEl = new jvm.SVGElement('pattern');
25        patternEl.applyAttr('id', 'image'+jvm.SVGShapeElement.imageCounter);
26        patternEl.applyAttr('x', 0);
27        patternEl.applyAttr('y', 0);
28        patternEl.applyAttr('width', img[0].width / 2);
29        patternEl.applyAttr('height', img[0].height / 2);
30        patternEl.applyAttr('viewBox', '0 0 '+img[0].width+' '+img[0].height);
31        patternEl.applyAttr('patternUnits', 'userSpaceOnUse');
32        patternEl.node.appendChild( imageEl.node );
33
34        that.canvas.defsElement.node.appendChild( patternEl.node );
35
36        jvm.SVGShapeElement.images[value] = jvm.SVGShapeElement.imageCounter++;
37
38        that.applyAttr('fill', 'url(#image'+jvm.SVGShapeElement.images[value]+')');
39      });
40    } else {
41      this.applyAttr('fill', 'url(#image'+jvm.SVGShapeElement.images[value]+')');
42    }
43  } else {
44    jvm.SVGShapeElement.parentClass.prototype.applyAttr.apply(this, arguments);
45  }
46};
47
48jvm.SVGShapeElement.imageCounter = 1;
49jvm.SVGShapeElement.images = {};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.