]> git.kianting.info Git - clo/blobdiff - src/libclo/breakLines.js
update readme
[clo] / src / libclo / breakLines.js
index f194aa5657eb8cb9edc734418cb0fbe1afc95d13..c7319be170a726b1e7d95b78e2bef42a1f1aa272 100644 (file)
@@ -34,6 +34,11 @@ class BreakLineAlgorithm {
             return item.width;
         }
     }
+    /**segement node of one paragraph into lines.
+     * @args items: nodes of a line
+     * @args linewidth: the line width
+     * @returns segmented nodes into lines
+    */
     segmentedNodes(items, lineWidth) {
         let lineWidthFixed = lineWidth;
         this.totalCost(items, lineWidthFixed);
@@ -88,8 +93,6 @@ class BreakLineAlgorithm {
                 a = tmp;
             }
         }
-        console.log("~~~", lineWidth);
-        console.log(items[itemsLength - 2]);
         return a;
     }
     /**
@@ -119,7 +122,6 @@ class BreakLineAlgorithm {
             this.totalCostAuxStorage[j] = returnCost;
             return returnCost;
         }
-        return returnCost;
     }
     /**
      * check the line cost of a line containing items[i..j]
@@ -129,7 +131,8 @@ class BreakLineAlgorithm {
      * @param lineWidth line width
      */
     lineCost(items, i, j, lineWidth) {
-        if (this.lineCostStorage[i] !== null && this.lineCostStorage[i][j] !== null) {
+        if (this.lineCostStorage[i][j] !== null) {
+            console.log("AA");
             return this.lineCostStorage[i][j];
         }
         if (!this.isBreakPoint(items[j])) {