@c4h/chuci 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/chuci.js CHANGED
@@ -3669,7 +3669,7 @@ class os extends zr {
3669
3669
  justify-content: center;
3670
3670
  cursor: pointer;
3671
3671
  transition: background 0.3s;
3672
- z-index: 1002;
3672
+ z-index: calc(var(--cc-viewer-z-index-each, 1000) + 2);
3673
3673
  pointer-events: auto;
3674
3674
  }
3675
3675
 
@@ -21278,7 +21278,7 @@ class a_ extends os {
21278
21278
  const i = this.container.clientWidth || this.container.offsetWidth, n = this.container.clientHeight || this.container.offsetHeight;
21279
21279
  this.camera = new ri(75, i / n, 0.1, 1e3), this.renderer = new LA({ antialias: !0, alpha: !0 }), this.renderer.setSize(i, n), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.shadowMap.enabled = !0;
21280
21280
  const r = this.renderer.domElement;
21281
- r.style.position = "fixed", r.style.left = `${t.left}px`, r.style.top = `${t.top}px`, r.style.width = `${t.width}px`, r.style.height = `${t.height}px`, r.style.pointerEvents = "auto", r.style.zIndex = "1001", document.body.appendChild(r), this.externalCanvas = r, this.controls = new ZA(this.camera, r), this.controls.enableDamping = !0, this.controls.dampingFactor = 0.05;
21281
+ r.style.position = "fixed", r.style.left = `${t.left}px`, r.style.top = `${t.top}px`, r.style.width = `${t.width}px`, r.style.height = `${t.height}px`, r.style.pointerEvents = "auto", r.style.zIndex = "calc(var(--cc-viewer-z-index-each, 1000) + 1)", document.body.appendChild(r), this.externalCanvas = r, this.controls = new ZA(this.camera, r), this.controls.enableDamping = !0, this.controls.dampingFactor = 0.05;
21282
21282
  const a = new jp(4210752, 2), o = new Kp(16777215, 1);
21283
21283
  o.position.set(1, 1, 1), this.scene.add(a, o), await this.loadModel(), this.resizeObserver = new ResizeObserver((c) => {
21284
21284
  for (const l of c) {
@@ -21541,7 +21541,7 @@ ${this.getTargetDebugInfo()}
21541
21541
  if (!i) return;
21542
21542
  const n = i.getBoundingClientRect();
21543
21543
  let r = document.getElementById(t);
21544
- r || (r = document.createElement("canvas"), r.id = t, r.style.position = "fixed", r.style.top = `${n.top}px`, r.style.left = `${n.left}px`, r.style.width = `${n.width}px`, r.style.height = `${n.height}px`, r.style.zIndex = "1001", r.style.pointerEvents = "auto", r.style.display = "block", r.style.background = "transparent", document.body.appendChild(r)), r.style.top = `${n.top}px`, r.style.left = `${n.left}px`, r.style.width = `${n.width}px`, r.style.height = `${n.height}px`, this.canvas = r;
21544
+ r || (r = document.createElement("canvas"), r.id = t, r.style.position = "fixed", r.style.top = `${n.top}px`, r.style.left = `${n.left}px`, r.style.width = `${n.width}px`, r.style.height = `${n.height}px`, r.style.zIndex = "calc(var(--cc-viewer-z-index-each, 1000) + 1)", r.style.pointerEvents = "auto", r.style.display = "block", r.style.background = "transparent", document.body.appendChild(r)), r.style.top = `${n.top}px`, r.style.left = `${n.left}px`, r.style.width = `${n.width}px`, r.style.height = `${n.height}px`, this.canvas = r;
21545
21545
  try {
21546
21546
  const a = this.query(".gaussian-container");
21547
21547
  if (!a) return;
package/dist/chuci.umd.js CHANGED
@@ -233,7 +233,7 @@
233
233
  justify-content: center;
234
234
  cursor: pointer;
235
235
  transition: background 0.3s;
236
- z-index: 1002;
236
+ z-index: calc(var(--cc-viewer-z-index-each, 1000) + 2);
237
237
  pointer-events: auto;
238
238
  }
239
239
 
@@ -4339,7 +4339,7 @@ void main() {
4339
4339
  Camera Position: ${this.getCameraDebugInfo()}<br>
4340
4340
  Camera Target: ${this.getTargetDebugInfo()}<br>
4341
4341
  Controls: Rotate (drag), Zoom (scroll), Pan (right-drag)
4342
- `)}async initializeViewer(){if(await new Promise(i=>setTimeout(i,50)),this.container=this.query(".model-container"),!this.container)return;const t=this.container.getBoundingClientRect();try{this.scene=new Np,this.scene.background=new Pe(3158064);const i=this.container.clientWidth||this.container.offsetWidth,n=this.container.clientHeight||this.container.offsetHeight;this.camera=new si(75,i/n,.1,1e3),this.renderer=new tA({antialias:!0,alpha:!0}),this.renderer.setSize(i,n),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.shadowMap.enabled=!0;const r=this.renderer.domElement;r.style.position="fixed",r.style.left=`${t.left}px`,r.style.top=`${t.top}px`,r.style.width=`${t.width}px`,r.style.height=`${t.height}px`,r.style.pointerEvents="auto",r.style.zIndex="1001",document.body.appendChild(r),this.externalCanvas=r,this.controls=new hA(this.camera,r),this.controls.enableDamping=!0,this.controls.dampingFactor=.05;const a=new Yp(4210752,2),o=new Xp(16777215,1);o.position.set(1,1,1),this.scene.add(a,o),await this.loadModel(),this.resizeObserver=new ResizeObserver(c=>{for(const l of c){const{width:d,height:h}=l.contentRect;d>0&&h>0&&this.handleResize()}}),this.resizeObserver.observe(this.container),this.animateLoop()}catch(i){throw i}}async loadModel(){const t=new oA;try{if(this.materialUrl){const h=new lA,u=this.materialUrl.substring(0,this.materialUrl.lastIndexOf("/")+1);h.setPath(u);const p=await new Promise((g,v)=>{const m=this.materialUrl.substring(this.materialUrl.lastIndexOf("/")+1);h.load(m,g,void 0,v)});p.preload(),t.setMaterials(p)}const i=this.modelUrl.substring(0,this.modelUrl.lastIndexOf("/")+1);t.setPath(i);const n=await new Promise((h,u)=>{const p=this.modelUrl.substring(this.modelUrl.lastIndexOf("/")+1);t.load(p,h,void 0,u)}),r=new Kn().setFromObject(n),a=new W;r.getSize(a);const o=Math.max(a.x,a.y,a.z);n.scale.multiplyScalar(3/o);const c=new W;if(r.getCenter(c),n.position.sub(c.multiplyScalar(n.scale.x)),!this.scene)return;this.scene.add(n),this.currentModel=n,this.storeOriginalMaterials(n);const l=this.cameraPosition.split(",").map(h=>parseFloat(h.trim())),d=this.cameraTarget.split(",").map(h=>parseFloat(h.trim()));l.length===3&&this.camera.position.set(l[0],l[1],l[2]),d.length===3&&(this.camera.lookAt(d[0],d[1],d[2]),this.controls.target.set(d[0],d[1],d[2])),this.controls.update(),this.renderer&&this.scene&&this.camera&&this.renderer.render(this.scene,this.camera)}catch(i){throw i}}handleResize(){if(!this.container||!this.camera||!this.renderer)return;const t=this.container.getBoundingClientRect(),i=t.width,n=t.height;if(i>0&&n>0){this.camera.aspect=i/n,this.camera.updateProjectionMatrix(),this.renderer.setSize(i,n);const r=this.renderer.domElement;r.style.left=`${t.left}px`,r.style.top=`${t.top}px`,r.style.width=`${t.width}px`,r.style.height=`${t.height}px`}}}customElements.get("cc-viewer-3dmodel")||customElements.define("cc-viewer-3dmodel",th);class ih extends sn{constructor(){super(...arguments);Se(this,"splatUrl","");Se(this,"debugMode",!1);Se(this,"cameraPosition","3,3,3");Se(this,"_cameraTarget","0,0,0");Se(this,"scene");Se(this,"camera");Se(this,"renderer");Se(this,"controls");Se(this,"animationId");Se(this,"canvas");Se(this,"swiper")}static get observedAttributes(){return["show","debug-mode","camera-position","camera-target"]}attributeChangedCallback(t,i,n){t==="show"?this.isShow=n==="true":t==="debug-mode"?this.debugMode=n==="true":t==="camera-position"?this.cameraPosition=n||"3,3,3":t==="camera-target"&&(this._cameraTarget=n||"0,0,0"),super.attributeChangedCallback(t,i,n)}async doOpen(t){this.splatUrl=t,await this.initializeViewer()}doClose(){this.cleanup()}getViewerContent(){return""}shouldUseCustomRender(){return!0}customRender(){const t=this.css`
4342
+ `)}async initializeViewer(){if(await new Promise(i=>setTimeout(i,50)),this.container=this.query(".model-container"),!this.container)return;const t=this.container.getBoundingClientRect();try{this.scene=new Np,this.scene.background=new Pe(3158064);const i=this.container.clientWidth||this.container.offsetWidth,n=this.container.clientHeight||this.container.offsetHeight;this.camera=new si(75,i/n,.1,1e3),this.renderer=new tA({antialias:!0,alpha:!0}),this.renderer.setSize(i,n),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.shadowMap.enabled=!0;const r=this.renderer.domElement;r.style.position="fixed",r.style.left=`${t.left}px`,r.style.top=`${t.top}px`,r.style.width=`${t.width}px`,r.style.height=`${t.height}px`,r.style.pointerEvents="auto",r.style.zIndex="calc(var(--cc-viewer-z-index-each, 1000) + 1)",document.body.appendChild(r),this.externalCanvas=r,this.controls=new hA(this.camera,r),this.controls.enableDamping=!0,this.controls.dampingFactor=.05;const a=new Yp(4210752,2),o=new Xp(16777215,1);o.position.set(1,1,1),this.scene.add(a,o),await this.loadModel(),this.resizeObserver=new ResizeObserver(c=>{for(const l of c){const{width:d,height:h}=l.contentRect;d>0&&h>0&&this.handleResize()}}),this.resizeObserver.observe(this.container),this.animateLoop()}catch(i){throw i}}async loadModel(){const t=new oA;try{if(this.materialUrl){const h=new lA,u=this.materialUrl.substring(0,this.materialUrl.lastIndexOf("/")+1);h.setPath(u);const p=await new Promise((g,v)=>{const m=this.materialUrl.substring(this.materialUrl.lastIndexOf("/")+1);h.load(m,g,void 0,v)});p.preload(),t.setMaterials(p)}const i=this.modelUrl.substring(0,this.modelUrl.lastIndexOf("/")+1);t.setPath(i);const n=await new Promise((h,u)=>{const p=this.modelUrl.substring(this.modelUrl.lastIndexOf("/")+1);t.load(p,h,void 0,u)}),r=new Kn().setFromObject(n),a=new W;r.getSize(a);const o=Math.max(a.x,a.y,a.z);n.scale.multiplyScalar(3/o);const c=new W;if(r.getCenter(c),n.position.sub(c.multiplyScalar(n.scale.x)),!this.scene)return;this.scene.add(n),this.currentModel=n,this.storeOriginalMaterials(n);const l=this.cameraPosition.split(",").map(h=>parseFloat(h.trim())),d=this.cameraTarget.split(",").map(h=>parseFloat(h.trim()));l.length===3&&this.camera.position.set(l[0],l[1],l[2]),d.length===3&&(this.camera.lookAt(d[0],d[1],d[2]),this.controls.target.set(d[0],d[1],d[2])),this.controls.update(),this.renderer&&this.scene&&this.camera&&this.renderer.render(this.scene,this.camera)}catch(i){throw i}}handleResize(){if(!this.container||!this.camera||!this.renderer)return;const t=this.container.getBoundingClientRect(),i=t.width,n=t.height;if(i>0&&n>0){this.camera.aspect=i/n,this.camera.updateProjectionMatrix(),this.renderer.setSize(i,n);const r=this.renderer.domElement;r.style.left=`${t.left}px`,r.style.top=`${t.top}px`,r.style.width=`${t.width}px`,r.style.height=`${t.height}px`}}}customElements.get("cc-viewer-3dmodel")||customElements.define("cc-viewer-3dmodel",th);class ih extends sn{constructor(){super(...arguments);Se(this,"splatUrl","");Se(this,"debugMode",!1);Se(this,"cameraPosition","3,3,3");Se(this,"_cameraTarget","0,0,0");Se(this,"scene");Se(this,"camera");Se(this,"renderer");Se(this,"controls");Se(this,"animationId");Se(this,"canvas");Se(this,"swiper")}static get observedAttributes(){return["show","debug-mode","camera-position","camera-target"]}attributeChangedCallback(t,i,n){t==="show"?this.isShow=n==="true":t==="debug-mode"?this.debugMode=n==="true":t==="camera-position"?this.cameraPosition=n||"3,3,3":t==="camera-target"&&(this._cameraTarget=n||"0,0,0"),super.attributeChangedCallback(t,i,n)}async doOpen(t){this.splatUrl=t,await this.initializeViewer()}doClose(){this.cleanup()}getViewerContent(){return""}shouldUseCustomRender(){return!0}customRender(){const t=this.css`
4343
4343
  :host {
4344
4344
  --cc-viewer-z-index-each: 1000;
4345
4345
  }
@@ -4468,7 +4468,7 @@ ${this.getTargetDebugInfo()}
4468
4468
  • Pan: Right-drag or Shift+Left-drag
4469
4469
 
4470
4470
  📊 Status: ${this.scene?"Splat loaded":"Loading..."}
4471
- `)}async initializeViewer(){const t=`gaussian-canvas-${Date.now()}`,i=this.query(".viewer");if(!i)return;const n=i.getBoundingClientRect();let r=document.getElementById(t);r||(r=document.createElement("canvas"),r.id=t,r.style.position="fixed",r.style.top=`${n.top}px`,r.style.left=`${n.left}px`,r.style.width=`${n.width}px`,r.style.height=`${n.height}px`,r.style.zIndex="1001",r.style.pointerEvents="auto",r.style.display="block",r.style.background="transparent",document.body.appendChild(r)),r.style.top=`${n.top}px`,r.style.left=`${n.left}px`,r.style.width=`${n.width}px`,r.style.height=`${n.height}px`,this.canvas=r;try{const a=this.query(".gaussian-container");if(!a)return;const o=await Promise.resolve().then(()=>jA);this.scene=new o.Scene,this.camera=new o.Camera,this.renderer=new o.WebGLRenderer(this.canvas),this.controls=new o.OrbitControls(this.camera,this.canvas),await o.Loader.LoadAsync(this.splatUrl,this.scene);let c=0;const l=()=>{if(!(!this.renderer||!this.scene||!this.camera)){this.animationId=requestAnimationFrame(l),this.controls&&this.controls.update();try{this.renderer.render(this.scene,this.camera)}catch{}c===0&&this.canvas&&c++,this.debugMode&&this.updateDebugInfo()}};l(),new ResizeObserver(()=>{this.handleResize()}).observe(a)}catch(a){throw a}}handleResize(){const t=this.query(".gaussian-container");if(!t||!this.renderer||!this.camera)return;const i=t.clientWidth,n=t.clientHeight;typeof this.renderer.setSize=="function"&&this.renderer.setSize(i,n),typeof this.camera.aspect<"u"&&(this.camera.aspect=i/n,typeof this.camera.updateProjectionMatrix=="function"&&this.camera.updateProjectionMatrix())}}customElements.get("cc-viewer-gaussian")||customElements.define("cc-viewer-gaussian",ih);const Gr={image:"cc-viewer-image",panorama:"cc-viewer-panorama",youtube:"cc-viewer-youtube",video:"cc-viewer-video","3dmodel":"cc-viewer-3dmodel",gaussian:"cc-viewer-gaussian"};class nh extends xi{constructor(){super(...arguments);Se(this,"swiper");Se(this,"currentSlideIndex",0);Se(this,"currentType","");Se(this,"boundHandleNavigatePrev");Se(this,"boundHandleNavigateNext")}open(t,i,n){const r=this.currentType;if(this.currentType=i,r&&r!==i){const a=Gr[r],o=this.query(a);o&&o.close&&o.close()}r!==i&&this.render(),setTimeout(()=>{const a=Gr[i],o=this.query(a);o&&n&&Object.entries(n).forEach(([c,l])=>{const d=c.replace(/([A-Z])/g,"-$1").toLowerCase();typeof l=="boolean"?l?o.setAttribute(d,""):o.removeAttribute(d):o.setAttribute(d,String(l))}),this.updateNavigationButtons(),o&&o.open(t)},0)}firstUpdated(){this.dispatch("load"),this.boundHandleNavigatePrev&&this.removeEventListener("navigate-prev",this.boundHandleNavigatePrev),this.boundHandleNavigateNext&&this.removeEventListener("navigate-next",this.boundHandleNavigateNext),this.boundHandleNavigatePrev=this.handleNavigatePrev.bind(this),this.boundHandleNavigateNext=this.handleNavigateNext.bind(this),this.addEventListener("navigate-prev",this.boundHandleNavigatePrev),this.addEventListener("navigate-next",this.boundHandleNavigateNext)}handleNavigatePrev(t){var r,a;if(!this.swiper)return;const i=this.swiper.slides.length;if(i<=1)return;const n=((a=(r=this.swiper.slider)==null?void 0:r.params)==null?void 0:a.loop)===!0;if(this.currentSlideIndex<=0)if(n)this.currentSlideIndex=i-1;else return;else this.currentSlideIndex--;this.navigateToSlide(this.currentSlideIndex)}handleNavigateNext(t){var r,a;if(!this.swiper)return;const i=this.swiper.slides.length;if(i<=1)return;const n=((a=(r=this.swiper.slider)==null?void 0:r.params)==null?void 0:a.loop)===!0;if(this.currentSlideIndex>=i-1)if(n)this.currentSlideIndex=0;else return;else this.currentSlideIndex++;this.navigateToSlide(this.currentSlideIndex)}navigateToSlide(t){if(!this.swiper||!this.swiper.slides[t])return;const i=this.swiper.slides[t],n=i.getAttribute("image-url")||"",r=i.getAttribute("image-type")||"image",a=Gr[this.currentType],o=this.query(a);o&&o.close();const c={};i.hasAttribute("fit-to-container")&&(c.fitToContainer=!0),i.hasAttribute("debug-mode")&&(c.debugMode=!0),i.hasAttribute("camera-position")&&(c.cameraPosition=i.getAttribute("camera-position")),i.hasAttribute("camera-target")&&(c.cameraTarget=i.getAttribute("camera-target")),i.hasAttribute("show-texture")&&(c.showTexture=i.getAttribute("show-texture")==="true"),i.hasAttribute("material-url")&&(c.materialUrl=i.getAttribute("material-url")),this.currentSlideIndex=t,this.open(n,r,c),this.swiper.slider&&this.swiper.slider.slideTo(t)}updateNavigationButtons(){var a,o;if(!this.swiper)return;const t=this.swiper.slides.length,i=((o=(a=this.swiper.slider)==null?void 0:a.params)==null?void 0:o.loop)===!0;if(t<=1){this.setNavigationVisibility(!1,!1);return}if(i){this.setNavigationVisibility(!0,!0);return}const n=this.currentSlideIndex>0,r=this.currentSlideIndex<t-1;this.setNavigationVisibility(n,r)}setNavigationVisibility(t,i){[this.query("cc-viewer-image"),this.query("cc-viewer-youtube"),this.query("cc-viewer-panorama"),this.query("cc-viewer-video"),this.query("cc-viewer-3dmodel"),this.query("cc-viewer-gaussian")].forEach(r=>{if(r){const a=r;a.showPrevButton=t,a.showNextButton=i}})}setSwiper(t){this.swiper=t}setCurrentSlideIndex(t){this.currentSlideIndex=t}render(){const t=this.css`
4471
+ `)}async initializeViewer(){const t=`gaussian-canvas-${Date.now()}`,i=this.query(".viewer");if(!i)return;const n=i.getBoundingClientRect();let r=document.getElementById(t);r||(r=document.createElement("canvas"),r.id=t,r.style.position="fixed",r.style.top=`${n.top}px`,r.style.left=`${n.left}px`,r.style.width=`${n.width}px`,r.style.height=`${n.height}px`,r.style.zIndex="calc(var(--cc-viewer-z-index-each, 1000) + 1)",r.style.pointerEvents="auto",r.style.display="block",r.style.background="transparent",document.body.appendChild(r)),r.style.top=`${n.top}px`,r.style.left=`${n.left}px`,r.style.width=`${n.width}px`,r.style.height=`${n.height}px`,this.canvas=r;try{const a=this.query(".gaussian-container");if(!a)return;const o=await Promise.resolve().then(()=>jA);this.scene=new o.Scene,this.camera=new o.Camera,this.renderer=new o.WebGLRenderer(this.canvas),this.controls=new o.OrbitControls(this.camera,this.canvas),await o.Loader.LoadAsync(this.splatUrl,this.scene);let c=0;const l=()=>{if(!(!this.renderer||!this.scene||!this.camera)){this.animationId=requestAnimationFrame(l),this.controls&&this.controls.update();try{this.renderer.render(this.scene,this.camera)}catch{}c===0&&this.canvas&&c++,this.debugMode&&this.updateDebugInfo()}};l(),new ResizeObserver(()=>{this.handleResize()}).observe(a)}catch(a){throw a}}handleResize(){const t=this.query(".gaussian-container");if(!t||!this.renderer||!this.camera)return;const i=t.clientWidth,n=t.clientHeight;typeof this.renderer.setSize=="function"&&this.renderer.setSize(i,n),typeof this.camera.aspect<"u"&&(this.camera.aspect=i/n,typeof this.camera.updateProjectionMatrix=="function"&&this.camera.updateProjectionMatrix())}}customElements.get("cc-viewer-gaussian")||customElements.define("cc-viewer-gaussian",ih);const Gr={image:"cc-viewer-image",panorama:"cc-viewer-panorama",youtube:"cc-viewer-youtube",video:"cc-viewer-video","3dmodel":"cc-viewer-3dmodel",gaussian:"cc-viewer-gaussian"};class nh extends xi{constructor(){super(...arguments);Se(this,"swiper");Se(this,"currentSlideIndex",0);Se(this,"currentType","");Se(this,"boundHandleNavigatePrev");Se(this,"boundHandleNavigateNext")}open(t,i,n){const r=this.currentType;if(this.currentType=i,r&&r!==i){const a=Gr[r],o=this.query(a);o&&o.close&&o.close()}r!==i&&this.render(),setTimeout(()=>{const a=Gr[i],o=this.query(a);o&&n&&Object.entries(n).forEach(([c,l])=>{const d=c.replace(/([A-Z])/g,"-$1").toLowerCase();typeof l=="boolean"?l?o.setAttribute(d,""):o.removeAttribute(d):o.setAttribute(d,String(l))}),this.updateNavigationButtons(),o&&o.open(t)},0)}firstUpdated(){this.dispatch("load"),this.boundHandleNavigatePrev&&this.removeEventListener("navigate-prev",this.boundHandleNavigatePrev),this.boundHandleNavigateNext&&this.removeEventListener("navigate-next",this.boundHandleNavigateNext),this.boundHandleNavigatePrev=this.handleNavigatePrev.bind(this),this.boundHandleNavigateNext=this.handleNavigateNext.bind(this),this.addEventListener("navigate-prev",this.boundHandleNavigatePrev),this.addEventListener("navigate-next",this.boundHandleNavigateNext)}handleNavigatePrev(t){var r,a;if(!this.swiper)return;const i=this.swiper.slides.length;if(i<=1)return;const n=((a=(r=this.swiper.slider)==null?void 0:r.params)==null?void 0:a.loop)===!0;if(this.currentSlideIndex<=0)if(n)this.currentSlideIndex=i-1;else return;else this.currentSlideIndex--;this.navigateToSlide(this.currentSlideIndex)}handleNavigateNext(t){var r,a;if(!this.swiper)return;const i=this.swiper.slides.length;if(i<=1)return;const n=((a=(r=this.swiper.slider)==null?void 0:r.params)==null?void 0:a.loop)===!0;if(this.currentSlideIndex>=i-1)if(n)this.currentSlideIndex=0;else return;else this.currentSlideIndex++;this.navigateToSlide(this.currentSlideIndex)}navigateToSlide(t){if(!this.swiper||!this.swiper.slides[t])return;const i=this.swiper.slides[t],n=i.getAttribute("image-url")||"",r=i.getAttribute("image-type")||"image",a=Gr[this.currentType],o=this.query(a);o&&o.close();const c={};i.hasAttribute("fit-to-container")&&(c.fitToContainer=!0),i.hasAttribute("debug-mode")&&(c.debugMode=!0),i.hasAttribute("camera-position")&&(c.cameraPosition=i.getAttribute("camera-position")),i.hasAttribute("camera-target")&&(c.cameraTarget=i.getAttribute("camera-target")),i.hasAttribute("show-texture")&&(c.showTexture=i.getAttribute("show-texture")==="true"),i.hasAttribute("material-url")&&(c.materialUrl=i.getAttribute("material-url")),this.currentSlideIndex=t,this.open(n,r,c),this.swiper.slider&&this.swiper.slider.slideTo(t)}updateNavigationButtons(){var a,o;if(!this.swiper)return;const t=this.swiper.slides.length,i=((o=(a=this.swiper.slider)==null?void 0:a.params)==null?void 0:o.loop)===!0;if(t<=1){this.setNavigationVisibility(!1,!1);return}if(i){this.setNavigationVisibility(!0,!0);return}const n=this.currentSlideIndex>0,r=this.currentSlideIndex<t-1;this.setNavigationVisibility(n,r)}setNavigationVisibility(t,i){[this.query("cc-viewer-image"),this.query("cc-viewer-youtube"),this.query("cc-viewer-panorama"),this.query("cc-viewer-video"),this.query("cc-viewer-3dmodel"),this.query("cc-viewer-gaussian")].forEach(r=>{if(r){const a=r;a.showPrevButton=t,a.showNextButton=i}})}setSwiper(t){this.swiper=t}setCurrentSlideIndex(t){this.currentSlideIndex=t}render(){const t=this.css`
4472
4472
  :host {
4473
4473
  --cc-viewer-z-index: 1000;
4474
4474
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4h/chuci",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Standalone multimedia swiper and viewer web components",
5
5
  "type": "module",
6
6
  "private": false,
@@ -325,7 +325,7 @@ export class CcViewer3DModel extends CcViewerBase {
325
325
  canvas.style.width = `${rect.width}px`
326
326
  canvas.style.height = `${rect.height}px`
327
327
  canvas.style.pointerEvents = 'auto'
328
- canvas.style.zIndex = '1001'
328
+ canvas.style.zIndex = 'calc(var(--cc-viewer-z-index-each, 1000) + 1)'
329
329
  document.body.appendChild(canvas)
330
330
 
331
331
  // Store canvas reference for cleanup
@@ -200,7 +200,7 @@ export abstract class CcViewerBase extends ChuciElement {
200
200
  justify-content: center;
201
201
  cursor: pointer;
202
202
  transition: background 0.3s;
203
- z-index: 1002;
203
+ z-index: calc(var(--cc-viewer-z-index-each, 1000) + 2);
204
204
  pointer-events: auto;
205
205
  }
206
206
 
@@ -276,7 +276,7 @@ ${this.getTargetDebugInfo()}
276
276
  normalCanvas.style.left = `${rect.left}px`
277
277
  normalCanvas.style.width = `${rect.width}px`
278
278
  normalCanvas.style.height = `${rect.height}px`
279
- normalCanvas.style.zIndex = '1001' // Above backdrop but below buttons
279
+ normalCanvas.style.zIndex = 'calc(var(--cc-viewer-z-index-each, 1000) + 1)' // Above backdrop but below buttons
280
280
  normalCanvas.style.pointerEvents = 'auto' // Keep mouse events for 3D controls
281
281
  normalCanvas.style.display = 'block'
282
282
  normalCanvas.style.background = 'transparent'