floor-editor-ts 1.2.6 → 1.2.7

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.
@@ -62029,34 +62029,25 @@ function getHeatmapColor(t, alpha = 1) {
62029
62029
  }
62030
62030
  return `rgba(${r}, ${g}, ${b}, ${alpha})`;
62031
62031
  }
62032
- var drawCamera = (ctx, w, d, color, heatmapMatrix, hasPerson = false, showHeatmap = false, showCameraCones = false, highlighted = false) => {
62032
+ var MAX_CONE_RANGE_PX = 220;
62033
+ var drawCamera = (ctx, w, d, color, heatmapMatrix, hasPerson = false, showHeatmap = false, drawCone = false, highlighted = false) => {
62033
62034
  const bodyRadius = 4;
62034
62035
  const lensR = Math.min(w, d) * .25;
62035
- const range = Math.max(w, d) * 6;
62036
62036
  const fov = Math.PI / 2;
62037
- if (showHeatmap || showCameraCones) {
62037
+ if (drawCone) {
62038
62038
  ctx.save();
62039
- const coneGradient = ctx.createRadialGradient(0, 0, 0, 0, 0, range);
62040
- const innerAlpha = highlighted ? "88" : showHeatmap ? "55" : "22";
62041
- const midAlpha = highlighted ? "55" : showHeatmap ? "22" : "11";
62042
- coneGradient.addColorStop(0, color + innerAlpha);
62043
- coneGradient.addColorStop(.45, color + midAlpha);
62044
- coneGradient.addColorStop(1, color + "00");
62045
- ctx.fillStyle = coneGradient;
62046
- ctx.globalCompositeOperation = "lighter";
62039
+ const range = Math.min(Math.max(w, d) * 6, MAX_CONE_RANGE_PX);
62040
+ ctx.globalAlpha = highlighted ? .28 : showHeatmap ? .22 : .14;
62041
+ ctx.fillStyle = highlighted ? "#fbbf24" : color;
62047
62042
  ctx.beginPath();
62048
62043
  ctx.moveTo(0, 0);
62049
62044
  ctx.arc(0, 0, range, -fov / 2, fov / 2);
62050
62045
  ctx.closePath();
62051
62046
  ctx.fill();
62052
62047
  if (highlighted) {
62048
+ ctx.globalAlpha = .85;
62053
62049
  ctx.strokeStyle = "#fbbf24";
62054
- ctx.lineWidth = 2.5;
62055
- ctx.globalCompositeOperation = "source-over";
62056
- ctx.beginPath();
62057
- ctx.moveTo(0, 0);
62058
- ctx.arc(0, 0, range, -fov / 2, fov / 2);
62059
- ctx.closePath();
62050
+ ctx.lineWidth = 2;
62060
62051
  ctx.stroke();
62061
62052
  }
62062
62053
  ctx.restore();
@@ -62155,12 +62146,12 @@ var iconDrawers = {
62155
62146
  * @param w - pixel width (catalogWidth * zoom)
62156
62147
  * @param d - pixel depth (catalogDepth * zoom)
62157
62148
  */
62158
- function drawFurnitureIcon(ctx, catalogId, w, d, color, strokeColor, heatmapMatrix, hasPerson = false, showHeatmap = false, showCameraCones = false, highlighted = false) {
62149
+ function drawFurnitureIcon(ctx, catalogId, w, d, color, strokeColor, heatmapMatrix, hasPerson = false, showHeatmap = false, drawCone = false, highlighted = false) {
62159
62150
  ctx.fillStyle = color + "60";
62160
62151
  ctx.strokeStyle = strokeColor;
62161
62152
  ctx.lineWidth = 1;
62162
62153
  const drawer = iconDrawers[catalogId];
62163
- if (drawer) drawer(ctx, w, d, color, heatmapMatrix, hasPerson, showHeatmap, showCameraCones, highlighted);
62154
+ if (drawer) drawer(ctx, w, d, color, heatmapMatrix, hasPerson, showHeatmap, drawCone, highlighted);
62164
62155
  else {
62165
62156
  roundRect(ctx, -w / 2, -d / 2, w, d, 2);
62166
62157
  ctx.fill();
@@ -63508,6 +63499,7 @@ function drawFurnitureItem(cs, item, selected, options) {
63508
63499
  const useConfigHeatmap = isCamera && highlighted && !!(options === null || options === void 0 || (_options$cameraHeatma = options.cameraHeatmapMatrix) === null || _options$cameraHeatma === void 0 ? void 0 : _options$cameraHeatma.length);
63509
63500
  const drawHeatmapMatrix = useConfigHeatmap ? options.cameraHeatmapMatrix : item.heatmapMatrix;
63510
63501
  const drawShowHeatmap = item.showHeatmap || useConfigHeatmap;
63502
+ const drawCone = isCamera && (drawShowHeatmap || highlighted || showCameraCones && selected);
63511
63503
  ctx.save();
63512
63504
  ctx.translate(s.x, s.y);
63513
63505
  ctx.rotate(angle);
@@ -63515,7 +63507,7 @@ function drawFurnitureItem(cs, item, selected, options) {
63515
63507
  const itemColor = (_item$color = item.color) !== null && _item$color !== void 0 ? _item$color : cat.color;
63516
63508
  const strokeColor = selected ? "#3b82f6" : itemColor;
63517
63509
  ctx.lineWidth = selected ? 2 : 1;
63518
- drawFurnitureIcon(ctx, item.catalogId, w, d, itemColor, strokeColor, drawHeatmapMatrix, item.hasPerson, drawShowHeatmap, isCamera ? showCameraCones : false, isCamera ? highlighted : false);
63510
+ drawFurnitureIcon(ctx, item.catalogId, w, d, itemColor, strokeColor, drawHeatmapMatrix, item.hasPerson, drawShowHeatmap, drawCone, highlighted);
63519
63511
  const fontSize = Math.max(8, Math.min(12, Math.min(w, d) * .2));
63520
63512
  if (showCameraLabels && Math.min(w, d) > 20) {
63521
63513
  var _item$name;