mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -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
				
			
		
							
								
								
									
										185
									
								
								resources/web/include/swiper/modules/navigation/navigation.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										185
									
								
								resources/web/include/swiper/modules/navigation/navigation.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,185 @@ | |||
| import createElementIfNotDefined from '../../shared/create-element-if-not-defined.js'; | ||||
| import $ from '../../shared/dom.js'; | ||||
| export default function Navigation({ | ||||
|   swiper, | ||||
|   extendParams, | ||||
|   on, | ||||
|   emit | ||||
| }) { | ||||
|   extendParams({ | ||||
|     navigation: { | ||||
|       nextEl: null, | ||||
|       prevEl: null, | ||||
|       hideOnClick: false, | ||||
|       disabledClass: 'swiper-button-disabled', | ||||
|       hiddenClass: 'swiper-button-hidden', | ||||
|       lockClass: 'swiper-button-lock' | ||||
|     } | ||||
|   }); | ||||
|   swiper.navigation = { | ||||
|     nextEl: null, | ||||
|     $nextEl: null, | ||||
|     prevEl: null, | ||||
|     $prevEl: null | ||||
|   }; | ||||
| 
 | ||||
|   function getEl(el) { | ||||
|     let $el; | ||||
| 
 | ||||
|     if (el) { | ||||
|       $el = $(el); | ||||
| 
 | ||||
|       if (swiper.params.uniqueNavElements && typeof el === 'string' && $el.length > 1 && swiper.$el.find(el).length === 1) { | ||||
|         $el = swiper.$el.find(el); | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     return $el; | ||||
|   } | ||||
| 
 | ||||
|   function toggleEl($el, disabled) { | ||||
|     const params = swiper.params.navigation; | ||||
| 
 | ||||
|     if ($el && $el.length > 0) { | ||||
|       $el[disabled ? 'addClass' : 'removeClass'](params.disabledClass); | ||||
|       if ($el[0] && $el[0].tagName === 'BUTTON') $el[0].disabled = disabled; | ||||
| 
 | ||||
|       if (swiper.params.watchOverflow && swiper.enabled) { | ||||
|         $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   function update() { | ||||
|     // Update Navigation Buttons
 | ||||
|     if (swiper.params.loop) return; | ||||
|     const { | ||||
|       $nextEl, | ||||
|       $prevEl | ||||
|     } = swiper.navigation; | ||||
|     toggleEl($prevEl, swiper.isBeginning); | ||||
|     toggleEl($nextEl, swiper.isEnd); | ||||
|   } | ||||
| 
 | ||||
|   function onPrevClick(e) { | ||||
|     e.preventDefault(); | ||||
|     if (swiper.isBeginning && !swiper.params.loop) return; | ||||
|     swiper.slidePrev(); | ||||
|   } | ||||
| 
 | ||||
|   function onNextClick(e) { | ||||
|     e.preventDefault(); | ||||
|     if (swiper.isEnd && !swiper.params.loop) return; | ||||
|     swiper.slideNext(); | ||||
|   } | ||||
| 
 | ||||
|   function init() { | ||||
|     const params = swiper.params.navigation; | ||||
|     swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, { | ||||
|       nextEl: 'swiper-button-next', | ||||
|       prevEl: 'swiper-button-prev' | ||||
|     }); | ||||
|     if (!(params.nextEl || params.prevEl)) return; | ||||
|     const $nextEl = getEl(params.nextEl); | ||||
|     const $prevEl = getEl(params.prevEl); | ||||
| 
 | ||||
|     if ($nextEl && $nextEl.length > 0) { | ||||
|       $nextEl.on('click', onNextClick); | ||||
|     } | ||||
| 
 | ||||
|     if ($prevEl && $prevEl.length > 0) { | ||||
|       $prevEl.on('click', onPrevClick); | ||||
|     } | ||||
| 
 | ||||
|     Object.assign(swiper.navigation, { | ||||
|       $nextEl, | ||||
|       nextEl: $nextEl && $nextEl[0], | ||||
|       $prevEl, | ||||
|       prevEl: $prevEl && $prevEl[0] | ||||
|     }); | ||||
| 
 | ||||
|     if (!swiper.enabled) { | ||||
|       if ($nextEl) $nextEl.addClass(params.lockClass); | ||||
|       if ($prevEl) $prevEl.addClass(params.lockClass); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   function destroy() { | ||||
|     const { | ||||
|       $nextEl, | ||||
|       $prevEl | ||||
|     } = swiper.navigation; | ||||
| 
 | ||||
|     if ($nextEl && $nextEl.length) { | ||||
|       $nextEl.off('click', onNextClick); | ||||
|       $nextEl.removeClass(swiper.params.navigation.disabledClass); | ||||
|     } | ||||
| 
 | ||||
|     if ($prevEl && $prevEl.length) { | ||||
|       $prevEl.off('click', onPrevClick); | ||||
|       $prevEl.removeClass(swiper.params.navigation.disabledClass); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   on('init', () => { | ||||
|     init(); | ||||
|     update(); | ||||
|   }); | ||||
|   on('toEdge fromEdge lock unlock', () => { | ||||
|     update(); | ||||
|   }); | ||||
|   on('destroy', () => { | ||||
|     destroy(); | ||||
|   }); | ||||
|   on('enable disable', () => { | ||||
|     const { | ||||
|       $nextEl, | ||||
|       $prevEl | ||||
|     } = swiper.navigation; | ||||
| 
 | ||||
|     if ($nextEl) { | ||||
|       $nextEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass); | ||||
|     } | ||||
| 
 | ||||
|     if ($prevEl) { | ||||
|       $prevEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass); | ||||
|     } | ||||
|   }); | ||||
|   on('click', (_s, e) => { | ||||
|     const { | ||||
|       $nextEl, | ||||
|       $prevEl | ||||
|     } = swiper.navigation; | ||||
|     const targetEl = e.target; | ||||
| 
 | ||||
|     if (swiper.params.navigation.hideOnClick && !$(targetEl).is($prevEl) && !$(targetEl).is($nextEl)) { | ||||
|       if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return; | ||||
|       let isHidden; | ||||
| 
 | ||||
|       if ($nextEl) { | ||||
|         isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass); | ||||
|       } else if ($prevEl) { | ||||
|         isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass); | ||||
|       } | ||||
| 
 | ||||
|       if (isHidden === true) { | ||||
|         emit('navigationShow'); | ||||
|       } else { | ||||
|         emit('navigationHide'); | ||||
|       } | ||||
| 
 | ||||
|       if ($nextEl) { | ||||
|         $nextEl.toggleClass(swiper.params.navigation.hiddenClass); | ||||
|       } | ||||
| 
 | ||||
|       if ($prevEl) { | ||||
|         $prevEl.toggleClass(swiper.params.navigation.hiddenClass); | ||||
|       } | ||||
|     } | ||||
|   }); | ||||
|   Object.assign(swiper.navigation, { | ||||
|     update, | ||||
|     init, | ||||
|     destroy | ||||
|   }); | ||||
| } | ||||
|  | @ -0,0 +1,55 @@ | |||
| @import url('../../swiper-vars.less'); | ||||
| 
 | ||||
| :root { | ||||
|   --swiper-navigation-size: 44px; | ||||
|   /* | ||||
|   --swiper-navigation-color: var(--swiper-theme-color); | ||||
|   */ | ||||
| } | ||||
| .swiper-button-prev, | ||||
| .swiper-button-next { | ||||
|   position: absolute; | ||||
|   top: 50%; | ||||
|   width: calc(var(--swiper-navigation-size) / 44 * 27); | ||||
|   height: var(--swiper-navigation-size); | ||||
|   margin-top: calc(0px - (var(--swiper-navigation-size) / 2)); | ||||
|   z-index: 10; | ||||
|   cursor: pointer; | ||||
|   display: flex; | ||||
|   align-items: center; | ||||
|   justify-content: center; | ||||
|   color: var(--swiper-navigation-color, var(--swiper-theme-color)); | ||||
|   &.swiper-button-disabled { | ||||
|     opacity: 0.35; | ||||
|     cursor: auto; | ||||
|     pointer-events: none; | ||||
|   } | ||||
|   &:after { | ||||
|     font-family: swiper-icons; | ||||
|     font-size: var(--swiper-navigation-size); | ||||
|     text-transform: none !important; | ||||
|     letter-spacing: 0; | ||||
|     text-transform: none; | ||||
|     font-variant: initial; | ||||
|     line-height: 1; | ||||
|   } | ||||
| } | ||||
| .swiper-button-prev, | ||||
| .swiper-rtl .swiper-button-next { | ||||
|   &:after { | ||||
|     content: 'prev'; | ||||
|   } | ||||
|   left: 10px; | ||||
|   right: auto; | ||||
| } | ||||
| .swiper-button-next, | ||||
| .swiper-rtl .swiper-button-prev { | ||||
|   &:after { | ||||
|     content: 'next'; | ||||
|   } | ||||
|   right: 10px; | ||||
|   left: auto; | ||||
| } | ||||
| .swiper-button-lock { | ||||
|   display: none; | ||||
| } | ||||
							
								
								
									
										1
									
								
								resources/web/include/swiper/modules/navigation/navigation.min.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								resources/web/include/swiper/modules/navigation/navigation.min.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| :root{--swiper-navigation-size:44px}.swiper-button-next,.swiper-button-prev{position:absolute;top:50%;width:calc(var(--swiper-navigation-size)/ 44 * 27);height:var(--swiper-navigation-size);margin-top:calc(0px - (var(--swiper-navigation-size)/ 2));z-index:10;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--swiper-navigation-color,var(--swiper-theme-color))}.swiper-button-next.swiper-button-disabled,.swiper-button-prev.swiper-button-disabled{opacity:.35;cursor:auto;pointer-events:none}.swiper-button-next:after,.swiper-button-prev:after{font-family:swiper-icons;font-size:var(--swiper-navigation-size);text-transform:none!important;letter-spacing:0;text-transform:none;font-variant:initial;line-height:1}.swiper-button-prev,.swiper-rtl .swiper-button-next{left:10px;right:auto}.swiper-button-prev:after,.swiper-rtl .swiper-button-next:after{content:'prev'}.swiper-button-next,.swiper-rtl .swiper-button-prev{right:10px;left:auto}.swiper-button-next:after,.swiper-rtl .swiper-button-prev:after{content:'next'}.swiper-button-lock{display:none} | ||||
|  | @ -0,0 +1,56 @@ | |||
| @import '../../swiper-vars.scss'; | ||||
| 
 | ||||
| :root { | ||||
|   --swiper-navigation-size: 44px; | ||||
|   /* | ||||
|   --swiper-navigation-color: var(--swiper-theme-color); | ||||
|   */ | ||||
| } | ||||
| .swiper-button-prev, | ||||
| .swiper-button-next { | ||||
|   position: absolute; | ||||
|   top: 50%; | ||||
|   width: calc(var(--swiper-navigation-size) / 44 * 27); | ||||
|   height: var(--swiper-navigation-size); | ||||
|   margin-top: calc(0px - (var(--swiper-navigation-size) / 2)); | ||||
|   z-index: 10; | ||||
|   cursor: pointer; | ||||
|   display: flex; | ||||
|   align-items: center; | ||||
|   justify-content: center; | ||||
|   color: var(--swiper-navigation-color, var(--swiper-theme-color)); | ||||
|   &.swiper-button-disabled { | ||||
|     opacity: 0.35; | ||||
|     cursor: auto; | ||||
|     pointer-events: none; | ||||
|   } | ||||
|   &:after { | ||||
|     font-family: swiper-icons; | ||||
|     font-size: var(--swiper-navigation-size); | ||||
|     text-transform: none !important; | ||||
|     letter-spacing: 0; | ||||
|     text-transform: none; | ||||
|     font-variant: initial; | ||||
|     line-height: 1; | ||||
|   } | ||||
| } | ||||
| .swiper-button-prev, | ||||
| .swiper-rtl .swiper-button-next { | ||||
|   &:after { | ||||
|     content: 'prev'; | ||||
|   } | ||||
|   left: 10px; | ||||
|   right: auto; | ||||
| } | ||||
| .swiper-button-next, | ||||
| .swiper-rtl .swiper-button-prev { | ||||
|   &:after { | ||||
|     content: 'next'; | ||||
|   } | ||||
|   right: 10px; | ||||
|   left: auto; | ||||
| } | ||||
| 
 | ||||
| .swiper-button-lock { | ||||
|   display: none; | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 zorro.zhang
						zorro.zhang