From 6dd6c87ceba335cbe51724480b72c2dadd184197 Mon Sep 17 00:00:00 2001 From: Scott Bell Date: Tue, 2 May 2023 15:01:36 +0200 Subject: [PATCH] fix tests --- .../plugins/imagery/exampleImagery.e2e.spec.js | 9 ++++++--- src/plugins/imagery/components/AnnotationsCanvas.vue | 6 +++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/e2e/tests/functional/plugins/imagery/exampleImagery.e2e.spec.js b/e2e/tests/functional/plugins/imagery/exampleImagery.e2e.spec.js index f523e74cf5..4b7965ca6c 100644 --- a/e2e/tests/functional/plugins/imagery/exampleImagery.e2e.spec.js +++ b/e2e/tests/functional/plugins/imagery/exampleImagery.e2e.spec.js @@ -44,7 +44,7 @@ test.describe('Example Imagery Object', () => { // Verify that the created object is focused await expect(page.locator('.l-browse-bar__object-name')).toContainText(exampleImagery.name); - await page.locator(backgroundImageSelector).hover({trial: true}); + await page.locator('canvas').hover({trial: true}); }); test('Can use Mouse Wheel to zoom in and out of latest image', async ({ page }) => { @@ -664,7 +664,6 @@ async function panZoomAndAssertImageProperties(page) { async function mouseZoomOnImageAndAssert(page, factor = 2) { // Zoom in const originalImageDimensions = await page.locator(backgroundImageSelector).boundingBox(); - await page.locator(backgroundImageSelector).hover({trial: true}); const deltaYStep = 100; // equivalent to 1x zoom await page.mouse.wheel(0, deltaYStep * factor); const zoomedBoundingBox = await page.locator(backgroundImageSelector).boundingBox(); @@ -675,7 +674,11 @@ async function mouseZoomOnImageAndAssert(page, factor = 2) { await page.mouse.move(imageCenterX, imageCenterY); // Wait for zoom animation to finish - await page.locator(backgroundImageSelector).hover({trial: true}); + await page.locator(backgroundImageSelector).hover({ + trial: true, + // eslint-disable-next-line playwright/no-force-option + force: true + }); const imageMouseZoomed = await page.locator(backgroundImageSelector).boundingBox(); if (factor > 0) { diff --git a/src/plugins/imagery/components/AnnotationsCanvas.vue b/src/plugins/imagery/components/AnnotationsCanvas.vue index 15e7b19b82..505526a7e7 100644 --- a/src/plugins/imagery/components/AnnotationsCanvas.vue +++ b/src/plugins/imagery/components/AnnotationsCanvas.vue @@ -79,6 +79,7 @@ export default { this.buildAnnotationIndex(); }, beforeDestroy() { + console.debug(`🚮 Canvas destroyed`); this.openmct.selection.off('change', this.updateSelection); document.body.removeEventListener('click', this.cancelSelection); }, @@ -157,7 +158,7 @@ export default { this.context.stroke(); }, trackAnnotationDrag(event) { - if (this.mouseDown && !this.dragging) { + if (this.mouseDown && !this.dragging && event.shiftKey) { this.startAnnotationDrag(event); } else if (this.dragging) { const boundingRect = this.canvas.getBoundingClientRect(); @@ -273,6 +274,9 @@ export default { targetDomainObjects, annotations: nearbyAnnotations }); + } else { + // nothing selected + this.drawAnnotations(); } }, selectOrCreateAnnotation(event) {