@egjs/flicking 4.12.0-beta.4 → 4.12.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@egjs/flicking",
3
- "version": "4.12.0-beta.4",
3
+ "version": "4.12.0-beta.5",
4
4
  "description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.",
5
5
  "main": "dist/flicking.cjs.js",
6
6
  "module": "dist/flicking.esm.js",
@@ -510,8 +510,8 @@ class Camera {
510
510
  }
511
511
 
512
512
  /**
513
- * Update Viewport's height to active panel's height
514
- * @ko 현재 선택된 패널의 높이와 동일하도록 뷰포트의 높이를 업데이트합니다
513
+ * Update Viewport's height to visible panel's max height
514
+ * @ko 현재 활성화된 패널과 보이는 패널의 최대 높이와 동일하도록 뷰포트의 높이를 업데이트합니다
515
515
  * @throws {FlickingError}
516
516
  * {@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before
517
517
  * <ko>{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko>
@@ -521,11 +521,22 @@ class Camera {
521
521
  public updateAdaptiveHeight() {
522
522
  const flicking = getFlickingAttached(this._flicking);
523
523
  const activePanel = flicking.control.activePanel;
524
+ const visiblePanels = flicking.visiblePanels;
525
+
526
+ const selectedPanels = [...visiblePanels];
527
+
528
+ if (activePanel) {
529
+ selectedPanels.push(activePanel);
530
+ }
531
+
532
+ if (!flicking.horizontal || !flicking.adaptive || !selectedPanels.length) return;
533
+
534
+
535
+ const maxHeight = Math.max(...selectedPanels.map(panel => panel.height));
524
536
 
525
- if (!flicking.horizontal || !flicking.adaptive || !activePanel) return;
526
537
 
527
538
  flicking.viewport.setSize({
528
- height: activePanel.height
539
+ height: maxHeight
529
540
  });
530
541
  }
531
542