Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
kooriookami committed Aug 9, 2023
1 parent 5eac389 commit 06869ab
Show file tree
Hide file tree
Showing 7 changed files with 653 additions and 635 deletions.
56 changes: 0 additions & 56 deletions docs/assets/index-39d241f9.js

This file was deleted.

56 changes: 56 additions & 0 deletions docs/assets/index-9acee7d0.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="./vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Compress Text</title>
<script type="module" crossorigin src="./assets/index-39d241f9.js"></script>
<script type="module" crossorigin src="./assets/index-9acee7d0.js"></script>
<link rel="stylesheet" href="./assets/index-2d5204f1.css">
</head>
<body>
Expand Down
1,147 changes: 573 additions & 574 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@element-plus/icons-vue": "^2.1.0",
"element-plus": "^2.3.9",
"leafer-compress-text": "workspace:*",
"leafer-ui": "^1.0.0-beta.8",
"leafer-ui": "^1.0.0-beta.9",
"lodash": "^4.17.21",
"normalize.css": "^8.0.1",
"vue": "^3.3.4"
Expand All @@ -46,6 +46,6 @@
"jsonfile": "^6.1.0",
"rollup-plugin-copy": "^3.4.0",
"sass": "^1.64.2",
"vite": "^4.4.8"
"vite": "^4.4.9"
}
}
4 changes: 2 additions & 2 deletions packages/compress-text/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "leafer-compress-text",
"version": "1.0.14",
"version": "1.0.15",
"main": "src/index.js",
"module": "src/index.js",
"repository": {
Expand All @@ -17,7 +17,7 @@
"author": "kooriookami",
"license": "ISC",
"dependencies": {
"leafer-ui": "^1.0.0-beta.8",
"leafer-ui": "^1.0.0-beta.9",
"lodash": "^4.17.21"
}
}
19 changes: 19 additions & 0 deletions packages/compress-text/src/compress-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,31 @@ export class CompressText extends Group {

// 添加行
addRow() {
this.removeLineLastSpace(this.currentLine);
const fontSize = this.isSmallSize ? this.smallFontSize : this.fontSize;
this.currentX = 0;
this.currentY += fontSize * this.lineHeight * this.fontScale;
this.currentLine++;
}

// 删除行尾空格
removeLineLastSpace(line) {
const charList = this.parseList.map(item => item.ruby.charList).flat();
const lineList = charList.filter(item => item.line === line);
if (lineList.length) {
const lastChar = lineList[lineList.length - 1];
if (lastChar.text === ' ') {
const lastCharLeaf = lastChar.charLeaf;
const lastPaddingLeft = lastChar.paddingLeft || 0;
const lastPaddingRight = lastChar.paddingRight || 0;
this.currentX -= lastChar.width + lastPaddingLeft + lastPaddingRight;
lastCharLeaf.remove();
lastChar.line = -1;
this.removeLineLastSpace(line);
}
}
}

// 定位rt
positionRt(item) {
const ruby = item.ruby;
Expand Down

0 comments on commit 06869ab

Please sign in to comment.