mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-06 21:44:08 -06:00
Add the full source of BambuStudio
using version 1.0.10
This commit is contained in:
parent
30bcadab3e
commit
1555904bef
3771 changed files with 1251328 additions and 0 deletions
40
resources/web/guide/swiper/core/breakpoints/getBreakpoint.js
Normal file
40
resources/web/guide/swiper/core/breakpoints/getBreakpoint.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
import { getWindow } from 'ssr-window';
|
||||
export default function getBreakpoint(breakpoints, base = 'window', containerEl) {
|
||||
if (!breakpoints || base === 'container' && !containerEl) return undefined;
|
||||
let breakpoint = false;
|
||||
const window = getWindow();
|
||||
const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight;
|
||||
const points = Object.keys(breakpoints).map(point => {
|
||||
if (typeof point === 'string' && point.indexOf('@') === 0) {
|
||||
const minRatio = parseFloat(point.substr(1));
|
||||
const value = currentHeight * minRatio;
|
||||
return {
|
||||
value,
|
||||
point
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
value: point,
|
||||
point
|
||||
};
|
||||
});
|
||||
points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10));
|
||||
|
||||
for (let i = 0; i < points.length; i += 1) {
|
||||
const {
|
||||
point,
|
||||
value
|
||||
} = points[i];
|
||||
|
||||
if (base === 'window') {
|
||||
if (window.matchMedia(`(min-width: ${value}px)`).matches) {
|
||||
breakpoint = point;
|
||||
}
|
||||
} else if (value <= containerEl.clientWidth) {
|
||||
breakpoint = point;
|
||||
}
|
||||
}
|
||||
|
||||
return breakpoint || 'max';
|
||||
}
|
6
resources/web/guide/swiper/core/breakpoints/index.js
Normal file
6
resources/web/guide/swiper/core/breakpoints/index.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
import setBreakpoint from './setBreakpoint.js';
|
||||
import getBreakpoint from './getBreakpoint.js';
|
||||
export default {
|
||||
setBreakpoint,
|
||||
getBreakpoint
|
||||
};
|
72
resources/web/guide/swiper/core/breakpoints/setBreakpoint.js
Normal file
72
resources/web/guide/swiper/core/breakpoints/setBreakpoint.js
Normal file
|
@ -0,0 +1,72 @@
|
|||
import { extend } from '../../shared/utils.js';
|
||||
|
||||
const isGridEnabled = (swiper, params) => {
|
||||
return swiper.grid && params.grid && params.grid.rows > 1;
|
||||
};
|
||||
|
||||
export default function setBreakpoint() {
|
||||
const swiper = this;
|
||||
const {
|
||||
activeIndex,
|
||||
initialized,
|
||||
loopedSlides = 0,
|
||||
params,
|
||||
$el
|
||||
} = swiper;
|
||||
const breakpoints = params.breakpoints;
|
||||
if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; // Get breakpoint for window width and update parameters
|
||||
|
||||
const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el);
|
||||
if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;
|
||||
const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
|
||||
const breakpointParams = breakpointOnlyParams || swiper.originalParams;
|
||||
const wasMultiRow = isGridEnabled(swiper, params);
|
||||
const isMultiRow = isGridEnabled(swiper, breakpointParams);
|
||||
const wasEnabled = params.enabled;
|
||||
|
||||
if (wasMultiRow && !isMultiRow) {
|
||||
$el.removeClass(`${params.containerModifierClass}grid ${params.containerModifierClass}grid-column`);
|
||||
swiper.emitContainerClasses();
|
||||
} else if (!wasMultiRow && isMultiRow) {
|
||||
$el.addClass(`${params.containerModifierClass}grid`);
|
||||
|
||||
if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') {
|
||||
$el.addClass(`${params.containerModifierClass}grid-column`);
|
||||
}
|
||||
|
||||
swiper.emitContainerClasses();
|
||||
}
|
||||
|
||||
const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
|
||||
const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
|
||||
|
||||
if (directionChanged && initialized) {
|
||||
swiper.changeDirection();
|
||||
}
|
||||
|
||||
extend(swiper.params, breakpointParams);
|
||||
const isEnabled = swiper.params.enabled;
|
||||
Object.assign(swiper, {
|
||||
allowTouchMove: swiper.params.allowTouchMove,
|
||||
allowSlideNext: swiper.params.allowSlideNext,
|
||||
allowSlidePrev: swiper.params.allowSlidePrev
|
||||
});
|
||||
|
||||
if (wasEnabled && !isEnabled) {
|
||||
swiper.disable();
|
||||
} else if (!wasEnabled && isEnabled) {
|
||||
swiper.enable();
|
||||
}
|
||||
|
||||
swiper.currentBreakpoint = breakpoint;
|
||||
swiper.emit('_beforeBreakpoint', breakpointParams);
|
||||
|
||||
if (needsReLoop && initialized) {
|
||||
swiper.loopDestroy();
|
||||
swiper.loopCreate();
|
||||
swiper.updateSlides();
|
||||
swiper.slideTo(activeIndex - loopedSlides + swiper.loopedSlides, 0, false);
|
||||
}
|
||||
|
||||
swiper.emit('breakpoint', breakpointParams);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue