-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add connection previewer interface (#7637)
* feat: add connection previewer interface * chore: PR comments
- Loading branch information
Showing
3 changed files
with
59 additions
and
2 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
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,50 @@ | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import type {BlockSvg} from '../block_svg'; | ||
import type {RenderedConnection} from '../rendered_connection'; | ||
|
||
/** | ||
* Displays visual "previews" of where a block will be connected if it is | ||
* dropped. | ||
*/ | ||
export interface IConnectionPreviewer { | ||
/** | ||
* Display a connection preview where the draggedCon connects to the | ||
* staticCon, replacing the replacedBlock (currently connected to the | ||
* staticCon). | ||
* | ||
* @param draggedCon The connection on the block stack being dragged. | ||
* @param staticCon The connection not being dragged that we are | ||
* connecting to. | ||
* @param replacedBlock The block currently connected to the staticCon that | ||
* is being replaced. | ||
*/ | ||
previewReplacement( | ||
draggedConn: RenderedConnection, | ||
staticConn: RenderedConnection, | ||
replacedBlock: BlockSvg, | ||
): void; | ||
|
||
/** | ||
* Display a connection preview where the draggedCon connects to the | ||
* staticCon, and no block is being relaced. | ||
* | ||
* @param draggedCon The connection on the block stack being dragged. | ||
* @param staticCon The connection not being dragged that we are | ||
* connecting to. | ||
*/ | ||
previewConnection( | ||
draggedConn: RenderedConnection, | ||
staticConn: RenderedConnection, | ||
): void; | ||
|
||
/** Hide any previews that are currently displayed. */ | ||
hidePreview(): void; | ||
|
||
/** Dispose of any references held by this connection previewer. */ | ||
dispose(): void; | ||
} |
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