-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an option to use the virtual cursor to help with element locate w…
…/touch input. (#1038) * Add an option to use the virtual cursor to help with element locate w/touch input. * Not sure what happened to ToolSettings.enableVirtualCursorForLocate... * re-run extract-api * Put back the beta tag... Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
ef34c10
commit 9beb4bf
Showing
11 changed files
with
145 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
common/changes/@bentley/imodeljs-frontend/virtual-cursor-for-locate_2021-03-25-15-39.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@bentley/imodeljs-frontend", | ||
"comment": "Add an option to use the virtual cursor to help with element locate w/touch input.", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@bentley/imodeljs-frontend", | ||
"email": "65233531+bbastings@users.noreply.github.com" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { parseArgs } from "@bentley/frontend-devtools"; | ||
import { GridOrientationType } from "@bentley/imodeljs-common"; | ||
import { IModelApp, Tool } from "@bentley/imodeljs-frontend"; | ||
|
||
/** Change grid settings for testing. */ | ||
export class ChangeGridSettingsTool extends Tool { | ||
public static toolId = "GridSettings"; | ||
public static get minArgs() { return 0; } | ||
public static get maxArgs() { return 4; } | ||
|
||
public run(spacing?: number, ratio?: number, gridsPerRef?: number, orientation?: GridOrientationType): boolean { | ||
const vp = IModelApp.viewManager.selectedView; | ||
if (undefined === vp) | ||
return false; | ||
|
||
if (undefined !== spacing) | ||
vp.view.details.gridSpacing = { x: spacing, y: spacing }; | ||
|
||
if (undefined !== ratio) | ||
vp.view.details.gridSpacing = { x: vp.view.details.gridSpacing.x, y: vp.view.details.gridSpacing.x * ratio }; | ||
|
||
if (undefined !== gridsPerRef) | ||
vp.view.details.gridsPerRef = gridsPerRef; | ||
|
||
if (undefined !== orientation) | ||
vp.view.details.gridOrientation = orientation; | ||
|
||
vp.invalidateScene(); // Needed to clear cached grid decoration... | ||
return true; | ||
} | ||
|
||
/** The keyin accepts the following arguments: | ||
* - `spacing=number` Specify x and y grid reference line spacing in meters. | ||
* - `ratio=number` Specify y spacing as current x * ratio. | ||
* - `gridsPerRef=number` Specify number of grid lines to display per reference line. | ||
* - `orientation=0|1|2|3|4` Value for GridOrientationType. | ||
*/ | ||
public parseAndRun(...inputArgs: string[]): boolean { | ||
let spacing; | ||
let ratio; | ||
let gridsPerRef; | ||
let orientation; | ||
const args = parseArgs(inputArgs); | ||
|
||
const spacingArg = args.getFloat("s"); | ||
if (undefined !== spacingArg) | ||
spacing = spacingArg; | ||
|
||
const ratioArg = args.getFloat("r"); | ||
if (undefined !== ratioArg) | ||
ratio = ratioArg; | ||
|
||
const gridsPerRefArg = args.getInteger("g"); | ||
if (undefined !== gridsPerRefArg) | ||
gridsPerRef = gridsPerRefArg; | ||
|
||
const orientationArg = args.getInteger("o"); | ||
if (undefined !== orientationArg) { | ||
switch (orientationArg) { | ||
case 0: | ||
orientation = GridOrientationType.View; | ||
break; | ||
case 1: | ||
orientation = GridOrientationType.WorldXY; | ||
break; | ||
case 2: | ||
orientation = GridOrientationType.WorldYZ; | ||
break; | ||
case 3: | ||
orientation = GridOrientationType.WorldXZ; | ||
break; | ||
case 4: | ||
orientation = GridOrientationType.AuxCoord; | ||
break; | ||
} | ||
} | ||
|
||
this.run(spacing, ratio, gridsPerRef, orientation); | ||
return true; | ||
} | ||
} |