mirror of
https://github.com/google/blockly.git
synced 2026-02-12 02:20:10 +01:00
feat: Add IPathObject.updateReplacing()
This commit is contained in:
@@ -1735,11 +1735,7 @@ export class BlockSvg
|
||||
* @internal
|
||||
*/
|
||||
fadeForReplacement(add: boolean) {
|
||||
if (add) {
|
||||
this.addClass('blocklyReplaceable');
|
||||
} else {
|
||||
this.removeClass('blocklyReplaceable');
|
||||
}
|
||||
this.pathObject.updateReplacing?.(add);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -106,4 +106,13 @@ export interface IPathObject {
|
||||
* @param blockStyle The block style to use.
|
||||
*/
|
||||
setStyle?(blockStyle: BlockStyle): void;
|
||||
|
||||
/**
|
||||
* Add or remove styling indicating that a block will be bumped out and
|
||||
* replaced by another block that is mid-move.
|
||||
*
|
||||
* @param replacing True if the block is at risk of being replaced, false
|
||||
* otherwise.
|
||||
*/
|
||||
updateReplacing?(replacing: boolean): void;
|
||||
}
|
||||
|
||||
@@ -191,6 +191,17 @@ export class PathObject implements IPathObject {
|
||||
this.setClass_('blocklyDraggable', enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or remove styling indicating that a block will be bumped out and
|
||||
* replaced by another block that is mid-move.
|
||||
*
|
||||
* @param replacing True if the block is at risk of being replaced, false
|
||||
* otherwise.
|
||||
*/
|
||||
updateReplacing(replacing: boolean) {
|
||||
this.setClass_('blocklyReplaceable', replacing);
|
||||
}
|
||||
|
||||
/** Adds the given path as a connection highlight for the given connection. */
|
||||
addConnectionHighlight(
|
||||
connection: RenderedConnection,
|
||||
|
||||
Reference in New Issue
Block a user