Skip to content

Commit

Permalink
feat: 2.2.3 修复draw库的一个bug
Browse files Browse the repository at this point in the history
  • Loading branch information
theajack committed Jul 7, 2020
1 parent 4dd438c commit 14a1b8d
Show file tree
Hide file tree
Showing 22 changed files with 88 additions and 52 deletions.
5 changes: 4 additions & 1 deletion helper/version.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,7 @@
3. 修复构建npm的bug

## 2.2.2
1. 增加几个多音字的默认读音
1. 增加几个多音字的默认读音

## 2.2.3
1. 修复draw库不同绘制实例样式会干扰的bug
2 changes: 1 addition & 1 deletion npm/all/cnchar.all.min.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions npm/all/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cnchar-all",
"version": "2.2.2",
"version": "2.2.3",
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
"main": "index.js",
"unpkg": "cnchar.all.min.js",
Expand All @@ -27,12 +27,12 @@
},
"homepage": "https://www.theajack.com/cnchar/",
"dependencies": {
"cnchar": "^2.2.2",
"cnchar-order": "^2.2.2",
"cnchar-poly": "^2.2.2",
"cnchar-trad": "^2.2.2",
"cnchar-draw": "^2.2.2",
"cnchar-idiom": "^2.2.2",
"cnchar-xhy": "^2.2.2"
"cnchar": "^2.2.3",
"cnchar-order": "^2.2.3",
"cnchar-poly": "^2.2.3",
"cnchar-trad": "^2.2.3",
"cnchar-draw": "^2.2.3",
"cnchar-idiom": "^2.2.3",
"cnchar-xhy": "^2.2.3"
}
}
2 changes: 1 addition & 1 deletion npm/cnchar/cnchar.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion npm/cnchar/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cnchar",
"version": "2.2.2",
"version": "2.2.3",
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
"main": "index.js",
"scripts": {},
Expand Down
2 changes: 1 addition & 1 deletion npm/cnchar/version.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"use strict";

module.exports = '2.2.2';
module.exports = '2.2.3';
2 changes: 1 addition & 1 deletion npm/draw/cnchar.draw.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion npm/draw/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cnchar-draw",
"version": "2.2.2",
"version": "2.2.3",
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
"main": "index.js",
"unpkg": "cnchar.draw.min.js",
Expand Down
13 changes: 6 additions & 7 deletions npm/draw/writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,14 @@ var Writer = /*#__PURE__*/function () {
lineHTML = _buildLinesStr.lineHTML,
border = _buildLinesStr.border;

svg.setAttribute('width', this.option.width);
svg.setAttribute('height', this.option.height);

if (border) {
svg.style.border = border;
}

var cloneSvg = function cloneSvg(option) {
var node = svg.cloneNode();
node.setAttribute('width', _this.option.width);
node.setAttribute('height', _this.option.height);

if (border) {
node.style.border = border;
}

if (lineHTML) {
node.innerHTML = lineHTML;
Expand Down
2 changes: 1 addition & 1 deletion npm/hanzi-util-base/hanzi.base.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions npm/hanzi-util-base/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hanzi-util-base",
"version": "2.2.2",
"version": "2.2.3",
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
"main": "index.js",
"unpkg": "hanzi.base.min.js",
Expand All @@ -27,6 +27,6 @@
},
"homepage": "https://www.theajack.com/cnchar/",
"dependencies": {
"cnchar": "^2.2.2"
"cnchar": "^2.2.3"
}
}
2 changes: 1 addition & 1 deletion npm/hanzi-util/hanzi.util.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions npm/hanzi-util/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hanzi-util",
"version": "2.2.2",
"version": "2.2.3",
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
"main": "index.js",
"unpkg": "hanzi.util.min.js",
Expand All @@ -27,6 +27,6 @@
},
"homepage": "https://www.theajack.com/cnchar/",
"dependencies": {
"cnchar-all": "^2.2.2"
"cnchar-all": "^2.2.3"
}
}
2 changes: 1 addition & 1 deletion npm/idiom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cnchar-idiom",
"version": "2.2.2",
"version": "2.2.3",
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
"main": "index.js",
"unpkg": "cnchar.idiom.min.js",
Expand Down
2 changes: 1 addition & 1 deletion npm/order/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cnchar-order",
"version": "2.2.2",
"version": "2.2.3",
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
"main": "index.js",
"unpkg": "cnchar.order.min.js",
Expand Down
2 changes: 1 addition & 1 deletion npm/poly/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cnchar-poly",
"version": "2.2.2",
"version": "2.2.3",
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
"main": "index.js",
"unpkg": "cnchar.poly.min.js",
Expand Down
2 changes: 1 addition & 1 deletion npm/trad/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cnchar-trad",
"version": "2.2.2",
"version": "2.2.3",
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
"main": "index.js",
"unpkg": "cnchar.trad.min.js",
Expand Down
2 changes: 1 addition & 1 deletion npm/xhy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cnchar-xhy",
"version": "2.2.2",
"version": "2.2.3",
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
"main": "index.js",
"unpkg": "cnchar.xhy.min.js",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cnchar",
"version": "2.2.2",
"version": "2.2.3",
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
"main": "index.html",
"author": "theajack <[email protected]>",
Expand Down
58 changes: 46 additions & 12 deletions public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import '../src/plugin/xhy';
// import spell from '../src/main/spell-dict-jian.json';
// // import cncharDraw from '../src/plugin/draw';

// // import cnchar from '../npm/cnchar';
// // import '../npm/order';
// // import '../npm/trad';
// // import '../npm/poly';
// // import cncharDraw from '../npm/draw';
// import cnchar from '../npm/cnchar';
// import '../npm/order';
// import '../npm/trad';
// import '../npm/poly';
// import '../npm/draw';
// import '../npm/idiom';
// import '../npm/xhy';

// // import './plugin/draw'
// // console.log('1',cnchar)
Expand Down Expand Up @@ -49,13 +51,45 @@ import '../src/plugin/xhy';
// }
// }
// });
// cncharDraw('你好', {
// type: cncharDraw.TYPE.STROKE,
// style: {
// radicalColor: '#44f',
// backgroundColor: '#eee'
// },
// });
cnchar.draw('中国', {
type: cnchar.draw.TYPE.NORMAL,
style: {
radicalColor: '#44f',
backgroundColor: '#eee',
length: 100,

},
});
cnchar.draw('你好', {
type: cnchar.draw.TYPE.STROKE,
style: {
radicalColor: '#44f',
backgroundColor: '#eee',
length: 60,
},
});

cnchar.draw('中国', {
type: cnchar.draw.TYPE.TEST,
style: {
radicalColor: '#44f',
backgroundColor: '#eee',
length: 100,

},
});

cnchar.draw('你好', {
type: cnchar.draw.TYPE.ANIMATION,
style: {
radicalColor: '#44f',
backgroundColor: '#eee',
length: 120,

},
});

window.cnchar = cnchar;

export default cnchar;

Expand Down
2 changes: 1 addition & 1 deletion src/main/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = '2.2.2';
module.exports = '2.2.3';
10 changes: 5 additions & 5 deletions src/plugin/draw/writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ class Writer {
}
init () {
let {lineHTML, border} = buildLinesStr(this.option);
svg.setAttribute('width', this.option.width);
svg.setAttribute('height', this.option.height);
if (border) {
svg.style.border = border;
}
let cloneSvg = (option) => {
let node = svg.cloneNode();
node.setAttribute('width', this.option.width);
node.setAttribute('height', this.option.height);
if (border) {
node.style.border = border;
}
if (lineHTML) {
node.innerHTML = lineHTML;
}
Expand Down

0 comments on commit 14a1b8d

Please sign in to comment.