mirror of
https://github.com/nasa/openmct.git
synced 2025-06-04 08:30:48 +00:00
[Fixed Position] Update style during resize
Update element style during resize, WTD-882.
This commit is contained in:
parent
5e3d5fd00f
commit
c306865d87
@ -15,7 +15,6 @@
|
|||||||
style="position: absolute;"
|
style="position: absolute;"
|
||||||
key="element.template"
|
key="element.template"
|
||||||
parameters="{ gridSize: controller.getGridSize() }"
|
parameters="{ gridSize: controller.getGridSize() }"
|
||||||
ng-class="{ test: controller.selected(element) }"
|
|
||||||
ng-style="element.style"
|
ng-style="element.style"
|
||||||
ng-click="controller.select(element)"
|
ng-click="controller.select(element)"
|
||||||
ng-model="element">
|
ng-model="element">
|
||||||
@ -26,7 +25,7 @@
|
|||||||
<div class="test"
|
<div class="test"
|
||||||
style="position: absolute;"
|
style="position: absolute;"
|
||||||
mct-drag-down="controller.startDrag(controller.selected())"
|
mct-drag-down="controller.startDrag(controller.selected())"
|
||||||
mct-drag="controller.continueDrag(delta)"
|
mct-drag="controller.continueDrag(delta); controller.updateStyle(controller.selected())"
|
||||||
mct-drag-up="controller.endDrag()"
|
mct-drag-up="controller.endDrag()"
|
||||||
ng-style="controller.selected().style">
|
ng-style="controller.selected().style">
|
||||||
</div>
|
</div>
|
||||||
@ -34,7 +33,7 @@
|
|||||||
style="position: absolute;"
|
style="position: absolute;"
|
||||||
ng-style="handle.style()"
|
ng-style="handle.style()"
|
||||||
mct-drag-down="handle.startDrag()"
|
mct-drag-down="handle.startDrag()"
|
||||||
mct-drag="handle.continueDrag(delta)"
|
mct-drag="handle.continueDrag(delta); controller.updateStyle(controller.selected())"
|
||||||
mct-drag-up="handle.endDrag()">
|
mct-drag-up="handle.endDrag()">
|
||||||
O
|
O
|
||||||
</div>
|
</div>
|
||||||
|
@ -63,6 +63,16 @@ define(
|
|||||||
return element.handles().map(generateDragHandle);
|
return element.handles().map(generateDragHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Select an element
|
||||||
|
function select(element) {
|
||||||
|
if (selection) {
|
||||||
|
// Update selection...
|
||||||
|
selection.select(element);
|
||||||
|
// ...as well as drag handles
|
||||||
|
handles = generateDragHandles(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Convert from element x/y/width/height to an
|
// Convert from element x/y/width/height to an
|
||||||
// apropriate ng-style argument, to position elements.
|
// apropriate ng-style argument, to position elements.
|
||||||
function convertPosition(elementProxy) {
|
function convertPosition(elementProxy) {
|
||||||
@ -132,7 +142,7 @@ define(
|
|||||||
if (selection) {
|
if (selection) {
|
||||||
selection.deselect();
|
selection.deselect();
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
selection.select(elementProxies[index]);
|
select(elementProxies[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,9 +204,7 @@ define(
|
|||||||
// Refresh displayed elements
|
// Refresh displayed elements
|
||||||
refreshElements();
|
refreshElements();
|
||||||
// Select the newly-added element
|
// Select the newly-added element
|
||||||
if (selection) {
|
select(elementProxies[elementProxies.length - 1]);
|
||||||
selection.select(elementProxies[elementProxies.length - 1]);
|
|
||||||
}
|
|
||||||
// Mark change as persistable
|
// Mark change as persistable
|
||||||
if ($scope.commit) {
|
if ($scope.commit) {
|
||||||
$scope.commit("Dropped an element.");
|
$scope.commit("Dropped an element.");
|
||||||
@ -298,12 +306,7 @@ define(
|
|||||||
* Set the active user selection in this view.
|
* Set the active user selection in this view.
|
||||||
* @param element the element to select
|
* @param element the element to select
|
||||||
*/
|
*/
|
||||||
select: function (element) {
|
select: select,
|
||||||
if (selection) {
|
|
||||||
selection.select(element);
|
|
||||||
handles = generateDragHandles(element);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* Clear the current user selection.
|
* Clear the current user selection.
|
||||||
*/
|
*/
|
||||||
@ -320,6 +323,13 @@ define(
|
|||||||
handles: function () {
|
handles: function () {
|
||||||
return handles;
|
return handles;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Update the style (for position/sizing) for the specified
|
||||||
|
* element.
|
||||||
|
*/
|
||||||
|
updateStyle: function (element) {
|
||||||
|
element.style = convertPosition(element);
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* Start a drag gesture to move/resize a frame.
|
* Start a drag gesture to move/resize a frame.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user