ESM: import Magnifier from "@arcgis/core/views/Magnifier.js";
CDN: const Magnifier = await $arcgis.import("@arcgis/core/views/Magnifier.js");
Class: @arcgis/core/views/Magnifier
Since: ArcGIS Maps SDK for JavaScript 4.19
The Magnifier allows end users to show a portion of the view as a magnified image. An instance of this class can be accessed through either MapView.magnifier or SceneView.magnifier.
As you can see in the screenshot above, the Magnifier utilizes a default overlay image of a magnifier glass. The overlay image is set using the overlayUrl property. You can disable the overlay image by setting the Magnifier.overlayEnabled to false
. The following demonstrates using a Magnifier without an overlay image.
The Magnifier contains a default mask image, which is set using the maskUrl, and determines the visible area of the magnified image. Be default, the magnified area is in the shape of a circle. The following demonstrates an example of a mask image set in the shape of a square. Note that the overlayEnabled
was set to false
in this example as well to hide the overlay image, and only display the magnified area.
Example
view.when(() => {
view.magnifier.visible = true;
const offset = view.magnifier.size / 2;
view.magnifier.offset = { x: offset, y: offset };
//The magnifier will be displayed whenever the cursor hovers over the map.
view.on("pointer-move", function (event) {
view.magnifier.position = { x: event.x, y: event.y };
});
});
Constructors
new Magnifier(properties)
Parameter
optionalSee the properties for a list of all the properties that may be passed into the constructor.
Show inherited properties Hide inherited properties
Property DetailsInherited
Property declaredClass Stringreadonly
The name of the class. The declared class name is formatted as esri.folder.className
.
Controls the amount of magnification to display. The larger the value, the more augmented the magnified image appears.
maskEnabled Boolean
Indicates whether the mask image is enabled.
The mask url points to an image that determines the visible area of the magnified image (alpha channel). A default built-in circle mask with a diameter equal to the size of the magnifier is used when the maskUrl is null.
The offset of the magnifier in pixels. The offset allows to adjust where the magnifier is drawn relative to its position.
Example
const offset = view.magnifier.size / 2;
view.magnifier.offset = { x: offset, y: offset };
overlayEnabled Boolean
Indicates whether the overlay image is enabled.
The overlay url points to an image that is displayed on top of the magnified image. Note that the overlay image is not affected by the maskUrl. A default built-in image of a magnifier glass is used when the overlayUrl is null.
The position of the magnifier in pixels. The magnifier will not be displayed if the position is null.
The size of the magnifier in pixels.
Indicates whether the magnifier is visible.
Show inherited methods Hide inherited methods
Method DetailsInherited
Method addHandles(handleOrHandles, groupKey)
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, addHandles added at 4.25.
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles
const handle = reactiveUtils.when(
() => !view.updating,
() => {
wkidSelect.disabled = false;
},
{ once: true }
);
this.addHandles(handle);
// Destroy the object
this.destroy();
Parameters
Handles marked for removal once the object is destroyed.
groupKey *
optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
Inherited
Method hasHandles(groupKey){Boolean}
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, hasHandles added at 4.25.
Returns true if a named group of handles exist.
Parameter
groupKey *
optionalA group key.
Returns
Type Description Boolean Returnstrue
if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
obj.removeHandles("watch-view-updates");
}
Inherited
Method removeHandles(groupKey)
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, removeHandles added at 4.25.
Removes a group of handles owned by the object.
Parameter
groupKey *
optionalA group key or an array or collection of group keys to remove.
Example
obj.removeHandles(); // removes handles from default group
obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");
ScreenPoint
An object representing the location on the screen. The Magnifier.position represents an actual point on the screen, while the Magnifier.offset represents a location relative to the position of the magnifier.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4