Fixing flashButton wrong deactivation issue

This commit is contained in:
Bruno Alves de Faria 2018-01-05 08:04:41 -02:00
parent 68991df87c
commit 1983ee18a1
2 changed files with 22 additions and 16 deletions

View File

@ -8,7 +8,6 @@ Template.toolbarSectionButton.onCreated(() => {
instance.isActive = activeToolId => { instance.isActive = activeToolId => {
OHIF.commands.last.dep.depend(); OHIF.commands.last.dep.depend();
const instance = Template.instance();
const subTools = instance.data.subTools; const subTools = instance.data.subTools;
const currentId = instance.data.id; const currentId = instance.data.id;
const isCurrentTool = currentId === activeToolId; const isCurrentTool = currentId === activeToolId;
@ -52,7 +51,12 @@ Template.toolbarSectionButton.onCreated(() => {
$element.addClass('active'); $element.addClass('active');
setTimeout(() => { setTimeout(() => {
if ($element.hasClass('expandable') && $element.find('.toolbarSectionButton.active').length) return; if ($element.hasClass('expandable') && $element.find('.toolbarSectionButton.active').length) return;
const activeToolId = Session.get('ToolManagerActiveTool');
const isActive = instance.isActive(activeToolId);
if (!isActive) {
$element.removeClass('active'); $element.removeClass('active');
}
}, 100); }, 100);
}; };

View File

@ -4,6 +4,7 @@ import { $ } from 'meteor/jquery';
import { _ } from 'meteor/underscore'; import { _ } from 'meteor/underscore';
// Local Modules // Local Modules
import { OHIF } from 'meteor/ohif:core'; import { OHIF } from 'meteor/ohif:core';
import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone';
import { updateOrientationMarkers } from './updateOrientationMarkers'; import { updateOrientationMarkers } from './updateOrientationMarkers';
import { getInstanceClassDefaultViewport } from './instanceClassSpecificViewport'; import { getInstanceClassDefaultViewport } from './instanceClassSpecificViewport';
@ -187,13 +188,15 @@ const toggleDialog = (element, closeAction) => {
const $element = $(element); const $element = $(element);
if ($element.is('dialog')) { if ($element.is('dialog')) {
if (element.hasAttribute('open')) { if (element.hasAttribute('open')) {
if (closeAction) closeAction(); if (closeAction) {
closeAction();
}
element.close(); element.close();
} else { } else {
element.show(); element.show();
} }
} } else {
else {
const isClosed = $element.hasClass('dialog-open'); const isClosed = $element.hasClass('dialog-open');
$element.toggleClass('dialog-closed', isClosed); $element.toggleClass('dialog-closed', isClosed);
$element.toggleClass('dialog-open', !isClosed); $element.toggleClass('dialog-open', !isClosed);
@ -319,8 +322,7 @@ const stopActiveClip = () => {
if ($(activeElement).find('canvas').length) { if ($(activeElement).find('canvas').length) {
cornerstoneTools.stopClip(activeElement); cornerstoneTools.stopClip(activeElement);
} }
} };
const isStackScrollLinkingDisabled = () => { const isStackScrollLinkingDisabled = () => {
let linkableViewportsCount = 0; let linkableViewportsCount = 0;