floor-editor-ts 1.2.5 → 1.2.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/dist/floor-editor.es.js
CHANGED
|
@@ -62003,10 +62003,6 @@ var drawSymGasLine = (ctx, w, d, color) => {
|
|
|
62003
62003
|
ctx.textBaseline = "middle";
|
|
62004
62004
|
ctx.fillText("G", 0, 0);
|
|
62005
62005
|
};
|
|
62006
|
-
var persons = [];
|
|
62007
|
-
var lastSpawnTime = 0;
|
|
62008
|
-
var SPAWN_INTERVAL = 1e3;
|
|
62009
|
-
var MAX_PERSONS = 20;
|
|
62010
62006
|
function getHeatmapColor(t, alpha = 1) {
|
|
62011
62007
|
t = Math.max(0, Math.min(t, 1));
|
|
62012
62008
|
let r, g, b;
|
|
@@ -62039,7 +62035,6 @@ var drawCamera = (ctx, w, d, color, heatmapMatrix, hasPerson = false, showHeatma
|
|
|
62039
62035
|
const range = Math.max(w, d) * 6;
|
|
62040
62036
|
const fov = Math.PI / 2;
|
|
62041
62037
|
if (showHeatmap || showCameraCones) {
|
|
62042
|
-
var _heatmapMatrix$;
|
|
62043
62038
|
ctx.save();
|
|
62044
62039
|
const coneGradient = ctx.createRadialGradient(0, 0, 0, 0, 0, range);
|
|
62045
62040
|
const innerAlpha = highlighted ? "88" : showHeatmap ? "55" : "22";
|
|
@@ -62065,78 +62060,7 @@ var drawCamera = (ctx, w, d, color, heatmapMatrix, hasPerson = false, showHeatma
|
|
|
62065
62060
|
ctx.stroke();
|
|
62066
62061
|
}
|
|
62067
62062
|
ctx.restore();
|
|
62068
|
-
|
|
62069
|
-
const rows = heatmapMatrix.length;
|
|
62070
|
-
const cols = heatmapMatrix[0].length;
|
|
62071
|
-
const maxValue = Math.max(...heatmapMatrix.flat());
|
|
62072
|
-
if (maxValue > 0) {
|
|
62073
|
-
ctx.save();
|
|
62074
|
-
ctx.globalCompositeOperation = "lighter";
|
|
62075
|
-
ctx.filter = "blur(10px)";
|
|
62076
|
-
const radius = range / rows * 1.8;
|
|
62077
|
-
for (let y = 0; y < rows; y++) for (let x = 0; x < cols; x++) {
|
|
62078
|
-
const value = heatmapMatrix[y][x];
|
|
62079
|
-
if (!value || value <= 0) continue;
|
|
62080
|
-
const intensity = Math.min(value / maxValue, 1);
|
|
62081
|
-
const angle = -fov / 2 + (cols === 1 ? .5 : x / (cols - 1)) * fov;
|
|
62082
|
-
const r = (y + .5) / rows * range;
|
|
62083
|
-
const px = Math.cos(angle) * r;
|
|
62084
|
-
const py = Math.sin(angle) * r;
|
|
62085
|
-
const gradient = ctx.createRadialGradient(px, py, 0, px, py, radius);
|
|
62086
|
-
const alpha = .12 + intensity * .75;
|
|
62087
|
-
gradient.addColorStop(0, getHeatmapColor(intensity, alpha));
|
|
62088
|
-
gradient.addColorStop(.45, getHeatmapColor(intensity, alpha * .45));
|
|
62089
|
-
gradient.addColorStop(1, getHeatmapColor(intensity, 0));
|
|
62090
|
-
ctx.fillStyle = gradient;
|
|
62091
|
-
ctx.beginPath();
|
|
62092
|
-
ctx.arc(px, py, radius, 0, Math.PI * 2);
|
|
62093
|
-
ctx.fill();
|
|
62094
|
-
}
|
|
62095
|
-
ctx.restore();
|
|
62096
|
-
}
|
|
62097
|
-
}
|
|
62098
|
-
if (showHeatmap && hasPerson) {
|
|
62099
|
-
const now = Date.now();
|
|
62100
|
-
if (persons.length < MAX_PERSONS && now - lastSpawnTime > SPAWN_INTERVAL) {
|
|
62101
|
-
lastSpawnTime = now;
|
|
62102
|
-
persons.push({
|
|
62103
|
-
startTime: now,
|
|
62104
|
-
duration: 2e3 + Math.random() * 1e3,
|
|
62105
|
-
direction: Math.random() > .5 ? "far-to-near" : "near-to-far",
|
|
62106
|
-
angle: (Math.random() - .5) * fov * .8
|
|
62107
|
-
});
|
|
62108
|
-
}
|
|
62109
|
-
persons = persons.filter((p) => {
|
|
62110
|
-
let t = (now - p.startTime) / p.duration;
|
|
62111
|
-
if (t >= 1) return false;
|
|
62112
|
-
t = Math.max(0, Math.min(t, 1));
|
|
62113
|
-
let r;
|
|
62114
|
-
if (p.direction === "far-to-near") r = range * (.9 - t * .8);
|
|
62115
|
-
else r = range * (.1 + t * .8);
|
|
62116
|
-
const x = Math.cos(p.angle) * r;
|
|
62117
|
-
const y = Math.sin(p.angle) * r;
|
|
62118
|
-
ctx.save();
|
|
62119
|
-
ctx.translate(x, y);
|
|
62120
|
-
ctx.globalCompositeOperation = "lighter";
|
|
62121
|
-
const scale = .5 + (1 - r / range);
|
|
62122
|
-
ctx.scale(scale, scale);
|
|
62123
|
-
ctx.globalAlpha = 1 - t;
|
|
62124
|
-
const glow = ctx.createRadialGradient(0, 0, 0, 0, 0, 20);
|
|
62125
|
-
glow.addColorStop(0, "rgba(255,0,0,0.8)");
|
|
62126
|
-
glow.addColorStop(1, "rgba(255,0,0,0)");
|
|
62127
|
-
ctx.fillStyle = glow;
|
|
62128
|
-
ctx.beginPath();
|
|
62129
|
-
ctx.arc(0, 0, 20, 0, Math.PI * 2);
|
|
62130
|
-
ctx.fill();
|
|
62131
|
-
ctx.beginPath();
|
|
62132
|
-
ctx.arc(0, 0, 6, 0, Math.PI * 2);
|
|
62133
|
-
ctx.fillStyle = "red";
|
|
62134
|
-
ctx.fill();
|
|
62135
|
-
ctx.restore();
|
|
62136
|
-
return true;
|
|
62137
|
-
});
|
|
62138
|
-
} else if (showHeatmap) persons = [];
|
|
62139
|
-
} else persons = [];
|
|
62063
|
+
}
|
|
62140
62064
|
ctx.fillStyle = color + "40";
|
|
62141
62065
|
ctx.strokeStyle = color;
|
|
62142
62066
|
ctx.lineWidth = 1;
|