chore: deprecate insertion marker manager and related methods (#7797)

This commit is contained in:
Beka Westberg
2024-01-26 14:11:47 -08:00
parent 702eed42db
commit 018df03715
3 changed files with 23 additions and 0 deletions

View File

@@ -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 {
/**

View File

@@ -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

View File

@@ -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;