diff options
| author | Alon Levy <alon@pobox.com> | 2015-07-26 00:25:44 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-07-26 00:25:44 +0300 |
| commit | d771544e9b3d3a96b160342062d1ebdbc7337c4f (patch) | |
| tree | 997ddaa740be0921131eadc4eed7731807ad4009 /src | |
| parent | 4ba53af4c933debb316485c40ca400e70f5dcd46 (diff) | |
layouts: wrap adding a 'name' attribute (for position storage)
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/view/layouts.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/client/view/layouts.js b/src/client/view/layouts.js index 32e12e59..30c5f804 100644 --- a/src/client/view/layouts.js +++ b/src/client/view/layouts.js @@ -405,15 +405,25 @@ function(consts, $, d3, _) { }); } + function named(name, layout_generator) { + var that = this; + function name_it() { + var layout = layout_generator.apply(that, arguments); + layout.name = name; + return layout; + } + return name_it; + } + var layouts = [ { name: 'Force', - create: layout__d3_force__link_distance, + create: named('force', layout__d3_force__link_distance), clazz: 'btn_layout_d3_force' }, { name: 'Ring', - create: layout__concentric, + create: named('ring', layout__concentric), clazz: 'btn_layout_concentric' }, /* |
