Skip to content

Commit

Permalink
Merge pull request #89 from jiakuan/master
Browse files Browse the repository at this point in the history
Removed useless conditions for issue #88
  • Loading branch information
geongeorge authored Nov 21, 2023
2 parents 3ccd115 + 4d61a47 commit 2512042
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/canvas-txt/lib/split-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function splitText({
while (splitPointWidth > width) {
splitPoint = Math.max(1, splitPoint - 1)
splitPointWidth = measureText(tempLine.substring(0, splitPoint))
if (splitPoint === 0 || splitPoint === 1) break
if (splitPoint === 1) break
}
}

Expand All @@ -83,10 +83,8 @@ export default function splitText({
if (splitPoint > 0) {
let tempSplitPoint = splitPoint
if (tempLine.substring(tempSplitPoint, tempSplitPoint + 1) != ' ') {
while (
tempLine.substring(tempSplitPoint, tempSplitPoint + 1) != ' ' &&
tempSplitPoint >= 0
) {
while (tempSplitPoint >= 0
&& tempLine.substring(tempSplitPoint, tempSplitPoint + 1) != ' ') {
tempSplitPoint--
}
if (tempSplitPoint > 0) {
Expand Down

0 comments on commit 2512042

Please sign in to comment.