 page_zoom.addEventListener 'change', (e) ->
   return unless current_tool?
   if @.checked
-    ms.rescale 0, 0, subjectViewer.maxWidth, subjectViewer.maxHeight
-  else
     w = current_tool.mark.width + MARGIN * 2
     h = current_tool.mark.height + MARGIN * 2
+    ms.svg.attr 'width', w
+    ms.svg.attr 'height', h
     ms.rescale current_tool.mark.left - MARGIN, current_tool.mark.top - MARGIN, w, h
+  else
+    subjectViewer.rescale()
+    ms.rescale 0, 0, subjectViewer.maxWidth, subjectViewer.maxHeight
+    
 
 help.addEventListener 'change', (e) ->
   classify_page.fieldGuideContainer.attr 'aria-hidden', !@.checked

    subjectViewer.rescale()
    ms.rescale 0, 0, subjectViewer.maxWidth, subjectViewer.maxHeight
    current_tool?.el.classList.remove 'selected'
  
  if task.key in ['details', 'parts'] and rectangles.length > 0
    page_zoom.disabled = false
    current_tool?.el.classList.remove 'selected'
    current_tool = rectangles[rect_index]
    w = current_tool?.mark.width + MARGIN * 2
    h = current_tool?.mark.height + MARGIN * 2
    ms.rescale current_tool?.mark.left - MARGIN, current_tool?.mark.top - MARGIN, w, h
    current_tool?.el.classList.add 'selected'
  

help = document.querySelector('input[name=help]')

classify_page.fieldGuideContainer.attr 'aria-hidden', !help.checked
  
classify_page.el.on decisionTree.LOAD_TASK, ({originalEvent: detail: {task}})->
  task.reset 'yes' if task.key is 'illustrations'
  page_zoom.checked = false

# moving back and forward through the array of marked SVG rectangles
classify_page.el.on decisionTree.LOAD_TASK, ({originalEvent: detail: {task}})->
