Remove memory leak for thumbnail enabled elements
This commit is contained in:
parent
c2e387a372
commit
319f030f32
@ -35,7 +35,6 @@ Template.imageThumbnail.onRendered(() => {
|
|||||||
const element = $element.get(0);
|
const element = $element.get(0);
|
||||||
|
|
||||||
instance.refreshImage = () => {
|
instance.refreshImage = () => {
|
||||||
console.log('imageThumbnail refreshImage');
|
|
||||||
if (!element) {
|
if (!element) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -43,13 +42,20 @@ Template.imageThumbnail.onRendered(() => {
|
|||||||
// Disable cornerstone for thumbnail element and remove its canvas
|
// Disable cornerstone for thumbnail element and remove its canvas
|
||||||
cornerstone.disable(element);
|
cornerstone.disable(element);
|
||||||
|
|
||||||
|
// Enable cornerstone for thumbnail element again creating a new canvas
|
||||||
|
cornerstone.enable(element);
|
||||||
|
|
||||||
// Activate the loading state
|
// Activate the loading state
|
||||||
$loading.css('display', 'block');
|
$loading.css('display', 'block');
|
||||||
|
|
||||||
// Define a handler for success on image load
|
// Define a handler for success on image load
|
||||||
const loadSuccess = image => {
|
const loadSuccess = image => {
|
||||||
// Enable cornerstone for thumbnail element again creating a new canvas
|
// Check to make sure the element is enabled.
|
||||||
cornerstone.enable(element);
|
try {
|
||||||
|
var enabledElement = cornerstone.getEnabledElement(element);
|
||||||
|
} catch(error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cornerstone.displayImage(element, image);
|
cornerstone.displayImage(element, image);
|
||||||
$loading.css('display', 'none');
|
$loading.css('display', 'none');
|
||||||
@ -85,7 +91,6 @@ Template.imageThumbnail.onRendered(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Template.imageThumbnail.onDestroyed(() => {
|
Template.imageThumbnail.onDestroyed(() => {
|
||||||
console.log('imagethumbnail onDestroyed');
|
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
|
|
||||||
// Declare DOM and jQuery objects
|
// Declare DOM and jQuery objects
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user