Juan's fix that allows proper refresh of highlights
Fix onViewportResized to make it a local function.