[New Edit Mode] Fixed positioning of dropped objects #386

This commit is contained in:
Henry
2015-12-09 09:51:00 -08:00
parent aae8f1575d
commit 49579378dd
6 changed files with 25 additions and 5 deletions

View File

@@ -19,6 +19,7 @@
"type": "telemetry.panel",
"templateUrl": "templates/fixed.html",
"uses": [ "composition" ],
"gestures": [ "drop" ],
"toolbar": {
"sections": [
{

View File

@@ -273,12 +273,15 @@ define(
}
// Position a panel after a drop event
function handleDrop(e, id, position) {
function handleDrop(e, id, position, editableDomainObject) {
// Don't handle this event if it has already been handled
// color is set to "" to let the CSS theme determine the default color
if (e.defaultPrevented) {
return;
}
if (editableDomainObject){
$scope.setEditable(editableDomainObject);
}
e.preventDefault();
// Store the position of this element.
addElement({

View File

@@ -62,10 +62,15 @@ define(
}
// Position a panel after a drop event
function handleDrop(e, id, position) {
//An editableDomainObject is provided, as the drop may have
// triggered a transition to edit mode.
function handleDrop(e, id, position, editableDomainObject) {
if (e.defaultPrevented) {
return;
}
if (editableDomainObject){
$scope.setEditable(editableDomainObject);
}
// Ensure that configuration field is populated
$scope.configuration = $scope.configuration || {};
// Make sure there is a "panels" field in the