LT-370: Repositioning the Add label button
This commit is contained in:
1 parent
d2095f3cb7
commit
bcbd1a4465
8 files changed
+74
-16
No files matched your search
@@ -183,7 +183,7 @@ OHIF.mixins.formItem = new OHIF.Mixin({
|
||||
}
|
||||
|
||||
// Create the data document for validation
|
||||
const document = OHIF.blaze.getNestedObject({
|
||||
const document = OHIF.object.getNestedObject({
|
||||
[key]: component.value()
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
OHIF.cornerstone = {};
|
||||
|
||||
OHIF.cornerstone.pixelToPage = (element, position) => {
|
||||
const enabledElement = cornerstone.getEnabledElement(element);
|
||||
const result = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
|
||||
// Stop here if the cornerstone element is not enabled or position is not an object
|
||||
if (!enabledElement || typeof position !== 'object') {
|
||||
return result;
|
||||
}
|
||||
|
||||
const canvas = enabledElement.canvas;
|
||||
|
||||
const canvasOffset = $(canvas).offset();
|
||||
result.x += canvasOffset.left;
|
||||
result.y += canvasOffset.top;
|
||||
|
||||
const canvasPosition = cornerstone.pixelToCanvas(element, position);
|
||||
result.x += canvasPosition.x;
|
||||
result.y += canvasPosition.y;
|
||||
|
||||
return result;
|
||||
};
|
||||
@@ -1,4 +1,5 @@
|
||||
import './blaze.js';
|
||||
import './cornerstone.js';
|
||||
import './object.js';
|
||||
import './string.js';
|
||||
import './ui.js';
|
||||
|
||||
@@ -3,7 +3,7 @@ import { OHIF } from 'meteor/ohif:core';
|
||||
OHIF.object = {};
|
||||
|
||||
// Transforms a shallow object with keys separated by "." into a nested object
|
||||
OHIF.blaze.getNestedObject = shallowObject => {
|
||||
OHIF.object.getNestedObject = shallowObject => {
|
||||
var nestedObject = {};
|
||||
for (var key in shallowObject) {
|
||||
var value = shallowObject[key];
|
||||
@@ -27,7 +27,7 @@ OHIF.blaze.getNestedObject = shallowObject => {
|
||||
};
|
||||
|
||||
// Transforms a nested object into a shallowObject merging its keys with "." character
|
||||
OHIF.blaze.getShallowObject = nestedObject => {
|
||||
OHIF.object.getShallowObject = nestedObject => {
|
||||
var shallowObject = {};
|
||||
var putValues = function(baseKey, nestedObject, resultObject) {
|
||||
for (var key in nestedObject) {
|
||||
|
||||
Reference in new issue
Block a user