Gallery2:Modules:imagenotes:Implementation - Gallery Codex
Personal tools

Gallery2:Modules:imagenotes:Implementation

From Gallery Codex

Implementation

Client side

  • Created utility methods for creating instances of templates. That is, cloning a DOM node and applying IDs to the new node and it's children.
  • Created TemplatedRubberBandRegion which allows a rubber band to be dragged over a specified region of the document and on mouseup a custom event is fired with the selected region
  • Created BoxModelRegionOverlay which extends the YUI Overlay widget and allows placement of an overlay based on the margin, border, padding or content parts of the box model. This is so that image region overlays can be positioned and sized by the content area.
  • Created TemplatedResizeOverlay which extends the BoxModelRegionOverlay widget and adds YUI DragDrop functionailty and the ability to resize the region. The code searches a template passed in client side for certain classes to turn into resize and drag handles. Custom events are fired at the start and end of drag and resize operations.
  • Created an initial image region manager that sets up a TemplatedRubberBandRegion and listens for area selected events, then creates a TemplatedResizeOverlay. Multiple regions can be created, but only a single region can be focused at a time.
  • The image region manager ensures that the image regions fit into the page focus flow.
  • Created utility function for finding an <img> tag in the page with a specific src attribute to allow the image region manager to be attached.

Server side

  • Block created for addition to item view page
  • No database structure created yet
  • No server endpoint for AJAX communication created yet


Hacks, or areas otherwise needing improvement

...