mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 07:38:15 +00:00
[Fixed Position] Draw line as SVG
Draw line elements as SVG, WTD-880.
This commit is contained in:
@ -11,7 +11,12 @@ define(
|
||||
fill: "#888",
|
||||
border: "transparent"
|
||||
},
|
||||
"fixed.line": {},
|
||||
"fixed.line": {
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 5,
|
||||
y2: 3
|
||||
},
|
||||
"fixed.text": {
|
||||
fill: "transparent",
|
||||
border: "transparent"
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['./TelemetryProxy', './ElementProxy'],
|
||||
function (TelemetryProxy, ElementProxy) {
|
||||
['./TelemetryProxy', './ElementProxy', './LineProxy'],
|
||||
function (TelemetryProxy, ElementProxy, LineProxy) {
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
"fixed.telemetry": TelemetryProxy,
|
||||
"fixed.line": ElementProxy,
|
||||
"fixed.line": LineProxy,
|
||||
"fixed.box": ElementProxy,
|
||||
"fixed.image": ElementProxy,
|
||||
"fixed.text": ElementProxy
|
||||
|
63
platform/features/layout/src/elements/LineProxy.js
Normal file
63
platform/features/layout/src/elements/LineProxy.js
Normal file
@ -0,0 +1,63 @@
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['./ElementProxy'],
|
||||
function (ElementProxy) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function LineProxy(element, index, elements) {
|
||||
var proxy = new ElementProxy(element, index, elements);
|
||||
|
||||
proxy.x = function (v) {
|
||||
var x = Math.min(element.x, element.x2),
|
||||
delta = v - x;
|
||||
if (arguments.length > 0 && delta) {
|
||||
element.x += delta;
|
||||
element.x2 += delta;
|
||||
}
|
||||
return x;
|
||||
};
|
||||
|
||||
proxy.y = function (v) {
|
||||
var y = Math.min(element.y, element.y2),
|
||||
delta = v - y;
|
||||
if (arguments.length > 0 && delta) {
|
||||
element.y += delta;
|
||||
element.y2 += delta;
|
||||
}
|
||||
return y;
|
||||
};
|
||||
|
||||
proxy.width = function () {
|
||||
return Math.max(element.x, element.x2) - proxy.x();
|
||||
};
|
||||
|
||||
proxy.height = function () {
|
||||
return Math.max(element.y, element.y2) - proxy.y();
|
||||
};
|
||||
|
||||
proxy.x1 = function () {
|
||||
return element.x - proxy.x();
|
||||
};
|
||||
|
||||
proxy.y1 = function () {
|
||||
return element.y - proxy.y();
|
||||
};
|
||||
|
||||
proxy.x2 = function () {
|
||||
return element.x2 - proxy.x();
|
||||
};
|
||||
|
||||
proxy.y2 = function () {
|
||||
return element.y2 - proxy.y();
|
||||
};
|
||||
|
||||
return proxy;
|
||||
}
|
||||
|
||||
return LineProxy;
|
||||
}
|
||||
);
|
Reference in New Issue
Block a user