@femessage/img-preview

1,523 7
Install
npm install @femessage/img-preview
Latest Version:1.5.0
Vue:2
License:MIT
Last Updated:Nov 11, 2020
Links: GitHub  ·  npm
Maintainer: levy9527

img-preview

Build Status NPM Download NPM Version NPM License PRs Welcome Automated Release Notes by gren

Picture preview component

中文文档

Table of Contents

Feature

  • Implementation like medium
  • Automatically adaptation screen size
  • The small picture is not vague, the big picture does not overflow the screen
  • Support Press ESC Key to off preview

⬆Back to Top

Demo

⬆Back to Top

Install

yarn add @femessage/img-preview

⬆Back to Top

Picture Preview Algorithm

When the original size of the preview picture is relatively large, you need to preview the picture proportionally.

// X-axis ratio = width of the window / width of the image
// Y-axis ratio = height of the window / height of the picture
// Image ratio = x-axis ratio * (picture height > window height ? y-axis ratio: x-axis ratio)

Here's more details of the formula:

  • Step 1, calculation x-axis ratio (The ratio of the browser window width to the original width of the picture) and save it

WechatIMG5.jpeg

  • The second step, considering x-axis ratio below, it is possible that the height of the picture is larger than the height of the window.
    At this time should use y-axis ratio (The ratio of browser window height to the original height of the picture) as the preview ratio of the picture

WechatIMG61.jpeg

⬆Back to Top

Contributors

listars
listars

💻 📖 🤔
Donald Shen
Donald Shen

🐛 🚧
EVILLT
EVILLT

💻 🚧

Thanks goes to these wonderful people ( Emoji key ):
This project follows All-contributors Specification. Contributions of any kind welcome!

⬆Back to Top

License

MIT

⬆ Back to Top

Related Packages

j-vue

.vue single-file component back-end compiler. Belong to "Plan J"./.vue 单文件组...

6,068 7
@vue/component-compiler

bundler agnostic API for compiling Vue SFC

3,126,609 343
@vuedx/compiler-sfc

This package extracts `parse()` function [@vue/compiler-sfc] as ES module.

250,768 1,251
@femessage/log-viewer

💻 View terminal logs in browser

11,528 119

Version History

Version Released Vue License
1.5.0 ^2.5.16 MIT
1.4.1 ^2.5.16 MIT
1.4.0 ^2.5.16 MIT
1.3.0 ^2.5.16 MIT
1.2.4 ^2.5.16 MIT