xcv58 / atom-autohide-tree-view

Hides most of the tree view, reveal it on hover

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

autohide-tree-view package

Hide the tree view, show it on hover.

Image inserted by Atom editor package auto-host-markdown-image

Config

setting type unit default description
showOn string none hover + touch The type of event that should trigger show/hide of the tree view. Hover, Click, Touch (or any combination) or None.
animate boolean none true Enable/disable the animation when showing the menu
showDelay number seconds 0.2 The delay before the tree view will show when hovered
hideDelay number seconds 0.2 The delay before the tree view will hide when hovered
minwidth integer pixels 1 The width of the hidden tree view
pushEditor boolean none false Push the editor when showing the tree view
hoverAreasize integer pixels 0 Width of an invisible area at the edge of the screen where hover events will be triggered. When smaller than the value of the minwidth setting, minwidth will be used.
touchAreaSize integer pixels 50 Width of an invisible area at the edge of the screen where touch events will be triggered.
maxWindowWidth integer pixels 0 Max window width for which autohide should be enabled. If on a resize the window width crosses this threshold, autohide will automatically be enabled or disabled. Set to 0 to always have autohide enabled.
showPinButton boolean none false Show a pin button in the tree view that enables/disables autohide.

Touch events

Show/hide the tree view with swiping gestures. For touch events, the atom-touch-events package is required. You'll have to re-enable autohide-tree-view, or reload Atom, after installing atom-touch-events for the touch events to work.

Services provided

autohide-tree-view provides a service for Show, Hide, Enable and Disable actions. To consume the service, put the following in your package's package.json:

"consumedServices": {
  "autohide-tree-view": {
    "versions": {
      // refers to the consumer method in your package's main module
      "^0.24.0": "consumeAutohideTreeViewService"
    }
  }
}

And in your package's main module, put this:

consumeAutohideTreeViewService: (service) ->
  # show/hide the tree view
  # @param delay: delay in ms before starting the animation
  service.show(delay)
  service.hide(delay)
  service.isVisible()

  # enable/disable autohide behaviour
  service.pin()
  service.unpin()
  service.isPinned()

The show, hide, pin and unpin methods return a promise that will be resolved once the tree view animation is done. It's resolved value is a boolean, indicating if the animation was finished (true) or cancelled (false). The promise is rejected if an error occurs during the animation.

isVisible and isPinned return a boolean, indicating whether the tree view is visible or pinned.

A silly example:

// open the tree view, and hide it again if
// it wasn't cancelled
function consumeAutohideTreeViewService(service) {
  service.show(0).then(function(finished) {
    if(finished) {
      service.hide();
    }
  }, function(err) {
    // something went wrong!!
    console.error(err);
  });
}

Issues/suggestions

Please file issues or suggestions on the issues page on github, or even better, submit a pull request

License

© 2015 Olmo Kramer
MIT License

About

Hides most of the tree view, reveal it on hover

License:MIT License


Languages

Language:JavaScript 96.3%Language:CSS 3.7%