@7365admin1/layer-common 4.163.5 → 4.163.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.163.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 5f873a3: Robot building map: name tags of robots standing close together are stacked instead of printed on top of each other.
8
+
3
9
  ## 4.163.5
4
10
 
5
11
  ### Patch Changes
@@ -3728,11 +3734,11 @@ Monthly report: a month that had patrols opens the list of that month's patrol r
3728
3734
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
3729
3735
  own rule from two endpoints the console already calls, unprojected:
3730
3736
 
3731
- GET /api/members/user/:user/app/admin the Seven365 staff membership
3732
- GET /api/roles/id/:role that membership's role document
3737
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
3738
+ GET /api/roles/id/:role that membership's role document
3733
3739
 
3734
- owner = member.type === "admin" && role.type === "admin" && role.default === true
3735
- staff = member.type === "admin" && role.type === "admin"
3740
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
3741
+ staff = member.type === "admin" && role.type === "admin"
3736
3742
 
3737
3743
  `role.default` is the marker because it is the only property of a platform
3738
3744
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -176,7 +176,7 @@
176
176
  type="button"
177
177
  class="hero-bmap__name"
178
178
  :class="{ 'hero-bmap__name--left': nameTagSide(r.left, r.top, r.name, plane.w, plane.h, BUILDING_TAG).flipX }"
179
- :style="{ transform: `translateZ(${look.pinZ}px) ${unskew}` }"
179
+ :style="{ transform: `translateZ(${look.pinZ + (nameTagStack(f.robots)[r.id] ?? 0) * TAG_STEP}px) ${unskew}` }"
180
180
  @click.stop="emit('open', r.id)"
181
181
  @mousedown.stop
182
182
  >
@@ -246,6 +246,7 @@ import { siteFloorKey, siteFloorLabel, type TSiteFloor } from "../../utils/robot
246
246
  import {
247
247
  BUILDING_TAG,
248
248
  nameTagSide,
249
+ nameTagStack,
249
250
  brandName,
250
251
  siteFloorOf,
251
252
  mapFloors,
@@ -287,6 +288,9 @@ import {
287
288
  type TMapCamera,
288
289
  } from "../../utils/robot-building";
289
290
 
291
+ // Height between stacked name tags of robots standing close together (px, along the pin).
292
+ const TAG_STEP = 22;
293
+
290
294
  const props = withDefaults(
291
295
  defineProps<{
292
296
  organization: string;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "4.163.5",
5
+ "version": "4.163.6",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
@@ -2041,3 +2041,22 @@ export function jobOptionsLine(offered: { clean: boolean; rounds: boolean; modes
2041
2041
  }
2042
2042
  return "";
2043
2043
  }
2044
+
2045
+ /**
2046
+ * Name tags of robots standing close together on one floor would print on top of each other. Each robot gets a
2047
+ * stack level: 0 for the first in a cluster, 1, 2... for the next ones, so their tags can be raised one above the
2048
+ * other. `near` is in plan percent.
2049
+ * ponytail: O(n^2) per floor, fine for the handful of robots a floor carries.
2050
+ */
2051
+ export function nameTagStack(robots: { id: string; left: string; top: string }[], near = { x: 14, y: 8 }): Record<string, number> {
2052
+ const pct = (v: string) => Number.parseFloat(v) || 0;
2053
+ const out: Record<string, number> = {};
2054
+ robots.forEach((r, i) => {
2055
+ const taken = new Set(robots.slice(0, i).filter((o) => Math.abs(pct(o.left) - pct(r.left)) < near.x && Math.abs(pct(o.top) - pct(r.top)) < near.y).map((o) => out[o.id]));
2056
+ let level = 0;
2057
+ while (taken.has(level)) level++;
2058
+ out[r.id] = level;
2059
+ });
2060
+ return out;
2061
+ }
2062
+