Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/CARTAvis/carta-frontend into…
Browse files Browse the repository at this point in the history
… mark/support_loading_swapped_axes_images
  • Loading branch information
markccchiang committed Mar 1, 2023
2 parents 328ba75 + cf3fb01 commit 7a363e4
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Added settings in the image view settings widget for panning and zooming the images ([#1176](https://github.com/CARTAvis/carta-frontend/issues/1176)).
* Added supports for swapped-axes image cubes ([#1953](https://github.com/CARTAvis/carta-frontend/issues/1953)).
### Fixed
* Fixed the issue of contour levels not deleted as intended ([#2091](https://github.com/CARTAvis/carta-frontend/issues/2091)).
* Fixed issue of only enabling catalog selection button when there is a layer of catalog overlay ([#1826](https://github.com/CARTAvis/carta-frontend/issues/1826)).
* Fixed the issue of the corrupted spatial profile when cursor is moving ([#1602](https://github.com/CARTAvis/carta-frontend/issues/1602)).
* Fixed NaN pixel value in the cursor info bar of the image viewer when the image is 1x1 pixel ([#1879](https://github.com/CARTAvis/carta-frontend/issues/1879)).
Expand All @@ -34,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Fixed the region position offset mismatch problem after zooming to fit for spatially matched images. ([#2028](https://github.com/CARTAvis/carta-frontend/issues/2028)).
* Improved the performance of loading regions in batches ([#2040](https://github.com/CARTAvis/carta-frontend/issues/2040)).
* Fixed offset between cusorInfo and upper wcs axis in the spatial profilers ([#1319](https://github.com/CARTAvis/carta-frontend/issues/1319)).
* Fixed mismatch between cursor and image during PV image panning ([#1790](https://github.com/CARTAvis/carta-frontend/issues/1790)).
* Fixed the hanging problem for computed stokes animation ([#1238](https://github.com/CARTAvis/carta-backend/issues/1238)).
### Changed
* Increased the upper limit of averaging width for line/polyline spatial profiles or PV images calculations ([#1949](https://github.com/CARTAvis/carta-frontend/issues/1949)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ export class ContourDialogComponent extends React.Component {

private handleGraphClicked = (x: number) => {
this.levels.push(x);
this.levels.sort();
};

private handleGraphRightClicked = (x: number) => {
Expand Down Expand Up @@ -250,6 +251,7 @@ export class ContourDialogComponent extends React.Component {
const val = parseFloat(valueString);
if (isFinite(val)) {
this.levels.push(val);
this.levels.sort();
}
}
} catch (e) {
Expand Down
7 changes: 3 additions & 4 deletions src/components/ImageView/RegionView/RegionViewComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@ export class RegionViewComponent extends React.Component<RegionViewComponentProp
const stage = this.stageRef.current;
if (stage && refCenterMovement && isFinite(refCenterMovement.x) && isFinite(refCenterMovement.y) && isFinite(refFrameZoom)) {
stage.scale({x: refFrameZoom / AppStore.Instance.imageRatio, y: refFrameZoom / AppStore.Instance.imageRatio});
const origin = scale2D({x: this.props.width / 2, y: this.props.height / 2}, 1 - refFrameZoom);
const centerMovementCanvas = scale2D({x: refCenterMovement.x, y: -refCenterMovement.y}, refFrameZoom / devicePixelRatio);
const origin = {x: (this.props.width * (1 - refFrameZoom * this.props.frame.aspectRatio)) / 2, y: (this.props.height * (1 - refFrameZoom)) / 2};
const centerMovementCanvas = {x: refCenterMovement.x * ((refFrameZoom * this.props.frame.aspectRatio) / devicePixelRatio), y: -refCenterMovement.y * (refFrameZoom / devicePixelRatio)};
const newOrigin = add2D(origin, centerMovementCanvas);
// Correct the origin if region view is ever resized
const correctedOrigin = subtract2D(newOrigin, scale2D(this.stageResizeOffset, refFrameZoom));
Expand Down Expand Up @@ -495,13 +495,12 @@ export class RegionViewComponent extends React.Component<RegionViewComponentProp
const frame = this.props.frame;
if (frame) {
const cursorPosImageSpace = canvasToTransformedImagePos(mouseEvent.offsetX, mouseEvent.offsetY, frame, this.props.width, this.props.height);
const cursorInfo = this.props.frame.getCursorInfo(cursorPosImageSpace);
const delta = -mouseEvent.deltaY * (mouseEvent.deltaMode === WheelEvent.DOM_DELTA_PIXEL ? 1 : LINE_HEIGHT);
const zoomSpeed = 1 + Math.abs(delta / 750.0);

// If frame is spatially matched, apply zoom to the reference frame, rather than the active frame
const newZoom = (frame.spatialReference ? frame.spatialReference.zoomLevel : frame.zoomLevel) * (delta > 0 ? zoomSpeed : 1.0 / zoomSpeed);
frame.zoomToPoint(cursorInfo.posImageSpace.x, cursorInfo.posImageSpace.y, newZoom, true);
frame.zoomToPoint(cursorPosImageSpace.x, cursorPosImageSpace.y, newZoom, true);

// Zoom stage
const zoomCenter = PreferenceStore.Instance.zoomPoint === ZoomPoint.CURSOR ? {x: mouseEvent.offsetX, y: mouseEvent.offsetY} : {x: this.props.width / 2, y: this.props.height / 2};
Expand Down
4 changes: 2 additions & 2 deletions src/stores/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ export * from "./AnimatorStore/AnimatorStore";
export * from "./AppStore/AppStore";
export * from "./Catalog/CatalogProfileStore";
export * from "./Catalog/CatalogStore";
export * from "./CatalogOnlieQuery/CatalogOnlieQueryConfigStore";
export * from "./CatalogOnlieQuery/CatalogOnlineQueryProfileStore";
export * from "./CatalogOnlineQuery/CatalogOnlineQueryConfigStore";
export * from "./CatalogOnlineQuery/CatalogOnlineQueryProfileStore";
export * from "./DialogStore/DialogStore";
export * from "./FileBrowserStore/FileBrowserStore";
export * from "./HelpStore/HelpStore";
Expand Down

0 comments on commit 7a363e4

Please sign in to comment.