-
Notifications
You must be signed in to change notification settings - Fork 38
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
Expose axes limits in viewer options #304
Open
kecnry
wants to merge
5
commits into
glue-viz:main
Choose a base branch
from
kecnry:profile-viewer-options-limits
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9e25537
expose axes limits in profile viewer options
kecnry f3d9801
Apply suggestions from code review
kecnry 693d72b
Only sync limits with glue state when 'Apply limits' button is clicked
astrofrog a072709
Make sure limits are synced with glue state changes
astrofrog ffdf175
enable axes limits for image viewer
kecnry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from .axes_limits import AxesLimits | ||
from .color import Color | ||
from .size import Size | ||
from .linked_dropdown import LinkedDropdown | ||
|
||
__all__ = ['Color', 'Size', 'LinkedDropdown'] | ||
__all__ = ['AxesLimits', 'Color', 'Size', 'LinkedDropdown'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import traitlets | ||
import ipyvuetify as v | ||
from echo import delay_callback | ||
from ..link import dlink | ||
from ..state_traitlets_helpers import GlueState | ||
|
||
__all__ = ['AxesLimits'] | ||
|
||
|
||
class AxesLimits(v.VuetifyTemplate): | ||
template_file = (__file__, 'axes_limits.vue') | ||
|
||
glue_state = GlueState().tag(sync=True) | ||
|
||
x_min = traitlets.Float(default_value=None, allow_none=True).tag(sync=True) | ||
x_max = traitlets.Float(default_value=None, allow_none=True).tag(sync=True) | ||
y_min = traitlets.Float(default_value=None, allow_none=True).tag(sync=True) | ||
y_max = traitlets.Float(default_value=None, allow_none=True).tag(sync=True) | ||
|
||
def __init__(self, viewer_state): | ||
super().__init__() | ||
self.glue_state = viewer_state | ||
dlink((self.glue_state, 'x_min'), (self, 'x_min')) | ||
dlink((self.glue_state, 'x_max'), (self, 'x_max')) | ||
dlink((self.glue_state, 'y_min'), (self, 'y_min')) | ||
dlink((self.glue_state, 'y_max'), (self, 'y_max')) | ||
|
||
def vue_apply_limits(self, data): | ||
self._cache = (self.x_min, self.x_max, self.y_min, self.y_max) | ||
with delay_callback(self.glue_state, 'x_min', 'x_max', 'y_min', 'y_max'): | ||
if self.x_min is not None: | ||
self.glue_state.x_min = self.x_min | ||
if self.x_max is not None: | ||
self.glue_state.x_max = self.x_max | ||
if self.y_min is not None: | ||
self.glue_state.y_min = self.y_min | ||
if self.y_max is not None: | ||
self.glue_state.y_max = self.y_max | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<template> | ||
<div> | ||
<v-row no-gutters> | ||
<v-col cols="6"> | ||
<glue-float-field class="mr-1" label="xmin" :value.sync="x_min" /> | ||
</v-col> | ||
<v-col cols="6"> | ||
<glue-float-field class="ml-1" label="xmax" :value.sync="x_max" /> | ||
</v-col> | ||
</v-row> | ||
<v-row no-gutters> | ||
<v-col cols="6"> | ||
<glue-float-field class="mr-1" label="ymin" :value.sync="y_min" /> | ||
</v-col> | ||
<v-col cols="6"> | ||
<glue-float-field class="ml-1" label="ymax" :value.sync="y_max" /> | ||
</v-col> | ||
</v-row> | ||
<v-row> | ||
<v-col class="text-center" cols="12"> | ||
<v-btn @click="apply_limits"> | ||
Apply limits | ||
</v-btn> | ||
</v-col> | ||
</v-row> | ||
</div> | ||
</template> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when used in an image viewer (now enabled), how is a change in all limits, with equal aspect enabled, handled with this delayed callback? From testing, it seems that the user-set x-limits are preserved and the y-limits are somehow adjusted to enforce the equal aspect?
I'm honestly not sure what the expected behavior should be in this case... maybe the smallest bounding box in x and y that contains the user-provided values?