Improved implementation of mouse listeners for viewports