terra-draw
Advanced tools
Comparing version 0.0.1-alpha.62 to 0.0.1-alpha.63
@@ -7,3 +7,3 @@ import { TerraDrawMouseEvent } from "../../../common"; | ||
import { FeatureId } from "../../../store/store"; | ||
export type ResizeOptions = "center-fixed" | "opposite-fixed" | "opposite" | "center" | "center-planar" | "opposite-planar"; | ||
export type ResizeOptions = "center-web-mercator" | "opposite-web-mercator" | "center-fixed-web-mercator" | "opposite-fixed-web-mercator"; | ||
export declare class DragCoordinateResizeBehavior extends TerraDrawModeBehavior { | ||
@@ -14,17 +14,51 @@ readonly config: BehaviorConfig; | ||
private readonly midPoints; | ||
private readonly minDistanceFromSelectionPoint; | ||
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior, minDistanceFromSelectionPoint: number); | ||
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior); | ||
private minimumScale; | ||
private draggedCoordinate; | ||
private boundingBoxMaps; | ||
private getClosestCoordinate; | ||
getDraggableIndex(event: TerraDrawMouseEvent, selectedId: FeatureId): number; | ||
drag(event: TerraDrawMouseEvent, resizeOption: ResizeOptions): boolean; | ||
private isValidDragWebMercator; | ||
private getSelectedFeatureDataWebMercator; | ||
private centerWebMercatorDrag; | ||
private centerFixedWebMercatorDrag; | ||
private scaleFixedWebMercator; | ||
private oppositeFixedWebMercatorDrag; | ||
private oppositeWebMercatorDrag; | ||
private scaleWebMercator; | ||
private getFeature; | ||
private getNormalisedCoordinates; | ||
private validateScale; | ||
private scalePlanar; | ||
private getCenterOrigin; | ||
private getBBox; | ||
private getOppositeOrigin; | ||
private performWebMercatorScale; | ||
private getBBoxWebMercator; | ||
private getIndexesWebMercator; | ||
/** | ||
* @returns - true if the feature is being dragged (resized), false otherwise | ||
*/ | ||
isDragging(): boolean; | ||
/** | ||
* Starts the resizing of the feature | ||
* @param id - feature id of the feature that is being dragged | ||
* @param index - index of the coordinate that is being dragged | ||
* @returns - void | ||
*/ | ||
startDragging(id: FeatureId, index: number): void; | ||
/** | ||
* Stops the resizing of the feature | ||
* @returns - void * | ||
*/ | ||
stopDragging(): void; | ||
private boundingBoxMaps; | ||
/** | ||
* Returns the index of the coordinate that is going to be dragged | ||
* @param event - cursor event | ||
* @param selectedId - feature id of the feature that is selected | ||
* @returns - the index to be dragged | ||
*/ | ||
getDraggableIndex(event: TerraDrawMouseEvent, selectedId: FeatureId): number; | ||
/** | ||
* Resizes the feature based on the cursor event | ||
* @param event - cursor event | ||
* @param resizeOption - the resize option, either "center-web-mercator" or "opposite-web-mercator" | ||
* @returns - true is resize was successful, false otherwise | ||
*/ | ||
drag(event: TerraDrawMouseEvent, resizeOption: ResizeOptions): boolean; | ||
} |
@@ -84,3 +84,3 @@ import L from "leaflet"; | ||
draggable: true, | ||
resizable: "opposite-fixed", | ||
resizable: "opposite-web-mercator", | ||
}, | ||
@@ -94,3 +94,3 @@ }, | ||
draggable: true, | ||
resizable: "center-fixed", | ||
resizable: "center-web-mercator", | ||
}, | ||
@@ -97,0 +97,0 @@ }, |
@@ -355,3 +355,3 @@ import { test, expect } from "@playwright/test"; | ||
// Dragged the square up and to the left | ||
await expectGroupPosition({ page, x: 584, y: 304 }); | ||
await expectGroupPosition({ page, x: 490, y: 408 }); | ||
}); | ||
@@ -388,3 +388,3 @@ | ||
// Dragged the square up and to the left | ||
await expectGroupPosition({ page, x: 430, y: 150 }); | ||
await expectGroupPosition({ page, x: 447, y: 138 }); | ||
}); | ||
@@ -391,0 +391,0 @@ }); |
{ | ||
"name": "terra-draw", | ||
"version": "0.0.1-alpha.62", | ||
"version": "0.0.1-alpha.63", | ||
"description": "Frictionless map drawing across mapping provider", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4158389
94
9335