Adam Shaw пре 4 година
родитељ
комит
9f951bfbe4
2 измењених фајлова са 14 додато и 8 уклоњено
  1. 2 1
      packages/common/src/event-placement.ts
  2. 12 7
      packages/daygrid/src/event-placement.ts

+ 2 - 1
packages/common/src/event-placement.ts

@@ -188,7 +188,8 @@ export class SegHierarchy {
 
       for (let entry of entries) {
         let segIndex = entry.segInput.index
-        let partIndex = (partIndexHash[segIndex] = (partIndexHash[segIndex] || 0) + 1)
+        let partIndex = partIndexHash[segIndex] || 0
+        partIndexHash[segIndex] = partIndex + 1 // increment the store
 
         rects.push({ ...entry, partIndex, levelCoord })
       }

+ 12 - 7
packages/daygrid/src/event-placement.ts

@@ -32,6 +32,7 @@ export function computeFgSegPlacement(
 
   if (dayMaxEvents === true || dayMaxEventRows === true) {
     hierarchy.maxCoord = maxContentHeight
+    hierarchy.hiddenConsumes = true
   } else if (typeof dayMaxEvents === 'number') {
     hierarchy.maxStackCnt = dayMaxEvents
   } else if (typeof dayMaxEventRows === 'number') {
@@ -60,6 +61,10 @@ export function computeFgSegPlacement(
   let moreMarginTops: number[] = []
   let cellPaddingBottoms: number[] = []
 
+  for (let col = 0; col < colCnt; col++) {
+    moreCnts.push(0)
+  }
+
   // add the hidden entries
   for (let hiddenEntry of hiddenEntries) {
     let placement: TableSegPlacement = {
@@ -146,15 +151,15 @@ function placeRects(rects: SegRect[], segs: TableSeg[], colCnt: number) {
       currentMargin += placement.absoluteTop - currentHeight // amount of space since bottom of previous seg
       currentHeight = placement.absoluteTop + placementHeight // height will now be bottom of current seg
 
-      if (placement.seg.firstCol === col) { // is the rect rooted in this col?
-        if (placement.isAbsolute) {
-          currentMargin += placementHeight
-        } else {
-          placement.marginTop = currentMargin // claim the margin
-          currentMargin = 0
-        }
+      if (placement.isAbsolute) {
+        currentMargin += placementHeight
+      } else if (placement.seg.firstCol === col) { // non-absolute seg rooted in this col
+        placement.marginTop = currentMargin // claim the margin
+        currentMargin = 0
       }
     }
+
+    leftoverMarginsByCol.push(currentMargin)
   }
 
   return { placementsByFirstCol, placementsByEachCol, leftoverMarginsByCol }