[Edit] Default to inclusive mode

Default to inclusive mode in Edit mode toolbar;
simplifies adding additional toolbar elements for
Fixed Position view, WTD-881.
This commit is contained in:
Victor Woeltjen 2015-02-23 15:13:46 -08:00
parent 46c8a456b7
commit f894233182
3 changed files with 7 additions and 6 deletions

View File

@ -17,10 +17,10 @@ view's scope.) These additional properties are:
an argument to set.)
* `method`: Name of a method to invoke upon a selected object when
a control is activated, e.g. on a button click.
* `inclusive`: Optional; true if this control should be considered
applicable whenever at least one element in the selection has
the associated property. Otherwise, all members of the current
selection must have this property for the control to be shown.
* `exclusive`: Optional; true if this control should be considered
applicable only when all elements in the selection has
the associated property. Otherwise, only at least one member of the
current selection must have this property for the control to be shown.
Controls in the toolbar are shown based on applicability to the
current selection. Applicability for a given member of the selection

View File

@ -108,7 +108,7 @@ define(
function isApplicable(item) {
var property = (item || {}).property,
method = (item || {}).method,
exclusive = !(item || {}).inclusive;
exclusive = (item || {}).exclusive;
// Check if a selected item defines this property
function hasProperty(selected) {

View File

@ -57,6 +57,7 @@ define(
commit("Changes from toolbar.");
}
// Initialize toolbar (expose object to parent scope)
function initialize() {
// If we have been asked to expose toolbar state...
if (attrs.toolbar) {
@ -67,7 +68,7 @@ define(
// Represent a domain object using this definition
function represent(representation) {
//
// Expose the toolbar object to the parent scope
initialize();
// Clear any existing selection
scope.selection = [];