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

Made side-panel resizable #650

Merged
merged 1 commit into from
Jul 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions packages/perspective-viewer/src/html/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
</div>
<perspective-computed-column></perspective-computed-column>
</div>
<div id="resize_bar"></div>
</div>
<div class="column noselect">
<div id='top_panel'>
Expand Down
13 changes: 13 additions & 0 deletions packages/perspective-viewer/src/js/viewer/action_element.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,18 @@ export class ActionElement extends DomElement {
this.setAttribute("column-pivots", row_pivots);
}

_resize_sidepanel() {
const resize = event => {
this._side_panel.style.width = `${event.clientX}px`;
};
const stop = () => {
document.removeEventListener("mousemove", resize);
document.removeEventListener("mouseup", stop);
};
document.addEventListener("mousemove", resize);
document.addEventListener("mouseup", stop);
}

// most of these are drag and drop handlers - how to clean up?
_register_callbacks() {
this._sort.addEventListener("drop", drop.bind(this));
Expand Down Expand Up @@ -236,6 +248,7 @@ export class ActionElement extends DomElement {
this._download_button.addEventListener("click", event => this.download(event.shiftKey));
this._transpose_button.addEventListener("click", this._transpose.bind(this));
this._drop_target.addEventListener("dragover", dragover.bind(this));
this._resize_bar.addEventListener("mousedown", this._resize_sidepanel.bind(this));

this._vis_selector.addEventListener("change", () => {
this.setAttribute("plugin", this._vis_selector.value);
Expand Down
1 change: 1 addition & 0 deletions packages/perspective-viewer/src/js/viewer/dom_element.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ export class DomElement extends PerspectiveElement {
this._plugin_information_action = this.shadowRoot.querySelector(".plugin_information__action");
this._plugin_information_dismiss = this.shadowRoot.querySelector(".plugin_information__action--dismiss");
this._plugin_information_message = this.shadowRoot.querySelector("#plugin_information_count");
this._resize_bar = this.shadowRoot.querySelector("#resize_bar");
}

// sets state, manipulates DOM
Expand Down
10 changes: 10 additions & 0 deletions packages/perspective-viewer/src/less/viewer.less
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@
}
}
#side_panel {
position: relative;
flex: 0 0 auto;
padding: var(--side_panel--padding, 10px 10px 0px 11px);
}
Expand All @@ -438,4 +439,13 @@
color: var(--button-hover--color, inherit);
}
}

#resize_bar {
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 8px;
cursor: col-resize;
}
}