简体   繁体   English

在Galleria中关闭缩放

[英]Turn off scaling in Galleria

When Galleria is in fullscreen mode, I want it to display images pixel-for-pixel, ie with no scaling at all. Galleria处于全屏模式时,我希望它以像素为单位显示图像,即完全没有缩放比例。

My initial plan was to do this by both: 我最初的计划是通过两种方式做到这一点:

  • using fullscreenCrop: false , because the docs say that, " false will scale down so the entire image fits", and 使用fullscreenCrop: false ,因为文档说:“ false将按比例缩小以便整个图像合适”,并且
  • ensuring (I already have a mechanism for doing this) that the "big" image file 's: 确保(我已经有这样做的机制) “大”图像文件
    • height (px) ≦ the screen's height (px) and 高度(px)≦屏幕的高度(px)和
    • width (px) ≦ the screen's width (px). 宽度(px)≦屏幕的宽度(px)。

Unfortunately: 不幸:

  • the docs neglect to note that " false will also scale up so the entire image fits" (ie if both the image's height (px) < the screen's height (px) and the image's width (px) < the screen's width (px) ), and 文档忽略了“ false也将放大以使整个图像适合”(即,如果图像的高度(px)<屏幕的高度(px) 图像的宽度(px)<屏幕的宽度(px) )和
  • I do not have, nor do I want to have, a mechanism for ensuring that the "big" image file's 我没有,也不想拥有一种机制来确保“大”图像文件的
    • height (px) = the screen's height (px) or 高度(px)=屏幕的高度(px)或
    • width (px) = the screen's width (px). 宽度(px)=屏幕的宽度(px)。

Given all this, please can you suggest how I might achieve my objective? 有鉴于此,请您能提出我如何实现目标的建议?

You can prevent scaling by adding these two options: 您可以通过添加以下两个选项来防止扩展:

maxScaleRatio: 1
minScaleRatio: 1

You probably only need the first one to prevent upscale. 您可能只需要第一个即可防止升级。 But the second one prevents downscale as well. 但是第二个也可以防止尺寸缩小。 Read more: http://galleria.io/docs/options/maxScaleRatio/ 了解更多: http : //galleria.io/docs/options/maxScaleRatio/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM