ImageEn, unit imageenview

TImageEnView.MouseInteractLayers

TImageEnView.MouseInteractLayers


Declaration


property MouseInteractLayers: TIEMouseInteractLayers;


Description


An extension to MouseInteractGeneral for mouse activities related to layer editing and creation.

Notes:
- Mouse interaction options are split into two properties: MouseInteractLayers and MouseInteractGeneral. Items of MouseInteractLayers relate only to layer editing and creation, whereas MouseInteractGeneral are all remaining options (selection, view, measurement and image editing functions)
- Multiple interactions can be specified, but activities that are not mutually compatible will be excluded
- Setting MouseInteractLayers, will also remove incompatible items from MouseInteractGeneral


Demos


  Demos\Other\MouseInteract\MouseInteract.dpr
  Demos\LayerEditing\RotateLayers\RotateLayers.dpr
  Demos\LayerEditing\Layers_AllTypes\Layers.dpr
  Demos\LayerEditing\Layers_Lines\Layers.dpr



Compatibility Notes


Prior to v8.6.0, all mouse interactions (both MouseInteractGeneral and MouseInteractLayers items) were set with a single property MouseInteract. To overcome the size limitation for published sets, this was split into:

- MouseInteractGeneral: All mouse interactions that are not related to layer editing
- MouseInteractLayers: Mouse interactions for layer editing

In most cases, code that was previously:
ImageEnView1.MouseInteract := [ miZoom, miScroll ];

Simply changes to:
ImageEnView1.MouseInteractGeneral := [ miZoom, miScroll ];

However for layer editing items (miMoveLayers, miResizeLayers, miRotateLayers, miCreate*Layers, etc.), the prefix has changed to ml, and you must reference MouseInteractLayers.

In older versions:
ImageEnView1.MouseInteract := [ miMoveLayers, miResizeLayers ];

Now becomes:
ImageEnView1.MouseInteractLayers := [ mlMoveLayers, mlResizeLayers ];

These are the layer editing items: miMoveLayers, miResizeLayers, miRotateLayers, miCreateImageLayers, miCreateShapeLayers, miCreateLineLayers, miCreatePolylineLayers, miCreateTextLayers, miClickCreateLineLayers, miClickCreatePolylineLayers, miDrawCreatePolylineLayers, miEditLayerPoints
They are now named: mlMoveLayers, mlResizeLayers, mlRotateLayers, mlCreateImageLayers, mlCreateShapeLayers, mlCreateLineLayers, mlCreatePolylineLayers, mlCreateTextLayers, mlClickCreateLineLayers, mlClickCreatePolylineLayers, mlDrawCreatePolylineLayers, mlEditLayerPoints


Examples


// Allow users to create image layers. Prompt for an image file after selection
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loAutoPromptForImage ];
ImageEnView1.MouseInteractLayers := [ mlCreateImageLayers ];

// Allow user to move and resize layers (allow multiple layer selection and ensure masks are moved with layers)
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loAllowMultiSelect, loAutoSelectMask ];
ImageEnView1.MouseInteractLayers := [ mlMoveLayers, mlResizeLayers ];

A selected text layer with resize grips:


// Allow user to rotate layers (allow multiple layer selection and ensure masks are moved with layers)
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loAllowMultiSelect, loAutoSelectMask ];
ImageEnView1.MouseInteractLayers := [ mlRotateLayers ];

// Allow the user to create, size and select red arrows
ImageEnView1.MouseInteractLayers := [ mlCreateLineLayers, mlMoveLayers, mlResizeLayers ];
ImageEnView1.LayerDefaults.Clear();
ImageEnView1.LayerDefaults.Add( IELP_LineColor +'=clRed' );
ImageEnView1.LayerDefaults.Add( IELP_LineWidth +'=6' );
ImageEnView1.LayerDefaults.Add( IELP_LineShapeSize +'=20' );
ImageEnView1.LayerDefaults.Add( IELP_LineStartShape +'=1' );
ImageEnView1.LayerDefaults.Add( IELP_Rotate +'=235' );

// Allow user to create star shapes
IEGlobalSettings().DefaultLayerShape := iesStar5;
ImageEnView1.MouseInteractLayers := [ mlCreateShapeLayers ];

// Allow user to draw a polygon
ImageEnView1.LayersAutoClosePolylines := iecmAlways;
ImageEnView1.MouseInteractLayers := [ mlClickCreatePolylineLayers ];

// Allow users to create and edit a polyline
ImageEnView1.LayersAutoClosePolylines := iecmManual;
ImageEnView1.MouseInteractLayers := [ mlClickCreatePolylineLayers, mlEditLayerPoints ];



// Allow users to edit a polyline. Hold Alt key to turn line into a curve
ImageEnView1.MouseInteractLayers := [ mlEditLayerPoints ];



// Allow users to draw rulers (lines with measurement values)
With ImageEnView1.LayerDefaults do
begin
  Clear();
  Add( IELP_IsRuler + '=True' );
  Add( IELP_RulerUnits + '=' + IntToStr( ord( ieuCentimeters )));
  Add( IELP_LabelPosition + '=' + IntToStr( ord( ielpAutoAbove )));
  Add( IELP_LineStartShape + '=' + IntToStr( ord( ieesBar )));
  Add( IELP_LineEndShape + '=' + IntToStr( ord( ieesBar )));
  Add( IELP_LineWidth + '= 2' );
end;
IEGlobalSettings().MeasureDecimalPlaces := 1;
ImageEnView1.MouseInteractLayers := [ mlClickCreateLineLayers, mlEditLayerPoints ];

// Allow users to create text layers. Start in text editing mode (user can immediately begin typing text)
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loAutoTextEditing ];
ImageEnView1.MouseInteractLayers := [ mlCreateTextLayers ];

// Add a star every time the layer clicks on the image (use OnNewLayer event to customize size)
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loStampMode ];
IEGlobalSettings().DefaultLayerShape := iesStar5;
ImageEnView1.MouseInteractLayers := mlCreateShapeLayers;


See Also


- SelectionOptions
- LayerDefaults
- LayersAutoClosePolylines
- OnUserInteraction
- OnLayerNotifyEx
- TIEUserInteraction
- MouseInteractGeneral