diff --git a/Readme.md b/Readme.md index 3cc44fdc..0698241c 100644 --- a/Readme.md +++ b/Readme.md @@ -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' ``` diff --git a/docs/Decorations.md b/docs/Decorations.md index 4469e776..dac332e0 100644 --- a/docs/Decorations.md +++ b/docs/Decorations.md @@ -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. diff --git a/docs/Plugins.md b/docs/Plugins.md index 07916ec8..20646be6 100644 --- a/docs/Plugins.md +++ b/docs/Plugins.md @@ -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' @@ -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() ``` @@ -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 ``` diff --git a/screenshot-alternate.png b/screenshot-alternate.png new file mode 100644 index 00000000..10c32000 Binary files /dev/null and b/screenshot-alternate.png differ diff --git a/screenshot.png b/screenshot.png index 8ad798f2..30d4b439 100644 Binary files a/screenshot.png and b/screenshot.png differ