@antv/g-svg
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -68,3 +68,3 @@ /** | ||
var el = this.get('el'); | ||
var _a = this.attr(), fontSize = _a.fontSize, textBaseline = _a.textBaseline, textAlign = _a.textAlign; | ||
var _a = this.attr(), textBaseline = _a.textBaseline, textAlign = _a.textAlign; | ||
var browser = detect(); | ||
@@ -79,7 +79,2 @@ if (browser && browser.name === 'firefox') { | ||
el.setAttribute('text-anchor', ANCHOR_MAP[textAlign] || 'left'); | ||
if (fontSize && +fontSize < 12) { | ||
// 小于 12 像素的文本进行 scale 处理 | ||
this.attr('matrix', [1, 0, 0, 0, 1, 0, 0, 0, 1]); | ||
this.transform(); | ||
} | ||
}; | ||
@@ -86,0 +81,0 @@ Text.prototype._setText = function (text) { |
@@ -60,5 +60,24 @@ import { toArray } from '@antv/util'; | ||
function (node) { return node.nodeType === 1 && node.nodeName.toLowerCase() !== 'defs'; }); | ||
// 获取目标节点 | ||
var target = siblings[targetIndex]; | ||
var currentIndex = siblings.indexOf(element); | ||
// 如果目标节点存在 | ||
if (target) { | ||
parentNode.insertBefore(element, target); | ||
// 当前索引 > 目标索引,直接插入到目标节点之前即可 | ||
if (currentIndex > targetIndex) { | ||
parentNode.insertBefore(element, target); | ||
} | ||
else if (currentIndex < targetIndex) { | ||
// 当前索引 < 目标索引 | ||
// 获取目标节点的下一个节点 | ||
var targetNext = siblings[targetIndex + 1]; | ||
// 如果目标节点的下一个节点存在,插入到该节点之前 | ||
if (targetNext) { | ||
parentNode.insertBefore(element, targetNext); | ||
} | ||
else { | ||
// 如果该节点不存在,则追加到末尾 | ||
parentNode.appendChild(element); | ||
} | ||
} | ||
} | ||
@@ -65,0 +84,0 @@ else { |
@@ -70,3 +70,3 @@ "use strict"; | ||
var el = this.get('el'); | ||
var _a = this.attr(), fontSize = _a.fontSize, textBaseline = _a.textBaseline, textAlign = _a.textAlign; | ||
var _a = this.attr(), textBaseline = _a.textBaseline, textAlign = _a.textAlign; | ||
var browser = detect_browser_1.detect(); | ||
@@ -81,7 +81,2 @@ if (browser && browser.name === 'firefox') { | ||
el.setAttribute('text-anchor', ANCHOR_MAP[textAlign] || 'left'); | ||
if (fontSize && +fontSize < 12) { | ||
// 小于 12 像素的文本进行 scale 处理 | ||
this.attr('matrix', [1, 0, 0, 0, 1, 0, 0, 0, 1]); | ||
this.transform(); | ||
} | ||
}; | ||
@@ -88,0 +83,0 @@ Text.prototype._setText = function (text) { |
@@ -64,5 +64,24 @@ "use strict"; | ||
function (node) { return node.nodeType === 1 && node.nodeName.toLowerCase() !== 'defs'; }); | ||
// 获取目标节点 | ||
var target = siblings[targetIndex]; | ||
var currentIndex = siblings.indexOf(element); | ||
// 如果目标节点存在 | ||
if (target) { | ||
parentNode.insertBefore(element, target); | ||
// 当前索引 > 目标索引,直接插入到目标节点之前即可 | ||
if (currentIndex > targetIndex) { | ||
parentNode.insertBefore(element, target); | ||
} | ||
else if (currentIndex < targetIndex) { | ||
// 当前索引 < 目标索引 | ||
// 获取目标节点的下一个节点 | ||
var targetNext = siblings[targetIndex + 1]; | ||
// 如果目标节点的下一个节点存在,插入到该节点之前 | ||
if (targetNext) { | ||
parentNode.insertBefore(element, targetNext); | ||
} | ||
else { | ||
// 如果该节点不存在,则追加到末尾 | ||
parentNode.appendChild(element); | ||
} | ||
} | ||
} | ||
@@ -69,0 +88,0 @@ else { |
{ | ||
"name": "@antv/g-svg", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "A canvas library which providing 2d", | ||
"main": "lib/index.js", | ||
"module": "esm/index.js", | ||
"browser": "dist/g.min.js", | ||
"unpkg": "dist/g.min.js", | ||
"types": "lib/index.d.ts", | ||
@@ -57,3 +57,3 @@ "files": [ | ||
"dependencies": { | ||
"@antv/g-base": "^0.4.0", | ||
"@antv/g-base": "^0.4.1", | ||
"@antv/g-math": "^0.1.1", | ||
@@ -64,3 +64,3 @@ "@antv/util": "~2.0.0", | ||
"__npminstall_done": false, | ||
"gitHead": "95487b1e5ded41f5db351a622adf12659f564d8b" | ||
"gitHead": "6948b647ec006e956429f72b9b8b1264dd2c5846" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1133129
6006
Updated@antv/g-base@^0.4.1