Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

34 - Image Pan and Zoom #4736

Merged
merged 96 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from 89 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
4bb4528
Add a selectable class to main-image to enable crosshair and disable …
michaelrogers Dec 3, 2021
5ec9b91
Add event helpers and draw library from plots
michaelrogers Jan 5, 2022
c4cc2f4
Added zoom control button test
michaelrogers Jan 19, 2022
c69374b
Exclude tests
michaelrogers Jan 19, 2022
6e5574d
ARemove canvas related element and scale using background-image
michaelrogers Jan 19, 2022
8b3f6b9
WIP: scale translation
michaelrogers Jan 19, 2022
1188663
Remove unused draw library files
michaelrogers Jan 20, 2022
457cd42
Update version number (#4759)
shefalijoshi Jan 21, 2022
0d06308
Separated the translation calculations externally
michaelrogers Jan 21, 2022
d53ce2d
Alternative implementation of zoomImage
akhenry Jan 21, 2022
d1a899c
Add panning handlers
michaelrogers Jan 21, 2022
30a7846
Change click listener to mousedown
michaelrogers Jan 24, 2022
bfc7f2d
Pan capability
michaelrogers Jan 24, 2022
a20da34
Capture initial wheelzoom coordinates by using debounced flag
michaelrogers Jan 24, 2022
169c23d
update copyright (#4775)
scottbell Jan 25, 2022
fb84c05
Add debounced method to track wheel zoom sequence
michaelrogers Jan 25, 2022
205dc67
Observe changes to sub-objects in flexible layouts. (#4780)
akhenry Jan 26, 2022
2f292fb
Follow domain object changes for Independent time conductor (#4783)
shefalijoshi Jan 26, 2022
44f5372
fix typo when using fallback template (#4784)
shefalijoshi Jan 26, 2022
a5c734b
Code cleanup
michaelrogers Jan 27, 2022
2329076
Request data when switching between real time and fixed. (#4807)
shefalijoshi Jan 28, 2022
2732e9f
Revert "Request data when switching between real time and fixed. (#48…
shefalijoshi Jan 28, 2022
daaf7f0
Styling for mct34
charlesh88 Jan 29, 2022
28da3ed
Moved constants to a global
michaelrogers Jan 31, 2022
c23ab66
Removed draw library
michaelrogers Jan 31, 2022
fff822f
Cleanup canvas remnants
michaelrogers Jan 31, 2022
9653def
Revert image tag comment
michaelrogers Jan 31, 2022
8485e79
Added visibile clip and corrected background-size property
michaelrogers Jan 31, 2022
b16d50e
Add a selectable class to main-image to enable crosshair and disable …
michaelrogers Dec 3, 2021
1a54d44
Add event helpers and draw library from plots
michaelrogers Jan 5, 2022
fb02c1b
Added zoom control button test
michaelrogers Jan 19, 2022
50c7ee5
Exclude tests
michaelrogers Jan 19, 2022
03dd174
ARemove canvas related element and scale using background-image
michaelrogers Jan 19, 2022
dffbc68
WIP: scale translation
michaelrogers Jan 19, 2022
98d5702
Remove unused draw library files
michaelrogers Jan 20, 2022
bc27424
Separated the translation calculations externally
michaelrogers Jan 21, 2022
a213b78
Alternative implementation of zoomImage
akhenry Jan 21, 2022
23f85a2
Add panning handlers
michaelrogers Jan 21, 2022
4260f49
Change click listener to mousedown
michaelrogers Jan 24, 2022
36495c3
Pan capability
michaelrogers Jan 24, 2022
a3799d0
Capture initial wheelzoom coordinates by using debounced flag
michaelrogers Jan 24, 2022
8c12359
Add debounced method to track wheel zoom sequence
michaelrogers Jan 25, 2022
63d35a9
Code cleanup
michaelrogers Jan 27, 2022
6e985c0
Styling for mct34
charlesh88 Jan 29, 2022
402b7be
Moved constants to a global
michaelrogers Jan 31, 2022
f94a12f
Removed draw library
michaelrogers Jan 31, 2022
f532e87
Cleanup canvas remnants
michaelrogers Jan 31, 2022
a575e35
Revert image tag comment
michaelrogers Jan 31, 2022
78bd440
Added visibile clip and corrected background-size property
michaelrogers Jan 31, 2022
c0334ed
Tweaks for mct34
charlesh88 Feb 1, 2022
e03dc38
Merge branch 'release/1.8.4' into mct34
michaelrogers Feb 1, 2022
e61595b
Tweaks for mct34
charlesh88 Feb 1, 2022
e059867
Merge branch 'mct34' of github.com:nasa/openmct into mct34
charlesh88 Feb 1, 2022
3d55e6e
Merge branch 'mct34' of github.com:nasa/openmct into mct34
michaelrogers Feb 1, 2022
d5b4c0b
Key tracking for meta and shift keys
michaelrogers Feb 1, 2022
acba9b7
Only left clicks for zoom
michaelrogers Feb 1, 2022
a8a92cf
first attempt of a e2e test
johnhill2 Feb 1, 2022
0ed669a
chasing down a race condition
jvigliotta Feb 2, 2022
398b003
Merge branch 'mct34' of http://github.com/nasa/openmct into mct34
jvigliotta Feb 2, 2022
67190c0
using a prop I created
jvigliotta Feb 2, 2022
2605ab7
Add cursor styling
michaelrogers Feb 2, 2022
37a06c2
Fixed linting errors
michaelrogers Feb 2, 2022
d35e096
Ignore meta and alt pressed clicks on the layout
michaelrogers Feb 2, 2022
c76f563
Changed last focused image logic to preserve when last index
michaelrogers Feb 2, 2022
a0e0f6b
Added debug logs
michaelrogers Feb 2, 2022
5b29969
test stubs
johnhill2 Feb 2, 2022
47605ca
More scenarios
johnhill2 Feb 2, 2022
5578c04
more clarification
johnhill2 Feb 2, 2022
4a68fdb
Changes
johnhill2 Feb 4, 2022
e3563eb
comparison
johnhill2 Feb 4, 2022
37f6c85
e2e test for wheel zoom and panning
michaelrogers Feb 5, 2022
d08cbe4
Merge branch 'master' into mct34
michaelrogers Feb 8, 2022
52557f3
Test for UI zoom / reset buttons
michaelrogers Feb 9, 2022
ee20638
Merge branch 'mct34' of github.com:nasa/openmct into mct34
michaelrogers Feb 10, 2022
d794509
Merge branch 'master' into mct34
michaelrogers Feb 11, 2022
a2b4eb3
Mct34 refactor (#4854)
michaelrogers Feb 14, 2022
92c3a78
Changed htimeouts to hover to wait for stable element
michaelrogers Feb 14, 2022
58c35c7
Change cursor zoom in/out and pannable to computer properties
michaelrogers Feb 14, 2022
527245c
Zoom factor moved to computed
michaelrogers Feb 15, 2022
4262b7d
Cleanup
michaelrogers Feb 15, 2022
d6a4523
Externalized static css properties
michaelrogers Feb 15, 2022
1a7bf50
Update selector for e2e
michaelrogers Feb 15, 2022
5b1ae06
Merge branch 'master' into mct34
michaelrogers Feb 18, 2022
64d3da2
Merge branch 'master' into mct34
unlikelyzero Feb 22, 2022
55dce25
Moved imagery controls to a separate component
michaelrogers Feb 24, 2022
cbac592
Add default value for param
michaelrogers Feb 24, 2022
f8f7a62
Clip overflow to allow pause border to be seen
michaelrogers Feb 25, 2022
f097f25
Mct 34 revisions (#4937)
michaelrogers Mar 16, 2022
b06c0bb
Merge branch 'master' into mct34
michaelrogers Mar 16, 2022
67a0a98
Chain stop.prevent to startdrag event handler
michaelrogers Mar 22, 2022
9903755
Added sensitiviy reduction of zoom wheel deltaY as const
michaelrogers Mar 22, 2022
4966781
Merge branch 'master' into mct34
michaelrogers Mar 22, 2022
049b96d
Fixed first attribute linebreak for lint rule
michaelrogers Mar 22, 2022
5fde516
Trim trailing whitespace
michaelrogers Mar 22, 2022
7e895d3
Merge branch 'master' into mct34
nikhilmandlik Mar 23, 2022
e4ec750
Merge branch 'master' into mct34
shefalijoshi Mar 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 217 additions & 0 deletions e2e/tests/plugins/imagery/exampleImagery.e2e.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/

/*
This test suite is dedicated to tests which verify the basic operations surrounding imagery,
but only assume that example imagery is present.
*/

const { test, expect } = require('@playwright/test');

test.describe('Example Imagery', () => {

test.beforeEach(async ({ page }) => {
page.on('console', msg => console.log(msg.text()))
//Go to baseURL
await page.goto('/', { waitUntil: 'networkidle' });

//Click the Create button
await page.click('button:has-text("Create")');

// Click text=Example Imagery
await page.click('text=Example Imagery');

// Click text=OK
await Promise.all([
page.waitForNavigation(/*{ url: 'http://localhost:8080/#/browse/mine/dab945d4-5a84-480e-8180-222b4aa730fa?tc.mode=fixed&tc.startBound=1639696164435&tc.endBound=1639697964435&tc.timeSystem=utc&view=conditionSet.view' }*/),
page.click('text=OK')
]);

await expect(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Example Imagery');
});

const backgroundImageSelector = '.c-imagery__main-image__background-image';
test('Can use Mouse Wheel to zoom in and out of latest image', async ({ page }) => {
const bgImageLocator = await page.locator(backgroundImageSelector);
const deltaYStep = 100; //equivalent to 1x zoom
await bgImageLocator.hover();
const originalImageDimensions = await page.locator(backgroundImageSelector).boundingBox();
// zoom in
await bgImageLocator.hover();
await page.mouse.wheel(0, deltaYStep * 2);
// wait for zoom animation to finish
await bgImageLocator.hover();
const imageMouseZoomedIn = await page.locator(backgroundImageSelector).boundingBox();
// zoom out
await bgImageLocator.hover();
await page.mouse.wheel(0, -deltaYStep);
// wait for zoom animation to finish
await bgImageLocator.hover();
const imageMouseZoomedOut = await page.locator(backgroundImageSelector).boundingBox();

expect(imageMouseZoomedIn.height).toBeGreaterThan(originalImageDimensions.height);
expect(imageMouseZoomedIn.width).toBeGreaterThan(originalImageDimensions.width);
expect(imageMouseZoomedOut.height).toBeLessThan(imageMouseZoomedIn.height);
expect(imageMouseZoomedOut.width).toBeLessThan(imageMouseZoomedIn.width);

});

test('Can use alt+drag to move around image once zoomed in', async ({ page }) => {
const deltaYStep = 100; //equivalent to 1x zoom

const bgImageLocator = await page.locator(backgroundImageSelector);
await bgImageLocator.hover();
// zoom in
await page.mouse.wheel(0, deltaYStep * 2);
await bgImageLocator.hover();
const zoomedBoundingBox = await bgImageLocator.boundingBox();
const imageCenterX = zoomedBoundingBox.x + zoomedBoundingBox.width / 2;
const imageCenterY = zoomedBoundingBox.y + zoomedBoundingBox.height / 2;
// move to the right

// center the mouse pointer
await page.mouse.move(imageCenterX, imageCenterY);

// pan right
await page.keyboard.down('Alt');
await page.mouse.down();
await page.mouse.move(imageCenterX - 200, imageCenterY, 10);
await page.mouse.up();
await page.keyboard.up('Alt');
const afterRightPanBoundingBox = await bgImageLocator.boundingBox();
expect(zoomedBoundingBox.x).toBeGreaterThan(afterRightPanBoundingBox.x);

// pan left
await page.keyboard.down('Alt');
await page.mouse.down();
await page.mouse.move(imageCenterX, imageCenterY, 10);
await page.mouse.up();
await page.keyboard.up('Alt');
const afterLeftPanBoundingBox = await bgImageLocator.boundingBox();
expect(afterRightPanBoundingBox.x).toBeLessThan(afterLeftPanBoundingBox.x);

// pan up
await page.mouse.move(imageCenterX, imageCenterY);
await page.keyboard.down('Alt');
await page.mouse.down();
await page.mouse.move(imageCenterX, imageCenterY + 200, 10);
await page.mouse.up();
await page.keyboard.up('Alt');
const afterUpPanBoundingBox = await bgImageLocator.boundingBox();
expect(afterUpPanBoundingBox.y).toBeGreaterThan(afterLeftPanBoundingBox.y);

// pan down
await page.keyboard.down('Alt');
await page.mouse.down();
await page.mouse.move(imageCenterX, imageCenterY - 200, 10);
await page.mouse.up();
await page.keyboard.up('Alt');
const afterDownPanBoundingBox = await bgImageLocator.boundingBox();
expect(afterDownPanBoundingBox.y).toBeLessThan(afterUpPanBoundingBox.y);

});

test('Can use + - buttons to zoom on the image', async ({ page }) => {
const bgImageLocator = await page.locator(backgroundImageSelector);
await bgImageLocator.hover();
const zoomInBtn = await page.locator('.t-btn-zoom-in');
const zoomOutBtn = await page.locator('.t-btn-zoom-out');
const initialBoundingBox = await bgImageLocator.boundingBox();

await zoomInBtn.click();
await zoomInBtn.click();
// wait for zoom animation to finish
await bgImageLocator.hover();
const zoomedInBoundingBox = await bgImageLocator.boundingBox();
expect(zoomedInBoundingBox.height).toBeGreaterThan(initialBoundingBox.height);
expect(zoomedInBoundingBox.width).toBeGreaterThan(initialBoundingBox.width);

await zoomOutBtn.click();
// wait for zoom animation to finish
await bgImageLocator.hover();
const zoomedOutBoundingBox = await bgImageLocator.boundingBox();
expect(zoomedOutBoundingBox.height).toBeLessThan(zoomedInBoundingBox.height);
expect(zoomedOutBoundingBox.width).toBeLessThan(zoomedInBoundingBox.width);

});

test('Can use the reset button to reset the image', async ({ page }) => {
const bgImageLocator = await page.locator(backgroundImageSelector);
await bgImageLocator.hover();
const zoomInBtn = await page.locator('.t-btn-zoom-in');
const zoomResetBtn = await page.locator('.t-btn-zoom-reset');
const initialBoundingBox = await bgImageLocator.boundingBox();

await zoomInBtn.click();
await zoomInBtn.click();
// wait for zoom animation to finish
await bgImageLocator.hover();
const zoomedInBoundingBox = await bgImageLocator.boundingBox();
expect(zoomedInBoundingBox.height).toBeGreaterThan(initialBoundingBox.height);
expect(zoomedInBoundingBox.width).toBeGreaterThan(initialBoundingBox.width);

await zoomResetBtn.click();
await bgImageLocator.hover();

const resetBoundingBox = await bgImageLocator.boundingBox();
expect(resetBoundingBox.height).toBeLessThan(zoomedInBoundingBox.height);
expect(resetBoundingBox.width).toBeLessThan(zoomedInBoundingBox.width);

expect(resetBoundingBox.height).toEqual(initialBoundingBox.height);
expect(resetBoundingBox.width).toEqual(initialBoundingBox.width);
});

//test('Can use Mouse Wheel to zoom in and out of previous image');
//test('Can zoom into the latest image and the real-time/fixed-time imagery will pause');
//test.skip('Can zoom into a previous image from thumbstrip in real-time or fixed-time');
//test.skip('Clicking on the left arrow should pause the imagery and go to previous image');
//test.skip('If the imagery view is in pause mode, it should not be updated when new images come in');
//test.skip('If the imagery view is not in pause mode, it should be updated when new images come in');
});

test.describe('Example Imagery in Display layout', () => {
test.skip('Can use Mouse Wheel to zoom in and out of previous image');
test.skip('Can use alt+drag to move around image once zoomed in');
test.skip('Can zoom into the latest image and the real-time/fixed-time imagery will pause');
test.skip('Clicking on the left arrow should pause the imagery and go to previous image');
test.skip('If the imagery view is in pause mode, it should not be updated when new images come in');
test.skip('If the imagery view is not in pause mode, it should be updated when new images come in');
});

test.describe('Example Imagery in Flexible layout', () => {
test.skip('Can use Mouse Wheel to zoom in and out of previous image');
test.skip('Can use alt+drag to move around image once zoomed in');
test.skip('Can zoom into the latest image and the real-time/fixed-time imagery will pause');
test.skip('Clicking on the left arrow should pause the imagery and go to previous image');
test.skip('If the imagery view is in pause mode, it should not be updated when new images come in');
test.skip('If the imagery view is not in pause mode, it should be updated when new images come in');
});

test.describe('Example Imagery in Tabs view', () => {
test.skip('Can use Mouse Wheel to zoom in and out of previous image');
test.skip('Can use alt+drag to move around image once zoomed in');
test.skip('Can zoom into the latest image and the real-time/fixed-time imagery will pause');
test.skip('Can zoom into a previous image from thumbstrip in real-time or fixed-time');
test.skip('Clicking on the left arrow should pause the imagery and go to previous image');
test.skip('If the imagery view is in pause mode, it should not be updated when new images come in');
test.skip('If the imagery view is not in pause mode, it should be updated when new images come in');
});
Loading