Skip to content

Commit

Permalink
📝 Update documentation and screnshots
Browse files Browse the repository at this point in the history
  • Loading branch information
abe33 committed Feb 3, 2015
1 parent c17a5dc commit 6ee3035
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 24 deletions.
6 changes: 5 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ apm install minimap
* `Plugins *`: When plugins are installed, a setting is created for each to enable/disable them directly from the minimap settings view.
* `Use Hardware Acceleration`: If checked the minimap scroll is done using a `translate3d` transform, otherwise the `translate` transform is used. (default=true)

For instance the following result is obtained by setting a `Char Height` of `1px`:

![Minimap Screenshot](https://github.com/fundon/atom-minimap/blob/master/screenshot-alternate.png?raw=true)

### Key Bindings

Customizing Key Bindings:

```cson
'.editor':
'atom-workspace':
'cmd-m': 'minimap:toggle'
'ctrl-alt-cmd-m': 'minimap:generate-plugin'
```
Expand Down
4 changes: 3 additions & 1 deletion docs/Decorations.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ The reason of using a scope rather than a class is that while editor's decoratio
This allow the minimap decorations to still be stylable using css. For instance, the scope used by the `minimap-selection` package is:

```css
.minimap .editor .selection .region
.minimap .editor .selection .region {
/* ... */
}
```

Note that the scope is prefixed with `.minimap` so that you can override the selection style in the minimap without impacting the editor's one.
Expand Down
41 changes: 19 additions & 22 deletions docs/Plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,19 @@ module.exports =

activate: (state) ->
# During the activation, the minimap package is retrieved.
minimapPackage = atom.packages.getLoadedPackage('minimap')
return @deactivate() unless minimapPackage?
atom.packages.activatePackage('minimap').then (pkg) =>
@minimap = pkg.mainModule

@minimap = require minimapPackage.path
# And a test against the minimap version allow to prevent compatibility
# issues.
return @deactivate() unless @minimap.versionMatch('4.x')

# And a test against the minimap version allow to prevent compatibility
# issues.
return @deactivate() unless @minimap.versionMatch('3.x')
# The subscriptions object will store the disposable returned when
# registering to minimap events.
@subscriptions = new CompositeDisposable

# The subscriptions object will store the disposable returned when
# registering to minimap events.
@subscriptions = new CompositeDisposable

# The plugin is then registered as a plugin in the minimap.
@minimap.registerPlugin 'plugin-name', this
# The plugin is then registered as a plugin in the minimap.
@minimap.registerPlugin 'plugin-name', this

deactivate: ->
@minimap.unregisterPlugin 'plugin-name'
Expand All @@ -56,17 +54,17 @@ module.exports =

@subscriptions.add @minimap.onDidActivate =>
# do something when the minimap is activated

@subscriptions.add @minimap.onDidDeactivate =>
# do something when the minimap is deactivated

@subscription = @minimap.eachMinimapView ({view}) ->
# Do something everytime a minimap view is created.
@subscriptions.add @minimap.observeMinimaps (minimap) ->
# do something each time a minimap is created.

deactivatePlugin: ->
return unless @active

@active = false
@subscription.off()
@subscriptions.dispose()
```

Expand All @@ -77,20 +75,19 @@ The Minimap package provides a simple API for plugins:
* `registerPlugin(name, plugin)` - Registers `plugin` as a minimap plugin. The given `name` will be used to access the plugin as well as a key for the associated minimap setting. When called the Minimap package will proceed as follow:
* It will create a `minimap.plugins.{name}` setting. If there was no previous setting with that name, the default value will be set to `true`, otherwise the value of the setting is retrieved from the Atom config object.
* It will create a `minimap:toggle-{name}` command that allow to activate/deactive the plugin through the command palette.
* It will emit a `plugin:added` event with an object such as `{name, plugin}`.
* It will emit a `did-add-plugin` event with an object such as `{name, plugin}`.
* It will activate/deactive the plugin accordingly with its associated setting value.
* `unregisterPlugin(name)` - Unregisters the plugin registered with the given `name`. When called it will proceed as follow:
* It will stop observing the setting created for the plugin.
* It will remove the command palette created for the plugin.
* It will emit a `plugin:removed` event with an object such as `{name, plugin}`.
* It will emit a `did-remove-plugin` event with an object such as `{name, plugin}`.
* `versionMatch(expectedVersion)` - If a plugin needs a specific version of the Minimap package to work with it can use the `versionMatch` method to test the Minimap version against a `semver` version. In that case, the plugin `activate` method could be written as:
```coffee
activate: ->
minimapPackage = atom.packages.getLoadedPackage('minimap')
return @deactivate() unless minimapPackage?
atom.packages.activatePackage('minimap').then (pkg) =>
@minimap = pkg.mainModule

@minimap = require minimapPackage.path
return @deactivate() unless @minimap.versionMatch('3.x')
return @deactivate() unless @minimap.versionMatch('4.x')

@minimap.registerPlugin 'my-plugin', this
@minimap.registerPlugin 'my-plugin', this
```
Binary file added screenshot-alternate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6ee3035

Please sign in to comment.