mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-20 10:03:29 +00:00
This is a facade interface that ties together a bunch of different internal objects and will make it easier to write tests for behaviors, modes, and operations.
30 lines
703 B
JavaScript
30 lines
703 B
JavaScript
iD.modes.Browse = function(context) {
|
|
var mode = {
|
|
button: 'browse',
|
|
id: 'browse',
|
|
title: t('modes.browse.title'),
|
|
description: t('modes.browse.description'),
|
|
key: t('modes.browse.key')
|
|
};
|
|
|
|
var behaviors = [
|
|
iD.behavior.Hover(),
|
|
iD.behavior.Select(context),
|
|
iD.behavior.DragNode(context),
|
|
iD.behavior.DragMidpoint(context)];
|
|
|
|
mode.enter = function() {
|
|
behaviors.forEach(function(behavior) {
|
|
context.install(behavior);
|
|
});
|
|
};
|
|
|
|
mode.exit = function() {
|
|
behaviors.forEach(function(behavior) {
|
|
context.uninstall(behavior);
|
|
});
|
|
};
|
|
|
|
return mode;
|
|
};
|