Gift Editor demo application shows how to use AJAX Vector Objects module in a real-life web solution. This solution allows users to personalize theirs gifts (a cap or t-shirt, for example) with custom images and text labels.
The present article describes Gift Editor demo implementation features and shows how classes from AJAX Vector Objects module are used in this application. If you are not familiarized with AJAX Vector Objects please read the Basic Concepts of AJAX Vector Objects and Quick Start in AJAX Vector Objects topics first.
User interface of Gift Editor demo looks like the following screenshot.
Figure 1. Gift Editor Demo
As you can see, it includes four parts:
Users just select a gift using the selector on the bottom of the page and a full-size image of this gift is loaded into viewport. Then they add vector images and text labels within predefined rectangle regions. Images and labels are available for further editing, so users can select any v-object and apply all the allowed actions to it.
Viewport in this demo is implemented with the CanvasViewer control. This control displays the Canvas which hosts layers and traces user actions. To make displaying multi-layered images more convenient, there are PanNavigator, ZoomInNavigator, and ZoomOutNavigator controllers associated with this CanvasViewer. Read the How to Use AJAX Vector Objects for the detailed information about CanvasViewer and the Using Navigators and Rubberbands (AJAX Controls) to familiarize with navigators.
All the layers used in this demo can be divided into three groups:
Gift Editor demo shows how to use such v-objects as text, image, and rectangle which are represented by the TextVObject, ImageVObject, and RectangleVObject types respectively. These v-objects can be grouped by their purpose:
When developing an editor, it is a common practice to allow users to undo and redo theirs actions. Gift Editor demo provide users with this feature as well. All they need is to click undo and redo buttons on the Toolbar and the corresponded Undo() and Redo() methods of the History object are called.