translateItemScaleFactor Method

Summary

Translates an item horizontally or vertically a given amount of pixels regardless of the current zoom value.

Syntax

JavaScript Syntax
ImageViewer.prototype.translateItemScaleFactor = function(item, dx, dy, resetValues) 
TypeScript Syntax
translateItemScaleFactor(item: ImageViewerItem, dx: number, dy: number, resetValues: boolean): void; 

Parameters

item

The item to translate. This parameter cannot be null.

dx

Number of pixels to translate the item horizontally.

dy

Number of pixels to translate the item vertically.

resetValues

true to reset the item state transformations, otherwise; false.

Remarks

This is a helper method to quickly transform an item a specified amount of pixels regardless of the current zoom value.

Example

This example will add a few items to the ImageViewer and then create a new interactive mode that transform the item using mouse or touch.

Run the demo. Click on any item and drag to translate, CTRL-click to zoom the item in and out.

Start with the ImageViewer example, remove all the code inside the example function (search for the "// TODO: add example code here" comment) and insert the following code:

JavaScript Example
function ImageViewer_TranslateItemScaleFactor(dx, dy) { 
   if (dx == 0 && dy == 0) 
      return; 
   this._imageViewer.translateItemScaleFactor(this._imageViewer.activeItem, -dx, -dy, true); 
} 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Controls Assembly