ViewUtils
Import :
const ViewUtils = brackets.getModule("utils/ViewUtils")
addScrollerShadow(displayElement, scrollElement, showBottom)
Installs event handlers for updatng shadow background elements to indicate vertical scrolling.
Kind: global function
| Param | Type | Description |
|---|---|---|
| displayElement | DOMElement | the DOMElement that displays the shadow. Must fire "contentChanged" events when the element is resized or repositioned. |
| scrollElement | Object | the object that is scrolled. Must fire "scroll" events when the element is scrolled. If null, the displayElement is used. |
| showBottom | boolean | optionally show the bottom shadow |
removeScrollerShadow(displayElement, scrollElement)
Remove scroller-shadow effect.
Kind: global function
| Param | Type | Description |
|---|---|---|
| displayElement | DOMElement | the DOMElement that displays the shadow |
| scrollElement | Object | the object that is scrolled |
toggleClass($domElement, className, addClass)
Utility function to replace jQuery.toggleClass when used with the second argument, which needs to be a true boolean for jQuery
Kind: global function
| Param | Type | Description |
|---|---|---|
| $domElement | jQueryObject | The jQueryObject to toggle the Class on |
| className | string | Class name or names (separated by spaces) to toggle |
| addClass | boolean | A truthy value to add the class and a falsy value to remove the class |
sidebarList(scrollElement, selectedClassName)
Within a scrolling DOMElement, creates and positions a styled selection div to align a single selected list item from a ul list element.
Assumptions:
- scrollerElement is a child of the #sidebar div
- ul list element fires a "selectionChanged" event after the selectedClassName is assigned to a new list item
Kind: global function
| Param | Type | Description |
|---|---|---|
| scrollElement | DOMElement | A DOMElement containing a ul list element |
| selectedClassName | string | A CSS class name on at most one list item in the contained list |
getElementClipSize($view, elementRect) ⇒ Object
Determine how much of an element rect is clipped in view.
Kind: global function
Returns: Object - amount element rect is clipped in each direction
| Param | Type | Description |
|---|---|---|
| $view | DOMElement | A jQuery scrolling container |
| elementRect | Object | rectangle of element's default position/size |
scrollElementIntoView($view, $element, scrollHorizontal)
Within a scrolling DOMElement, if necessary, scroll element into viewport.
To Perform the minimum amount of scrolling necessary, cases should be handled as follows:
- element already completely in view : no scrolling
- element above viewport : scroll view so element is at top
- element left of viewport : scroll view so element is at left
- element below viewport : scroll view so element is at bottom
- element right of viewport : scroll view so element is at right
Assumptions:
- $view is a scrolling container
Kind: global function
| Param | Type | Description |
|---|---|---|
| $view | DOMElement | A jQuery scrolling container |
| $element | DOMElement | A jQuery element |
| scrollHorizontal | boolean | whether to also scroll horizontally |
getFileEntryDisplay(entry) ⇒ string
HTML formats a file entry name for display in the sidebar.
Kind: global function
Returns: string - HTML formatted string
| Param | Type | Description |
|---|---|---|
| entry | File | File entry to display |
getDirNamesForDuplicateFiles(files) ⇒ Array.<string>
Determine the minimum directory path to distinguish duplicate file names for each file in list.
Kind: global function
Returns: Array.<string> - directory paths to match list of files
| Param | Type | Description |
|---|---|---|
| files | Array.<File> | list of Files with the same filename |
hideMainToolBar()
Hides the main toolbar
Kind: global function
showMainToolBar()
Shows the main toolbar
Kind: global function