pull/3282/head
Steve Ruiz 2024-04-21 14:29:15 +01:00
rodzic 219e31ada3
commit e9b13ab9cf
3 zmienionych plików z 27 dodań i 8 usunięć

Wyświetl plik

@ -693,7 +693,9 @@ export class Editor extends EventEmitter<TLEventMap> {
getAssetForExternalContent(info: TLExternalAssetContent): Promise<TLAsset | undefined>;
getAssets(): (TLBookmarkAsset | TLImageAsset | TLVideoAsset)[];
getCamera(): TLCamera;
getCameraFitZoom(): number;
getCameraFitZoom(opts?: {
reset: boolean;
}): number;
getCameraOptions(): TLCameraOptions;
getCameraState(): "idle" | "moving";
getCanRedo(): boolean;

Wyświetl plik

@ -9881,7 +9881,15 @@
"excerptTokens": [
{
"kind": "Content",
"text": "getCameraFitZoom(): "
"text": "getCameraFitZoom(opts?: "
},
{
"kind": "Content",
"text": "{\n reset: boolean;\n }"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
@ -9894,13 +9902,22 @@
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
"startIndex": 3,
"endIndex": 4
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [],
"parameters": [
{
"parameterName": "opts",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": true
}
],
"isOptional": false,
"isAbstract": false,
"name": "getCameraFitZoom"

Wyświetl plik

@ -2072,7 +2072,7 @@ export class Editor extends EventEmitter<TLEventMap> {
* ```
*
* @public */
getCameraFitZoom() {
getCameraFitZoom(opts = {} as { reset: boolean }) {
const cameraOptions = this.getCameraOptions()
if (
// If no camera constraints are provided, the default zoom is 100%
@ -2080,7 +2080,7 @@ export class Editor extends EventEmitter<TLEventMap> {
// When defaultZoom is default, the default zoom is 100%
cameraOptions.constraints.defaultZoom === 'default' ||
// When zoomBehavior is default, we ignore the default zoom and use 100% as the fit zoom
cameraOptions.constraints.zoomBehavior === 'default'
(!opts.reset && cameraOptions.constraints.zoomBehavior === 'default')
) {
return 1
}
@ -2499,7 +2499,7 @@ export class Editor extends EventEmitter<TLEventMap> {
if (constraints) {
// For non-infinite fit, we'll set the camera to the natural zoom level...
// unless it's already there, in which case we'll set zoom to 100%
const fitZoom = this.getCameraFitZoom()
const fitZoom = this.getCameraFitZoom({ reset: true })
if (cz !== fitZoom) {
z = fitZoom
}