@panoramax/web-viewer 5.0.0-develop-b98e5d13 → 5.0.0-develop-f7d7cc8f
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/build/cjs/index.js +38 -38
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index_photoviewer.js +31 -31
- package/build/cjs/index_photoviewer.js.map +1 -1
- package/build/esm/components/core/Basic.js +1 -1
- package/build/esm/components/menus/SemanticsMetadata.js +8 -1
- package/build/esm/components/ui/Photo.js +20 -24
- package/build/esm/translations/en.json +2 -0
- package/build/esm/translations/fr.json +2 -0
- package/build/esm/utils/API.js +3 -9
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import BasicStyles from "./Basic.css" with { type: "css" };
|
|
|
9
9
|
document.adoptedStyleSheets.push(AtkinsonStyles);
|
|
10
10
|
document.adoptedStyleSheets.push(BasicStyles);
|
|
11
11
|
|
|
12
|
-
const __COMMIT_HASH__ = "
|
|
12
|
+
const __COMMIT_HASH__ = "f7d7cc8";
|
|
13
13
|
const __PACKAGE_VERSION__ = "5.0.0";
|
|
14
14
|
const __PACKAGE_ISSUES_URL__ = "https://gitlab.com/panoramax/clients/web-viewer/-/work_items";
|
|
15
15
|
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
import { dataBlocks, hidden } from "../styles.js";
|
|
7
7
|
import { getUserAccount } from "../../utils/utils.js";
|
|
8
8
|
|
|
9
|
+
const ADD_TAG_GEOM_DOING = "doing";
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* Semantics metadata displays detailed info about semantic attributes of a single picture.
|
|
11
13
|
* @class Panoramax.components.menus.SemanticsMetadata
|
|
@@ -108,6 +110,7 @@ export default class SemanticsMetadata extends LitElement {
|
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
/** @private */
|
|
113
|
+
// eslint-disable-next-line class-methods-use-this
|
|
111
114
|
_onBrowserQuit(e) {
|
|
112
115
|
e.preventDefault();
|
|
113
116
|
e.returnValue = true;
|
|
@@ -139,7 +142,7 @@ export default class SemanticsMetadata extends LitElement {
|
|
|
139
142
|
this._blockPicChange(true);
|
|
140
143
|
this._addTag = true;
|
|
141
144
|
this._editTag = false;
|
|
142
|
-
this._addTagGeom =
|
|
145
|
+
this._addTagGeom = ADD_TAG_GEOM_DOING;
|
|
143
146
|
this._editTagSem = null;
|
|
144
147
|
|
|
145
148
|
this._addTagGeomListener = e => {
|
|
@@ -177,6 +180,10 @@ export default class SemanticsMetadata extends LitElement {
|
|
|
177
180
|
alert(this._parent?._t.pnx.semantics_send_fail);
|
|
178
181
|
});
|
|
179
182
|
}
|
|
183
|
+
// Create annotation but with unfinished geom
|
|
184
|
+
else if(this._addTag && this._addTagGeom === ADD_TAG_GEOM_DOING) {
|
|
185
|
+
alert(this._parent?._t.pnx.semantics_draw_unfinished_annotation);
|
|
186
|
+
}
|
|
180
187
|
// Create annotation if a geom exists
|
|
181
188
|
else if(this._addTag && this._addTagGeom) {
|
|
182
189
|
this._parent.psv.fixDrawAnnotation();
|
|
@@ -1370,37 +1370,33 @@ export default class Photo extends PSViewer {
|
|
|
1370
1370
|
// Send valid rectangle through event
|
|
1371
1371
|
if(sendRectEvent) {
|
|
1372
1372
|
// Get texture coordinates (corresponding to a full 360° sphere)
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
maxxy.textureX,
|
|
1379
|
-
maxxy.textureY
|
|
1380
|
-
];
|
|
1373
|
+
let shape = this._myMarkers.markers[DRAW_ANNOT_RECT].config.polygon
|
|
1374
|
+
.map(c => {
|
|
1375
|
+
const t = this.dataHelper.sphericalCoordsToTextureCoords(c);
|
|
1376
|
+
return [t.textureX, t.textureY];
|
|
1377
|
+
});
|
|
1381
1378
|
|
|
1382
1379
|
// Re-compute original texture coordinates (flat or cropped images)
|
|
1383
1380
|
const crop = this.getPictureMetadata()?.panorama?.cropData;
|
|
1384
1381
|
if(crop) {
|
|
1385
|
-
shape[
|
|
1386
|
-
shape[1] -= crop.croppedY;
|
|
1387
|
-
shape[2] -= crop.croppedX;
|
|
1388
|
-
shape[3] -= crop.croppedY;
|
|
1382
|
+
shape = shape.map(([x,y]) => [x - crop.croppedX, y - crop.croppedY]);
|
|
1389
1383
|
|
|
1390
1384
|
// Check if annotations doesn't go outside of picture
|
|
1391
|
-
if(shape[
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1385
|
+
if(shape.find(([x,y]) => x < 0 || x > crop.croppedWidth || y < 0 || y > crop.croppedHeight)) {
|
|
1386
|
+
shape = null;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
// Alert user if shape is invalid
|
|
1390
|
+
if(!shape) {
|
|
1391
|
+
alert(this._parent._t.pnx.semantics_draw_invalid_annotation);
|
|
1392
|
+
this.stopDrawAnnotation();
|
|
1393
|
+
this.startDrawAnnotation();
|
|
1394
|
+
}
|
|
1395
1395
|
}
|
|
1396
1396
|
|
|
1397
|
-
//
|
|
1398
|
-
if(shape[0]
|
|
1399
|
-
|
|
1400
|
-
let minx = shape[2];
|
|
1401
|
-
let maxy = shape[1];
|
|
1402
|
-
let miny = shape[3];
|
|
1403
|
-
shape = [minx, miny, maxx, maxy];
|
|
1397
|
+
// Add back last coordinate
|
|
1398
|
+
if(shape[0][0] !== shape[shape.length-1][0] || shape[0][1] !== shape[shape.length-1][1]) {
|
|
1399
|
+
shape.push(shape[0]);
|
|
1404
1400
|
}
|
|
1405
1401
|
|
|
1406
1402
|
/**
|
|
@@ -1408,7 +1404,7 @@ export default class Photo extends PSViewer {
|
|
|
1408
1404
|
*
|
|
1409
1405
|
* @event Panoramax.components.ui.Photo#annotation-drawn
|
|
1410
1406
|
* @type {CustomEvent}
|
|
1411
|
-
* @property {
|
|
1407
|
+
* @property {number[][]} detail.shape The annotation geometry, or null if latest draw is invalid
|
|
1412
1408
|
*/
|
|
1413
1409
|
const event = new CustomEvent("annotation-drawn", {
|
|
1414
1410
|
detail: { shape }
|
|
@@ -222,6 +222,8 @@
|
|
|
222
222
|
"semantics_zero_annotations": "No features drawn on this picture",
|
|
223
223
|
"semantics_add_annotation": "Add a new tag",
|
|
224
224
|
"semantics_draw_annotation": "You can draw the object you want to add over the picture (Optional).",
|
|
225
|
+
"semantics_draw_invalid_annotation": "The drawn area goes beyond picture limits. Please make sure to draw within visible picture.",
|
|
226
|
+
"semantics_draw_unfinished_annotation": "The drawn area is unfinished. Make sure the area is well-positioned before saving.",
|
|
225
227
|
"semantics_erase_annotation": "Erase drawn feature",
|
|
226
228
|
"semantics_delete_annotation": "Delete this feature",
|
|
227
229
|
"semantics_delete_annotation_confirm": "Do you really want to delete this tag ?",
|
|
@@ -222,6 +222,8 @@
|
|
|
222
222
|
"semantics_zero_annotations": "Aucun objet dessiné dans cette photo",
|
|
223
223
|
"semantics_add_annotation": "Ajouter un nouveau tag",
|
|
224
224
|
"semantics_draw_annotation": "Vous pouvez dessiner l'emplacement de l'objet à créer sur la photo (Optionnel).",
|
|
225
|
+
"semantics_draw_invalid_annotation": "La zone dessinée dépasse de la photo. Veuillez vous assurer que la zone dessinée soit bien à l'intérieur de la photo.",
|
|
226
|
+
"semantics_draw_unfinished_annotation": "La zone dessinée n'est pas terminée. Assurez-vous qu'elle soit bien positionnée avant d'enregistrer.",
|
|
225
227
|
"semantics_erase_annotation": "Effacer l'objet dessiné",
|
|
226
228
|
"semantics_delete_annotation": "Supprimer cet objet",
|
|
227
229
|
"semantics_delete_annotation_confirm": "Êtes-vous sûr(e) de vouloir supprimer ce tag ?",
|
package/build/esm/utils/API.js
CHANGED
|
@@ -741,16 +741,10 @@ export default class API extends EventTarget {
|
|
|
741
741
|
*/
|
|
742
742
|
createPictureAnnotation(picMeta, shape, semanticsDiff) {
|
|
743
743
|
// Fake send version
|
|
744
|
-
//
|
|
744
|
+
// return Promise.resolve({
|
|
745
745
|
// "id": "fe298d59-a9c6-4680-8e76-6efe82d97f48",
|
|
746
746
|
// "semantics": semanticsDiff,
|
|
747
|
-
// "shape": { "type": "Polygon", "coordinates": [
|
|
748
|
-
// [shape[0], shape[1]],
|
|
749
|
-
// [shape[0], shape[3]],
|
|
750
|
-
// [shape[2], shape[3]],
|
|
751
|
-
// [shape[2], shape[1]],
|
|
752
|
-
// [shape[0], shape[1]],
|
|
753
|
-
// ]] }
|
|
747
|
+
// "shape": { "type": "Polygon", "coordinates": [shape] }
|
|
754
748
|
// });
|
|
755
749
|
|
|
756
750
|
if(!this.isReady()) { throw new Error("API is not ready to use"); }
|
|
@@ -767,7 +761,7 @@ export default class API extends EventTarget {
|
|
|
767
761
|
method: "POST",
|
|
768
762
|
body: JSON.stringify({
|
|
769
763
|
semantics: semanticsDiff,
|
|
770
|
-
shape: shape
|
|
764
|
+
shape: { type: "Polygon", coordinates: [shape] }
|
|
771
765
|
}),
|
|
772
766
|
headers: { "Content-Type": "application/json" },
|
|
773
767
|
};
|
package/package.json
CHANGED