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

feat: 6867 6868 image and dot opacity #1029

Merged
merged 5 commits into from
Jul 11, 2024
Merged

Conversation

tihuan
Copy link
Contributor

@tihuan tihuan commented Jul 9, 2024

  1. Add Opacities component to control both image and dots opacity
  2. Move Image Toggle button to the left side as part of the Embedding component

KNOWN ISSUES

  1. The opacity control is persistent across different embedding types and shared between main and side panels
  2. For example, if you set dot opacity to 50% and switch embedding to a non-spatial one, the dots will still be at 50% opacity
    • Screenshot 2024-07-09 at 10 26 43 AM

Screenshots:

  1. Screenshot 2024-07-09 at 10 26 19 AM
  2. Screenshot 2024-07-09 at 10 26 26 AM
  3. Screenshot 2024-07-09 at 10 26 33 AM

Video:

Screen.Recording.2024-07-09.at.10.12.03.AM-1.mov

Comment on lines -36 to -42
imageUnderlay: RootState["controls"]["imageUnderlay"];
// eslint-disable-next-line react/no-unused-prop-types -- used in shouldShowOpenseadragon
layoutChoice: RootState["layoutChoice"];
// eslint-disable-next-line react/no-unused-prop-types -- used in shouldShowOpenseadragon
config: RootState["config"];
// eslint-disable-next-line react/no-unused-prop-types -- used in shouldShowOpenseadragon
panelEmbedding: RootState["panelEmbedding"];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved the image toggle button to Embedding component, so we no longer need these props here

Comment on lines +35 to +36
imageOpacity: number;
dotOpacity: number;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new redux state for both opacities

import { RootState } from "../../../../reducers";
import { Props, StateProps } from "./types";

function Opacities({ imageOpacity, dotOpacity, dispatch }: Props) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opacities component hosts both types of opacity control

Comment on lines +37 to +41
// eslint-disable-next-line react/no-unused-prop-types -- used in shouldShowOpenseadragon
config: RootState["config"];
// eslint-disable-next-line react/no-unused-prop-types -- used in shouldShowOpenseadragon
panelEmbedding: RootState["panelEmbedding"];
imageUnderlay: RootState["controls"]["imageUnderlay"];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Embedding component now needs these props to determine whether to show the Image toggle button and its dropdown or not

@@ -146,7 +158,7 @@ const Embedding = (props: Props) => {
</div>
}
>
<Tooltip
<Tooltip2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upgrade to Tooltip2 as a bonus

Comment on lines +201 to +223
<Button
type="button"
data-testid="toggle-image-underlay"
icon="media"
intent={imageUnderlay ? "primary" : "none"}
active={imageUnderlay}
onClick={() => {
track(
/**
* (thuang): If `imageUnderlay` is currently `true`, then
* we're about to deselect it thus firing the deselection event.
*/
imageUnderlay
? EVENTS.EXPLORER_IMAGE_DESELECT
: EVENTS.EXPLORER_IMAGE_SELECT
);
dispatch({
type: "toggle image underlay",
toggle: !imageUnderlay,
});
}}
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

existing code moved here

Comment on lines 224 to 236
<Popover2
onOpening={handleLayoutChoiceClick}
position={Position.BOTTOM_LEFT}
content={<Opacities />}
>
<ImageDropdownButton
type="button"
data-testid="image-underlay-dropdown"
icon="caret-down"
/>
</Popover2>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the new pop over that shows Opacities control as its content

@@ -1115,7 +1125,7 @@ class Graph extends React.Component<GraphProps, GraphState> {
return createColorQuery(colorMode, colorAccessor, schema, genesets);
}

updateOpenSeadragon() {
initOpenSeadragon() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update the name to reflect its actual functionality

@tihuan tihuan force-pushed the thuang-6867-image-dot-opacity branch from 49d7440 to 15bf212 Compare July 9, 2024 17:36
@tihuan tihuan requested review from kaloster and hthomas-czi July 9, 2024 17:39
@tihuan tihuan added the stack label Jul 9, 2024
@tihuan tihuan force-pushed the thuang-6867-image-dot-opacity branch from e5a7ece to d17f372 Compare July 9, 2024 18:45
@tihuan tihuan added stack and removed stack labels Jul 9, 2024
@tihuan tihuan force-pushed the thuang-6867-image-dot-opacity branch from 26658b5 to af96c05 Compare July 9, 2024 20:56
Copy link

@hthomas-czi hthomas-czi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, Timmy! I just see a couple things that would be great to fix.

  1. The "Image Opacity" and "Dot Opacity" labels should use the same style as the "Standard Categories" label.
  2. Clicking outside of the opacity popover (and the embedding popover actually) to dismiss it doesn't work as expected. It only works if you click outside of the main center workspace (i.e., one of the sidebars or the inline with the toolbar)

This isn't from this PR but it'd also be nice to fix the position of the cell count. It should be left aligned with the embedding selector icon. It appears to be shifted over because of the color legend, but it looks weird when the user isn't coloring by a continuous variable. Ideally, the color legend would appear below the cell count.

@tihuan
Copy link
Contributor Author

tihuan commented Jul 9, 2024

Ohh eagle eye 🦅 👁️!! Thanks so much, Harley! Will address all 3 👍

Also I need to investigate the failing e2e tests HMM!

@tihuan tihuan force-pushed the thuang-6867-image-dot-opacity branch from 376260d to 02d29bd Compare July 11, 2024 15:11
@tihuan
Copy link
Contributor Author

tihuan commented Jul 11, 2024

@hthomas-czi okay all 3 issues should be address now 😄 PTAL again and thanks again for catching them!

Screenshot 2024-07-11 at 8 11 52 AM Screenshot 2024-07-11 at 8 12 03 AM
Screen.Recording.2024-07-11.at.8.12.20.AM.mov

@tihuan tihuan requested a review from hthomas-czi July 11, 2024 15:14
@@ -132,6 +132,7 @@ const Header = (props: HeaderProps) => {
<Right>
<LinkWrapper>
<Popover2
hasBackdrop
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding backdrop creates a reliable way to detect click outside of the popover element

Copy link

@hthomas-czi hthomas-czi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks, Timmy.

@tihuan
Copy link
Contributor Author

tihuan commented Jul 11, 2024

Thanks so much, Harley!

Looks like I need to update the e2e tests. Will do that after my meetings!

@tihuan tihuan force-pushed the thuang-6867-image-dot-opacity branch 2 times, most recently from 3c7ae9e to 452693e Compare July 11, 2024 21:40
@tihuan tihuan force-pushed the thuang-6867-image-dot-opacity branch from 452693e to 01db94a Compare July 11, 2024 21:50
@tihuan
Copy link
Contributor Author

tihuan commented Jul 11, 2024

Okay finally all passed lol Merging!

@tihuan tihuan merged commit 97f57e6 into main Jul 11, 2024
19 checks passed
@tihuan tihuan deleted the thuang-6867-image-dot-opacity branch July 11, 2024 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants