@inappstory/slide-api 0.1.14 → 0.1.15

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/dist/index.cjs CHANGED
@@ -3819,22 +3819,30 @@ let SlideApi$1 = class SlideApi {
3819
3819
  let xOffset = "0px";
3820
3820
  // for elements with bottom anchor (absolute position)
3821
3821
  let yOffset = "0px";
3822
- // alert(viewportHeight);
3823
- if (viewportRatio > _ratio) {
3824
- // disable _isFullscreen if viewport small
3825
- _isFullscreen = false;
3826
- }
3827
3822
  if (_isFullscreen) {
3828
- // fit by width, top and bottom - to offscreen or fill with bg image
3829
- slideWidth = viewportWidth;
3830
- slideHeight = Math.ceil(viewportWidth / _ratio);
3831
- offset = Math.ceil(slideHeight - viewportHeight) / 2;
3832
- if (slideOffset != null) {
3833
- slideOffset.style.margin = -1 * offset + "px" + " 0 ";
3834
- }
3835
- // offset from viewport bottom to StoryBottom plus safe area offset bottom
3836
- yOffset = `calc(${offset + this._overlappingActionBarHeight}px + env(safe-area-inset-bottom))`;
3837
- // detect safe area offset
3823
+ // более квадратное чем надо (desktop)
3824
+ if (viewportRatio > _ratio) {
3825
+ // fit by height
3826
+ slideHeight = viewportHeight;
3827
+ slideWidth = Math.ceil(slideHeight * _ratio);
3828
+ offset = Math.ceil(slideWidth - viewportWidth) / 2;
3829
+ if (slideOffset != null) {
3830
+ slideOffset.style.margin = "0 " + -offset + "px"; // -8.5
3831
+ }
3832
+ xOffset = offset + "px";
3833
+ }
3834
+ else {
3835
+ // fit by width, top and bottom - to offscreen or fill with bg image
3836
+ slideWidth = viewportWidth;
3837
+ slideHeight = Math.ceil(viewportWidth / _ratio);
3838
+ offset = Math.ceil(slideHeight - viewportHeight) / 2;
3839
+ if (slideOffset != null) {
3840
+ slideOffset.style.margin = -1 * offset + "px" + " 0 ";
3841
+ }
3842
+ // offset from viewport bottom to StoryBottom plus safe area offset bottom
3843
+ yOffset = `calc(${offset + this._overlappingActionBarHeight}px + env(safe-area-inset-bottom))`;
3844
+ // detect safe area offset
3845
+ }
3838
3846
  }
3839
3847
  else {
3840
3848
  // более квадратное чем надо