@ray-js/robot-map-sdk 0.0.3-beta-20 → 0.0.3-beta-22
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/components/Base/FixedSizeDOMContainer.js +1 -1
- package/dist/components/CustomElements/CustomHTML.js +1 -1
- package/dist/index.d.ts +0 -16
- package/dist/index.rjs.js +1 -1
- package/dist-app/assets/index-ClwjZGGG.js +1 -0
- package/dist-app/index.html +1 -1
- package/dist-docs/404.html +2 -2
- package/dist-docs/assets/{app.DP1O8BNS.js → app.BicAfu20.js} +1 -1
- package/dist-docs/assets/chunks/@localSearchIndexroot.DWUbE27y.js +1 -0
- package/dist-docs/assets/chunks/{VPLocalSearchBox.UpWCcVfL.js → VPLocalSearchBox.DZvQsvt0.js} +1 -1
- package/dist-docs/assets/chunks/{theme.uu9-XYwr.js → theme.CaW7AOG2.js} +2 -2
- package/dist-docs/assets/{guide_getting-started.md.u5zOtdU6.js → guide_getting-started.md.CbqDbiIS.js} +1 -1
- package/dist-docs/assets/{reference_types.md.g_JJ8gNY.js → reference_types.md.BP8Uwg9a.js} +15 -17
- package/dist-docs/assets/{reference_types.md.g_JJ8gNY.lean.js → reference_types.md.BP8Uwg9a.lean.js} +1 -1
- package/dist-docs/guide/advanced-usage.html +3 -3
- package/dist-docs/guide/concepts.html +3 -3
- package/dist-docs/guide/getting-started.html +5 -5
- package/dist-docs/hashmap.json +1 -1
- package/dist-docs/index.html +3 -3
- package/dist-docs/reference/callbacks.html +3 -3
- package/dist-docs/reference/config.html +3 -3
- package/dist-docs/reference/data.html +3 -3
- package/dist-docs/reference/methods.html +3 -3
- package/dist-docs/reference/runtime.html +3 -3
- package/dist-docs/reference/types.html +19 -21
- package/dist-docs/reference/utils.html +3 -3
- package/package.json +2 -2
- package/dist-app/assets/index-CMaxpPPD.js +0 -1
- package/dist-docs/assets/chunks/@localSearchIndexroot.BXv7BdiO.js +0 -1
- /package/dist-docs/assets/{guide_getting-started.md.u5zOtdU6.lean.js → guide_getting-started.md.CbqDbiIS.lean.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DOMContainer as e}from"pixi.js";import{throttle as t}from"lodash-es";import{useAppService as i}from"../../application/AppService.js";class s extends e{throttledUpdateScale;fixedWidth=0;fixedHeight=0;isFixedSizeSet=!1;constructor(e){super(e),this.anchor.set(
|
|
1
|
+
import{DOMContainer as e}from"pixi.js";import{throttle as t}from"lodash-es";import{useAppService as i}from"../../application/AppService.js";class s extends e{throttledUpdateScale;fixedWidth=0;fixedHeight=0;isFixedSizeSet=!1;userCenterX=0;userCenterY=0;constructor(e){super(e),this.anchor.set(0,0),this.throttledUpdateScale=t(this.updateScale.bind(this),30,{leading:!0,trailing:!0}),this.registerScaleListener()}setFixedSize(e,t){this.fixedWidth=e,this.fixedHeight=t,this.isFixedSizeSet=!0,this.applyFixedSize(),this.updatePositionFromCenter()}setCenterPosition(e,t){this.userCenterX=e,this.userCenterY=t,this.updatePositionFromCenter()}updatePositionFromCenter(){if(!this.isFixedSizeSet)return void this.position.set(this.userCenterX,this.userCenterY);const e=i().currentScale,t=this.fixedWidth/2/e,s=this.fixedHeight/2/e;this.position.set(this.userCenterX-t,this.userCenterY-s)}registerScaleListener(){i().emitter.on("antiScale",this.throttledUpdateScale)}applyFixedSize(){if(!this.isFixedSizeSet)return;const e=i().currentScale;if(0===e)return;const t=1/e;this.scale.set(t),this.element&&(this.element.style.width=`${this.fixedWidth}px`,this.element.style.height=`${this.fixedHeight}px`)}updateScale(e){this.isFixedSizeSet&&0!==e&&(this.applyFixedSize(),this.updatePositionFromCenter())}updateTransform(e){return super.updateTransform(e)}destroy(e){i().emitter.off("antiScale",this.throttledUpdateScale),super.destroy(e)}}export{s as FixedSizeDOMContainer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FixedSizeDOMContainer as e}from"../Base/FixedSizeDOMContainer.js";import{useAppService as t}from"../../application/AppService.js";class i extends e{elementData;domClickHandler=null;resizeObserver=null;constructor(e){const t=document.createElement("div");i.setupDefaultStyles(t,e),t.innerHTML=e.htmlContent,super({element:t}),this.elementData=e}async initialize(){this.alpha=0,this.
|
|
1
|
+
import{FixedSizeDOMContainer as e}from"../Base/FixedSizeDOMContainer.js";import{useAppService as t}from"../../application/AppService.js";class i extends e{elementData;domClickHandler=null;resizeObserver=null;debugMarker=null;constructor(e){const t=document.createElement("div");i.setupDefaultStyles(t,e),t.innerHTML=e.htmlContent,super({element:t}),this.elementData=e}async initialize(){this.alpha=0,this.elementData.width&&this.elementData.height?(this.setFixedSize(this.elementData.width,this.elementData.height),this.setCenterPosition(this.elementData.x,this.elementData.y),this.waitForElementInsertion()):(this.position.set(this.elementData.x,this.elementData.y),this.setupAutoSize()),void 0!==this.elementData.rotation&&(this.rotation=this.elementData.rotation),this.elementData.interactive?this.setupClickHandler():this.eventMode="none"}setupAutoSize(){this.element&&(this.element.style.width="auto",this.element.style.height="auto",this.waitForElementDimensions())}waitForElementInsertion(){if(!this.element)return;const e=()=>{this.element&&(this.element.isConnected?this.showElement():requestAnimationFrame(e))};requestAnimationFrame(e)}waitForElementDimensions(){this.element&&("undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(e=>{const t=e[0];t&&t.contentRect.width>0&&t.contentRect.height>0&&(this.setFixedSize(t.contentRect.width,t.contentRect.height),this.setCenterPosition(this.elementData.x,this.elementData.y),0===this.alpha&&this.showElement(),this.resizeObserver?.disconnect(),this.resizeObserver=null)}),this.resizeObserver.observe(this.element)):this.pollForElementDimensions())}pollForElementDimensions(){if(!this.element)return;const e=()=>{if(!this.element)return;if(!this.element.isConnected)return void requestAnimationFrame(e);const t=this.element.getBoundingClientRect();t.width>0&&t.height>0?(this.setFixedSize(t.width,t.height),this.setCenterPosition(this.elementData.x,this.elementData.y),0===this.alpha&&this.showElement()):requestAnimationFrame(e)};requestAnimationFrame(e)}showElement(){this.alpha=this.elementData.opacity??1,this.element.style.pointerEvents=this.elementData.interactive?"auto":"none",this.interactive=this.elementData.interactive??!1,this.elementData.interactive&&this.element&&(this.element.style.setProperty("-webkit-tap-highlight-color","transparent"),this.element.style.setProperty("-webkit-touch-callout","none")),t().getApp().renderOnceNextFrame()}setupClickHandler(){this.element&&(this.domClickHandler=e=>{e.preventDefault(),e.stopPropagation(),this.handleClick()},this.element.addEventListener("click",this.domClickHandler))}handleClick(){const e=t();e.events?.onClickCustomElement?.(this.getElementData())}getElementData(){return{...this.elementData}}async updateElementData(e){const t=this.elementData;this.elementData=e,t.htmlContent!==e.htmlContent&&this.element&&(this.element.innerHTML=e.htmlContent,e.width&&e.height||this.waitForElementDimensions()),t.width===e.width&&t.height===e.height||(e.width&&e.height?(this.setFixedSize(e.width,e.height),this.element&&(this.element.style.width=`${e.width}px`,this.element.style.height=`${e.height}px`)):this.setupAutoSize()),e.width&&e.height?this.setCenterPosition(e.x,e.y):this.position.set(e.x,e.y),this.rotation=e.rotation??0,this.alpha=e.opacity??1,e.interactive?this.domClickHandler||this.setupClickHandler():(this.eventMode="none",this.domClickHandler&&this.element&&(this.element.removeEventListener("click",this.domClickHandler),this.domClickHandler=null))}isSameData(e){return this.elementData.id===e.id&&this.elementData.type===e.type&&this.elementData.htmlContent===e.htmlContent&&this.elementData.x===e.x&&this.elementData.y===e.y&&this.elementData.width===e.width&&this.elementData.height===e.height&&this.elementData.rotation===e.rotation&&this.elementData.opacity===e.opacity&&this.elementData.interactive===e.interactive}static setupDefaultStyles(e,t){const i={position:"relative",boxSizing:"border-box",webkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",background:"transparent",userSelect:"auto",webkitUserSelect:"auto"};t.width&&t.height?(i.width=`${t.width}px`,i.height=`${t.height}px`,i.overflow="hidden"):(i.width=t.width?`${t.width}px`:"auto",i.height=t.height?`${t.height}px`:"auto",i.overflow="visible"),Object.assign(e.style,i),e.style.setProperty("-webkit-tap-highlight-color","transparent"),e.style.setProperty("-webkit-touch-callout","none")}destroy(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.domClickHandler&&this.element&&(this.element.removeEventListener("click",this.domClickHandler),this.domClickHandler=null),this.debugMarker&&(this.debugMarker.destroy(),this.debugMarker=null),super.destroy()}}export{i as CustomHTML};
|
package/dist/index.d.ts
CHANGED
|
@@ -2302,12 +2302,6 @@ export declare class MapApplication extends Application implements MapApi {
|
|
|
2302
2302
|
* @param roomIds - 要检测的房间ID数组
|
|
2303
2303
|
* @returns 是否所有指定的房间都相邻(连通)
|
|
2304
2304
|
*
|
|
2305
|
-
* @example
|
|
2306
|
-
* ```typescript
|
|
2307
|
-
* // 判断两个房间是否相邻
|
|
2308
|
-
* const isAdjacent = mapApi.areRoomsAdjacent([1, 2])
|
|
2309
|
-
*
|
|
2310
|
-
* ```
|
|
2311
2305
|
*/
|
|
2312
2306
|
areRoomsAdjacent(roomIds: number[]): boolean;
|
|
2313
2307
|
/**
|
|
@@ -2320,16 +2314,6 @@ export declare class MapApplication extends Application implements MapApi {
|
|
|
2320
2314
|
* @param point - 待检测的点坐标(原点坐标系,与Zone、VirtualWall等使用相同的坐标系)
|
|
2321
2315
|
* @returns 如果点在某个房间内,返回该房间的RoomData;否则返回null
|
|
2322
2316
|
*
|
|
2323
|
-
* @example
|
|
2324
|
-
* ```typescript
|
|
2325
|
-
* // 判断一个点是否在房间内
|
|
2326
|
-
* const roomData = mapApi.isPointInAnyRoom({ x: 100, y: 200 })
|
|
2327
|
-
* if (roomData) {
|
|
2328
|
-
* console.log(`点在房间 ${roomData.name} 内`)
|
|
2329
|
-
* } else {
|
|
2330
|
-
* console.log('点不在任何房间内')
|
|
2331
|
-
* }
|
|
2332
|
-
* ```
|
|
2333
2317
|
*/
|
|
2334
2318
|
isPointInAnyRoom(point: Point): RoomData | null;
|
|
2335
2319
|
/* Excluded from this release type: isPointInAnyRoomStructuredInternal */
|