mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-11-01 05:01:10 -06:00
ENH: model info display UI
Change-Id: I066c0e7f8ce87ec00b1141a1b44430444a819b42 (cherry picked from commit 05907a1a42da82737090d55046974d401f8af057)
This commit is contained in:
parent
0cc953ad41
commit
b4ffa91cb4
343 changed files with 54828 additions and 2 deletions
6
resources/web/include/swiper/core/images/index.js
Normal file
6
resources/web/include/swiper/core/images/index.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import loadImage from './loadImage.js';
|
||||
import preloadImages from './preloadImages.js';
|
||||
export default {
|
||||
loadImage,
|
||||
preloadImages
|
||||
};
|
||||
37
resources/web/include/swiper/core/images/loadImage.js
Normal file
37
resources/web/include/swiper/core/images/loadImage.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import { getWindow } from 'ssr-window';
|
||||
import $ from '../../shared/dom.js';
|
||||
export default function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) {
|
||||
const window = getWindow();
|
||||
let image;
|
||||
|
||||
function onReady() {
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
const isPicture = $(imageEl).parent('picture')[0];
|
||||
|
||||
if (!isPicture && (!imageEl.complete || !checkForComplete)) {
|
||||
if (src) {
|
||||
image = new window.Image();
|
||||
image.onload = onReady;
|
||||
image.onerror = onReady;
|
||||
|
||||
if (sizes) {
|
||||
image.sizes = sizes;
|
||||
}
|
||||
|
||||
if (srcset) {
|
||||
image.srcset = srcset;
|
||||
}
|
||||
|
||||
if (src) {
|
||||
image.src = src;
|
||||
}
|
||||
} else {
|
||||
onReady();
|
||||
}
|
||||
} else {
|
||||
// image already loaded...
|
||||
onReady();
|
||||
}
|
||||
}
|
||||
19
resources/web/include/swiper/core/images/preloadImages.js
Normal file
19
resources/web/include/swiper/core/images/preloadImages.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
export default function preloadImages() {
|
||||
const swiper = this;
|
||||
swiper.imagesToLoad = swiper.$el.find('img');
|
||||
|
||||
function onReady() {
|
||||
if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return;
|
||||
if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1;
|
||||
|
||||
if (swiper.imagesLoaded === swiper.imagesToLoad.length) {
|
||||
if (swiper.params.updateOnImagesReady) swiper.update();
|
||||
swiper.emit('imagesReady');
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < swiper.imagesToLoad.length; i += 1) {
|
||||
const imageEl = swiper.imagesToLoad[i];
|
||||
swiper.loadImage(imageEl, imageEl.currentSrc || imageEl.getAttribute('src'), imageEl.srcset || imageEl.getAttribute('srcset'), imageEl.sizes || imageEl.getAttribute('sizes'), true, onReady);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue