@ray-js/robot-map-sdk 0.0.3-beta-4 → 0.0.3-beta-6

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.
@@ -1 +1 @@
1
- import{Graphics as t}from"pixi.js";import{LAYER_FREE as e}from"../../application/AppContainer.js";import{useAppService as o}from"../../application/AppService.js";class r extends t{constructor(){super();const t=o();t.appContainer.addToLayer(e,this),t.emitter.on("cacheAsTexture",t=>{this.cacheAsTexture(!1),this.cacheAsTexture({resolution:t})})}draw(t){const e=o();this.clear(),this.setFillStyle({color:e.mapConfig.freeColor});for(const e of t){const t=e.coordinates;for(let e=0;e<t.length;e+=2){const o=t[e],r=t[e+1];this.rect(o,r,1,1)}}this.fill(),this.updateCacheTexture()}}export{r as Free};
1
+ import{Graphics as e}from"pixi.js";import{LAYER_FREE as t}from"../../application/AppContainer.js";import{useAppService as r}from"../../application/AppService.js";class s extends e{cacheAsTextureHandler;constructor(){super();const e=r();e.appContainer.addToLayer(t,this),this.cacheAsTextureHandler=e=>{this.cacheAsTexture(!1),this.cacheAsTexture({resolution:e})},e.emitter.on("cacheAsTexture",this.cacheAsTextureHandler)}draw(e){const t=r();this.clear(),this.setFillStyle({color:t.mapConfig.freeColor});for(const t of e){const e=t.coordinates;for(let t=0;t<e.length;t+=2){const r=e[t],s=e[t+1];this.rect(r,s,1,1)}}this.fill(),this.updateCacheTexture()}destroy(e){r().emitter.off("cacheAsTexture",this.cacheAsTextureHandler),super.destroy(e)}}export{s as Free};
@@ -1 +1 @@
1
- import{Graphics as t}from"pixi.js";import{LAYER_OBSTACLE as o}from"../../application/AppContainer.js";import{RASTER_CHUNK_SIZE as e}from"../../constant/index.js";import{useAppService as s}from"../../application/AppService.js";class r extends t{constructor(){super();const t=s();t.appContainer.addToLayer(o,this),t.emitter.on("cacheAsTexture",t=>{this.cacheAsTexture(!1),this.cacheAsTexture({resolution:t})})}draw(t){const o=s();this.clear(),this.setFillStyle({color:o.mapConfig.obstacleColor});for(const o of t){const t=o.coordinates;for(let o=0;o<t.length;o+=2){const e=t[o],s=t[o+1];this.rect(e,s,1,1)}}this.fill(),this.updateCacheTexture()}drawRaster(t,o){const r=s();if(this.clear(),0!==t.length){this.setFillStyle({color:r.mapConfig.obstacleColor});for(let s=0;s<t.length;s+=e){const i=Math.min(s+e,t.length);for(let e=s;e<i;e++){const s=t[e],r=s%o,i=Math.floor(s/o);this.rect(r,i,1,1)}this.fill(),i<t.length&&this.setFillStyle({color:r.mapConfig.obstacleColor})}this.updateCacheTexture()}}}export{r as Obstacle};
1
+ import{Graphics as t}from"pixi.js";import{LAYER_OBSTACLE as e}from"../../application/AppContainer.js";import{RASTER_CHUNK_SIZE as o}from"../../constant/index.js";import{useAppService as r}from"../../application/AppService.js";class s extends t{cacheAsTextureHandler;constructor(){super();const t=r();t.appContainer.addToLayer(e,this),this.cacheAsTextureHandler=t=>{this.cacheAsTexture(!1),this.cacheAsTexture({resolution:t})},t.emitter.on("cacheAsTexture",this.cacheAsTextureHandler)}draw(t){const e=r();this.clear(),this.setFillStyle({color:e.mapConfig.obstacleColor});for(const e of t){const t=e.coordinates;for(let e=0;e<t.length;e+=2){const o=t[e],r=t[e+1];this.rect(o,r,1,1)}}this.fill(),this.updateCacheTexture()}drawRaster(t,e){const s=r();if(this.clear(),0!==t.length){this.setFillStyle({color:s.mapConfig.obstacleColor});for(let r=0;r<t.length;r+=o){const i=Math.min(r+o,t.length);for(let o=r;o<i;o++){const r=t[o],s=r%e,i=Math.floor(r/e);this.rect(s,i,1,1)}this.fill(),i<t.length&&this.setFillStyle({color:s.mapConfig.obstacleColor})}this.updateCacheTexture()}}destroy(t){r().emitter.off("cacheAsTexture",this.cacheAsTextureHandler),super.destroy(t)}}export{s as Obstacle};
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ import { Container } from 'pixi.js';
7
7
  import { ControlsConfig as ControlsConfig_2 } from '..';
8
8
  import { ControlsManager as ControlsManager_2 } from '../managers/ControlsManager';
9
9
  import { CustomElementsManager as CustomElementsManager_2 } from '../managers/CustomElementsManager';
10
+ import { DestroyOptions } from 'pixi.js';
10
11
  import { DetectedObjectManager as DetectedObjectManager_2 } from '../managers/DetectedObjectManager';
11
12
  import { DividerConfig as DividerConfig_2 } from '..';
12
13
  import { Emitter } from 'mitt';
@@ -1416,6 +1417,7 @@ declare class EnhancedSprite extends Sprite {
1416
1417
  }
1417
1418
 
1418
1419
  declare class Free extends Graphics {
1420
+ private cacheAsTextureHandler;
1419
1421
  constructor();
1420
1422
  /**
1421
1423
  * 绘制结构化自由区域数据
@@ -1424,6 +1426,7 @@ declare class Free extends Graphics {
1424
1426
  draw(free: {
1425
1427
  coordinates: number[];
1426
1428
  }[]): void;
1429
+ destroy(options?: DestroyOptions | boolean): void;
1427
1430
  }
1428
1431
 
1429
1432
  /**
@@ -2600,7 +2603,7 @@ declare class MapManager {
2600
2603
  carpet: Carpet;
2601
2604
  chargingStation: ChargingStation;
2602
2605
  mapBounds: Bounds;
2603
- private hasAutoFitted;
2606
+ private lastMapId;
2604
2607
  private roomGeometryMap;
2605
2608
  private carpetData;
2606
2609
  private unsubscribeFns;
@@ -2686,6 +2689,7 @@ export declare type MapState = {
2686
2689
  }
2687
2690
 
2688
2691
  declare class Obstacle extends Graphics {
2692
+ private cacheAsTextureHandler;
2689
2693
  constructor();
2690
2694
  /**
2691
2695
  * 绘制结构化障碍物数据
@@ -2700,6 +2704,7 @@ declare class Obstacle extends Graphics {
2700
2704
  * @param width 地图宽度
2701
2705
  */
2702
2706
  drawRaster(obstacleIndices: Uint32Array, width: number): void;
2707
+ destroy(options?: DestroyOptions | boolean): void;
2703
2708
  }
2704
2709
 
2705
2710
  /**