LT-297: Fixing rendering position for rename and making rename real time on database

This commit is contained in:
Bruno Alves de Faria authored and Erik Ziegler committed 2016-11-15 08:25:09 +01:00
1 parent 5c36074f8a
commit 998cdce9fb
2 files changed
+22 -16

No files matched your search

@@ -83,7 +83,10 @@ Template.measureFlow.onRendered(() => {
instance.$('.btn-add').focus(); instance.$('.btn-add').focus();
if (instance.data.autoClick) { if (instance.data.autoClick) {
instance.$('.btn-add').hide().trigger('click'); instance.$('.btn-add').hide().trigger('click', {
clientX: instance.data.position.x,
clientY: instance.data.position.Y
});
} }
}); });
@@ -100,11 +103,19 @@ Template.measureFlow.events({
// Wait template rerender before rendering the selectTree // Wait template rerender before rendering the selectTree
Tracker.afterFlush(() => { Tracker.afterFlush(() => {
// Get the click position // Get the click or rendering position
const position = { let position;
left: event.clientX, if (_.isUndefined(event.clientX)) {
top: event.clientY, position = {
}; left: instance.data.position.x,
top: instance.data.position.y,
};
} else {
position = {
left: event.clientX,
top: event.clientY,
};
}
// Define the data for selectTreeComponent // Define the data for selectTreeComponent
const data = { const data = {
@@ -235,6 +246,8 @@ Template.measureFlow.events({
// Reset the flag to avoid wrong positioning when clicking normal labels again // Reset the flag to avoid wrong positioning when clicking normal labels again
instance.commonClicked = false; instance.commonClicked = false;
instance.data.updateCallback(instance.value.value, instance.description.get());
}); });
// Wait the fade-out transition and remove the selectTree component // Wait the fade-out transition and remove the selectTree component
@@ -262,8 +275,6 @@ Template.measureFlow.events({
'close .measure-flow'(event, instance) { 'close .measure-flow'(event, instance) {
const $measureFlow = $(event.currentTarget); const $measureFlow = $(event.currentTarget);
$measureFlow.one('animationend', () => { $measureFlow.one('animationend', instance.data.doneCallback).addClass('fadeOut');
instance.data.doneCallback(instance.value.value, instance.description.get());
}).addClass('fadeOut');
} }
}); });
@@ -31,11 +31,8 @@ OHIF.measurements.toggleLabelButton = options => {
threeColumns: true, threeColumns: true,
hideCommon: true, hideCommon: true,
autoClick: options.autoClick, autoClick: options.autoClick,
doneCallback(location, description) { doneCallback: removeButtonView,
if (_.isFunction(options.callback)) { updateCallback(location, description) {
options.callback(options, location, description);
}
toolCollection.update({ toolCollection.update({
measurementNumber: measurement.measurementNumber, measurementNumber: measurement.measurementNumber,
toolType: measurement.toolType, toolType: measurement.toolType,
@@ -48,8 +45,6 @@ OHIF.measurements.toggleLabelButton = options => {
}, { }, {
multi: true multi: true
}); });
removeButtonView();
} }
}; };
const view = Blaze.renderWithData(Template.measureFlow, data, options.element); const view = Blaze.renderWithData(Template.measureFlow, data, options.element);