From 018df03715602bf58ee42751b625762ddf6dd738 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Fri, 26 Jan 2024 14:11:47 -0800 Subject: [PATCH] chore: deprecate insertion marker manager and related methods (#7797) --- core/insertion_marker_manager.ts | 2 ++ core/renderers/common/renderer.ts | 10 ++++++++++ core/renderers/zelos/renderer.ts | 11 +++++++++++ 3 files changed, 23 insertions(+) diff --git a/core/insertion_marker_manager.ts b/core/insertion_marker_manager.ts index 69d3d2cb9..96c9327fc 100644 --- a/core/insertion_marker_manager.ts +++ b/core/insertion_marker_manager.ts @@ -56,6 +56,8 @@ const DUPLICATE_BLOCK_ERROR = * Class that controls updates to connections during drags. It is primarily * responsible for finding the closest eligible connection and highlighting or * unhighlighting it as needed during a drag. + * + * @deprecated v10 - Use an IConnectionPreviewer instead. */ export class InsertionMarkerManager { /** diff --git a/core/renderers/common/renderer.ts b/core/renderers/common/renderer.ts index 3a53322dd..15a958db4 100644 --- a/core/renderers/common/renderer.ts +++ b/core/renderers/common/renderer.ts @@ -26,6 +26,7 @@ import type {IPathObject} from './i_path_object.js'; import {RenderInfo} from './info.js'; import {MarkerSvg} from './marker_svg.js'; import {PathObject} from './path_object.js'; +import * as deprecation from '../../utils/deprecation.js'; /** * The base class for a block renderer. @@ -231,12 +232,21 @@ export class Renderer implements IRegistrable { * @param local The connection currently being dragged. * @param topBlock The block currently being dragged. * @returns The preview type to display. + * + * @deprecated v10 - This function is no longer respected. A custom + * IConnectionPreviewer may be able to fulfill the functionality. */ getConnectionPreviewMethod( closest: RenderedConnection, local: RenderedConnection, topBlock: BlockSvg, ): PreviewType { + deprecation.warn( + 'getConnectionPreviewMethod', + 'v10', + 'v12', + 'an IConnectionPreviewer, if it fulfills your use case.', + ); if ( local.type === ConnectionType.OUTPUT_VALUE || local.type === ConnectionType.PREVIOUS_STATEMENT diff --git a/core/renderers/zelos/renderer.ts b/core/renderers/zelos/renderer.ts index 729c54f5f..354a3f35a 100644 --- a/core/renderers/zelos/renderer.ts +++ b/core/renderers/zelos/renderer.ts @@ -22,6 +22,7 @@ import {Drawer} from './drawer.js'; import {RenderInfo} from './info.js'; import {MarkerSvg} from './marker_svg.js'; import {PathObject} from './path_object.js'; +import * as deprecation from '../../utils/deprecation.js'; /** * The zelos renderer. This renderer emulates Scratch-style and MakeCode-style @@ -108,11 +109,21 @@ export class Renderer extends BaseRenderer { return this.constants_; } + /** + * @deprecated v10 - This function is no longer respected. A custom + * IConnectionPreviewer may be able to fulfill the functionality. + */ override getConnectionPreviewMethod( closest: RenderedConnection, local: RenderedConnection, topBlock: BlockSvg, ) { + deprecation.warn( + 'getConnectionPreviewMethod', + 'v10', + 'v12', + 'an IConnectionPreviewer, if it fulfills your use case.', + ); if (local.type === ConnectionType.OUTPUT_VALUE) { if (!closest.isConnected()) { return InsertionMarkerManager.PREVIEW_TYPE.INPUT_OUTLINE;