Skip to content
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
8 changes: 4 additions & 4 deletions src/renderview.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ div.renderview-wrapper .renderview-button:hover {
background: var(--line-color);
}

div.renderview-wrapper .renderview-button:last-child {
margin-right: 0.2em;
}

div.renderview-wrapper .renderview-resizer {
display: none;
position: absolute;
Expand Down Expand Up @@ -98,6 +94,10 @@ div.renderview-wrapper.is-resizable .renderview-resizer {
display: block;
}

div.renderview-wrapper.is-resizable.is-minimized .renderview-resizer {
display: none;
}

div.renderview-wrapper.is-minimizable .renderview-minimize-button {
display: inline-block;
}
Expand Down
35 changes: 35 additions & 0 deletions src/renderview.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,38 @@ class BaseRenderView {
}
}

/**
* Set whether the view has a button to minimize the widget.
* Note that the view can only be made minimizable if it was instantiated with a wrapper.
*
* @param {boolean} resizable - Whether to make it resizable or not.
*/
setMinimizable (minimizable) {
if (this.wrapperElement) {
if (minimizable) {
this.wrapperElement.classList.add('is-minimizable')
} else {
this.wrapperElement.classList.remove('is-minimizable')
}
}
}

/**
* Set whether the view has a button to close the widget.
* Note that the view can only be made closable if it was instantiated with a wrapper.
*
* @param {boolean} resizable - Whether to make it resizable or not.
*/
setClosable (closable) {
if (this.wrapperElement) {
if (closable) {
this.wrapperElement.classList.add('is-closable')
} else {
this.wrapperElement.classList.remove('is-closable')
}
}
}

/**
* Set whether the view has a titlebar.
* Note that the view can only have a titlebar if it was instantiated with a wrapper.
Expand Down Expand Up @@ -375,9 +407,12 @@ class BaseRenderView {
this.butCloseElement = document.createElement('span')
this.butCloseElement.innerText = '×'
this.butCloseElement.classList.add('renderview-button', 'renderview-close-button')
const butPadElement = document.createElement('span')
butPadElement.style.width = '0.3em'
topElement.appendChild(this.titleElement)
topElement.appendChild(this.butMinimizeElement)
topElement.appendChild(this.butCloseElement)
topElement.appendChild(butPadElement)
wrapperElement.appendChild(topElement)

// Enable resizing
Expand Down
Loading