Merge pull request #2129 from nasa/fixed-position-2125

[Fixed Position] Cannot add on objects when creating Fixed Position for the first time
This commit is contained in:
Pete Richards 2018-08-10 10:58:05 -07:00 committed by GitHub
commit 622d246fdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,7 +87,8 @@ define(
'setDisplayedValue', 'setDisplayedValue',
'subscribeToObject', 'subscribeToObject',
'unsubscribe', 'unsubscribe',
'updateView' 'updateView',
'setSelection'
].forEach(function (name) { ].forEach(function (name) {
self[name] = self[name].bind(self); self[name] = self[name].bind(self);
}); });
@ -224,7 +225,7 @@ define(
// Respond to external bounds changes // Respond to external bounds changes
this.openmct.time.on("bounds", updateDisplayBounds); this.openmct.time.on("bounds", updateDisplayBounds);
this.openmct.selection.on('change', this.setSelection.bind(this)); this.openmct.selection.on('change', this.setSelection);
this.$element.on('click', this.bypassSelection.bind(this)); this.$element.on('click', this.bypassSelection.bind(this));
this.unlisten = this.openmct.objects.observe(this.newDomainObject, '*', function (obj) { this.unlisten = this.openmct.objects.observe(this.newDomainObject, '*', function (obj) {
this.newDomainObject = JSON.parse(JSON.stringify(obj)); this.newDomainObject = JSON.parse(JSON.stringify(obj));
@ -233,6 +234,9 @@ define(
this.updateElementPositions(this.newDomainObject.layoutGrid); this.updateElementPositions(this.newDomainObject.layoutGrid);
refreshElements(); refreshElements();
//force a click, to initialize Fixed Position Controller on SelectionAPI
$element[0].click();
} }
FixedController.prototype.updateElementPositions = function (layoutGrid) { FixedController.prototype.updateElementPositions = function (layoutGrid) {