sesaparcours
    Preparing search index...

    Fake class which should be extended to avoid inheriting static properties

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    Methods

    addSelect allInputsFilled appendDummyInput appendStatementInput appendValueInput applyColour bringToFront bumpNeighbours dispose fadeForReplacement getBoundingRectangle getChildren getColour getColourBorder getColourSecondary getColourShadow getColourTertiary getCommentIcon getCommentText getConnections_ getDescendants getField getFieldValue getFirstStatementConnection getHeightWidth getHue getIcons getInheritedDisabled getInput getInputsInline getInputTargetBlock getInputWithBlock getMatchingConnection getNextBlock getOutputShape getParent getPreviousBlock getRelativeToSurfaceXY getRootBlock getStyleName getSurroundParent getSvgRoot getTooltip getTopStackBlock getVarModels getVars highlightShapeForInput initModel initSvg isCollapsed isDeletable isDisposed isDuplicatable isEditable isEnabled isInsertionMarker isMovable isShadow jsonInit lastConnectionInStack markDirty mixin moveBy moveConnections moveDuringDrag moveInputBefore moveNumberedInputBefore moveOffDragSurface moveTo moveToDragSurface positionNearConnection removeInput removeSelect renameVarById render scheduleSnapAndBump select setCollapsed setColour setCommentText setConnectionTracking setCursorSvg setDeletable setDeleteStyle setDragging setEditable setEnabled setFieldValue setHelpUrl setHighlighted setInputsInline setInsertionMarker setMarkerSvg setMovable setMutator setNextStatement setOnChange setOutput setOutputShape setParent setPreviousStatement setShadow setStyle setTooltip setWarningText showContextMenu showHelp snapToGrid tab toCopyData toDevString toString translate unplug unselect updateDisabled updateVarName

    Constructors

    • Class for a block's SVG representation. Not normally called directly, workspace.newBlock() is preferred.

      Parameters

      • workspace: WorkspaceSvg

        The block's workspace.

      • prototypeName: string

        Name of the language object containing type-specific functions for this block.

      • Optionalopt_id: string

        Optional ID. Use this ID if provided, otherwise create a new ID.

      Returns BlockSvg__Class

    Properties

    comment: Blockly.Comment

    Block's comment icon (if any).

    August 2019. Use getCommentIcon instead.

    commentModel: CommentModel

    A model of the comment attached to this block.

    compose: (_0: Blockly.BlockSvg) => any

    An optional method called when a mutator dialog saves its content. This function is called to modify the original block according to new settings. This method must also be coupled with defining a decompose method for the default mutation dialog button and UI to appear.

    contextMenu: boolean
    customContextMenu: (_0: Object[]) => any

    An optional method for defining custom block context menu items.

    data: string

    Optional text data that round-trips between blocks and XML. Has no effect. May be used by 3rd parties for meta information.

    decompose: (_0: WorkspaceSvg) => Blockly.BlockSvg

    An optional method called when a mutator dialog is first opened. This function must create and initialize a top-level block for the mutator dialog, and return it. This function should also populate this top-level block with any sub-blocks which are appropriate. This method must also be coupled with defining a compose method for the default mutation dialog button and UI to appear.

    disposed: boolean

    Has this block been disposed of?

    domToMutation: (_0: Element) => any

    An optional deserialization method for defining how to deserialize the mutation state. This must be coupled with defining mutationToDom.

    getDeveloperVariables: () => string[]

    An optional property for declaring developer variables. Return a list of variable names for use by generators. Developer variables are never shown to the user, but are declared as global variables in the generated code.

    hat: any

    Name of the type of hat.

    height: any

    Height of this block, not including any statement blocks above or below. Height is in workspace units.

    id: string
    init: () => any

    An optional method called during initialization.

    inputList: Input[]
    inputsInline: any
    inputsInlineDefault: any
    isInFlyout: boolean
    isInMutator: boolean
    mutationToDom: any

    An optional serialization method for defining how to serialize the mutation state. This must be coupled with defining domToMutation.

    mutator: Blockly.Mutator

    Block's mutator icon (if any).

    nextConnection: Blockly.RenderedConnection
    onchange: (_0: Abstract) => any

    An optional callback method to use whenever the block's parent workspace changes. This is usually only called from the constructor, the block type initializer function, or an extension initializer function.

    outputConnection: Blockly.RenderedConnection
    pathObject: IPathObject

    The renderer's path object.

    previousConnection: Blockly.RenderedConnection
    rendered: boolean
    renderingDebugger: Blockly.blockRendering.Debug

    An property used internally to reference the block's rendering debugger.

    RTL: boolean
    statementInputCount: number

    A count of statement inputs on the block.

    style: BlockStyle

    A block style object.

    suppressPrefixSuffix: boolean

    An optional property for suppressing adding STATEMENT_PREFIX and STATEMENT_SUFFIX to generated code.

    tooltip: TipInfo
    type: string
    warning: Warning

    Block's warning icon (if any).

    width: any

    Width of this block, including any connected value blocks. Width is in workspace units.

    workspace: WorkspaceSvg

    Methods

    • Select this block. Highlight it visually.

      Returns void

    • Recursively checks whether all statement and value inputs are filled with blocks. Also checks all following statement blocks in this stack.

      Parameters

      • Optionalopt_shadowBlocksAreFilled: boolean

        An optional argument controlling whether shadow blocks are counted as filled. Defaults to true.

      Returns boolean

      True if all inputs are filled, false otherwise.

    • Shortcut for appending a dummy input row.

      Parameters

      • Optionalopt_name: string

        Language-neutral identifier which may used to find this input again. Should be unique to this block.

      Returns Input

      The input object created.

    • Shortcut for appending a statement input row.

      Parameters

      • name: string

        Language-neutral identifier which may used to find this input again. Should be unique to this block.

      Returns Input

      The input object created.

    • Shortcut for appending a value input row.

      Parameters

      • name: string

        Language-neutral identifier which may used to find this input again. Should be unique to this block.

      Returns Input

      The input object created.

    • Change the colour of a block.

      Returns void

    • Move this block to the front of the visible workspace. tags do not respect z-index so SVG renders them in the order that they are in the DOM. By placing this block first within the block group's , it will render on top of any other blocks.

      Returns void

    • Bump unconnected blocks out of alignment. Two blocks which aren't actually connected should not coincidentally line up on screen.

      Returns void

    • Dispose of this block.

      Parameters

      • OptionalhealStack: boolean

        If true, then try to heal any gap by connecting the next statement with the previous statement. Otherwise, dispose of all children of this block.

      • Optionalanimate: boolean

        If true, show a disposal animation and sound.

      Returns void

    • Visual effect to show that if the dragging block is dropped, this block will be replaced. If a shadow block, it will disappear. Otherwise it will bump.

      Parameters

      • add: boolean

        True if highlighting should be added.

      Returns void

    • Returns the coordinates of a bounding box describing the dimensions of this block and any blocks stacked below it. Coordinate system: workspace coordinates.

      Returns Blockly.utils.Rect

      Object with coordinates of the bounding box.

    • Find all the blocks that are directly nested inside this one. Includes value and statement inputs, as well as any following statement. Excludes any connection on an output tab or any preceding statement. Blocks are optionally sorted by position; top to bottom.

      Parameters

      • ordered: boolean

        Sort the list if true.

      Returns Blockly.Block[]

      Array of blocks.

    • Get the colour of a block.

      Returns string

      #RRGGBB string.

    • Get the border colour(s) of a block.

      Returns { colourBorder: any; colourDark: any; colourLight: any }

      An object containing colour values for the border(s) of the block. If the block is using a style the colourBorder will be defined and equal to the tertiary colour of the style (#RRGGBB string). Otherwise the colourDark and colourLight attributes will be defined (#RRGGBB strings).

      Use style.colourTertiary. (2020 January 21)

    • Get the secondary colour of a block.

      Returns string

      #RRGGBB string.

    • Get the shadow colour of a block.

      Returns string

      #RRGGBB string.

      Use style.colourSecondary. (2020 January 21)

    • Get the tertiary colour of a block.

      Returns string

      #RRGGBB string.

    • Get the comment icon attached to this block, or null if the block has no comment.

      Returns Blockly.Comment

      The comment icon attached to this block, or null.

    • Returns the comment on this block (or null if there is no comment).

      Returns string

      Block's comment.

    • Returns connections originating from this block.

      Parameters

      • all: boolean

        If true, return all connections even hidden ones. Otherwise, for a non-rendered block return an empty list, and for a collapsed block don't return inputs connections.

      Returns Blockly.RenderedConnection[]

      Array of connections.

    • Find all the blocks that are directly or indirectly nested inside this one. Includes this block in the list. Includes value and statement inputs, as well as any following statements. Excludes any connection on an output tab or any preceding statements. Blocks are optionally sorted by position; top to bottom.

      Parameters

      • ordered: boolean

        Sort the list if true.

      Returns Blockly.Block[]

      Flattened array of blocks.

    • Returns the named field from a block.

      Parameters

      • name: string

        The name of the field.

      Returns Blockly.Field

      Named field, or null if field does not exist.

    • Returns the language-neutral value of the given field.

      Parameters

      • name: string

        The name of the field.

      Returns any

      Value of the field or null if field does not exist.

    • Returns a bounding box describing the dimensions of this block and any blocks stacked below it.

      Returns { height: number; width: number }

      Object with height and width properties in workspace units.

    • Get the HSV hue value of a block. Null if hue not set.

      Returns number

      Hue value (0-360).

    • Returns a list of mutator, comment, and warning icons.

      Returns Blockly.Icon[]

      List of icons.

    • Get whether the block is disabled or not due to parents. The block's own disabled property is not considered.

      Returns boolean

      True if disabled.

    • Fetches the named input object.

      Parameters

      • name: string

        The name of the input.

      Returns Input

      The input object, or null if input does not exist.

    • Get whether value inputs are arranged horizontally or vertically.

      Returns boolean

      True if inputs are horizontal.

    • Fetches the block attached to the named input.

      Parameters

      • name: string

        The name of the input.

      Returns Blockly.Block

      The attached value block, or null if the input is either disconnected or if the input does not exist.

    • Return the input that connects to the specified block.

      Parameters

      • block: Blockly.Block

        A block connected to an input on this block.

      Returns Input

      The input (if any) that connects to the specified block.

    • Return the next statement block directly connected to this block.

      Returns Blockly.Block

      The next statement block or null.

    • Get the block's output shape.

      Returns number

      Value representing output shape if one exists.

    • Return the parent block or null if this block is at the top level. The parent block is either the block connected to the previous connection (for a statement block) or the block connected to the output connection (for a value block).

      Returns Blockly.Block

      The block (if any) that holds the current block.

    • Returns the block connected to the previous connection.

      Returns Blockly.Block

      The previous statement block or null.

    • Return the coordinates of the top-left corner of this block relative to the drawing surface's origin (0,0), in workspace units. If the block is on the workspace, (0, 0) is the origin of the workspace coordinate system. This does not change with workspace scale.

      Returns Blockly.utils.Coordinate

      Object with .x and .y properties in workspace coordinates.

    • Return the top-most block in this block's tree. This will return itself if this block is at the top level.

      Returns Blockly.Block

      The root block.

    • Get the name of the block style.

      Returns string

      Name of the block style.

    • Return the parent block that surrounds the current block, or null if this block has no surrounding block. A parent block might just be the previous statement, whereas the surrounding block is an if statement, while loop, etc.

      Returns Blockly.Block

      The block (if any) that surrounds the current block.

    • Return the root node of the SVG or null if none exists.

      Returns SVGGElement

      The root SVG node (probably a group).

    • Returns the tooltip text for this block.

      Returns string

      The tooltip text for this block.

    • Walk up from the given block up through the stack of blocks to find the top block of the sub stack. If we are nested in a statement input only find the top-most nested block. Do not go all the way to the root block.

      Returns Blockly.Block

      The top block in a stack.

    • Return all variables referenced by this block.

      Returns string[]

      List of variable names.

    • Visual effect to show that if the dragging block is dropped it will connect to this input.

      Parameters

      • conn: Blockly.Connection

        The connection on the input to highlight.

      • add: boolean

        True if highlighting should be added.

      Returns void

    • Call initModel on all fields on the block. May be called more than once. Either initModel or initSvg must be called after creating a block and before the first interaction with it. Interactions include UI actions (e.g. clicking and dragging) and firing events (e.g. create, delete, and change).

      Returns void

    • Create and initialize the SVG representation of the block. May be called more than once.

      Returns void

    • Get whether the block is collapsed or not.

      Returns boolean

      True if collapsed.

    • Get whether this block is deletable or not.

      Returns boolean

      True if deletable.

    • Returns if this block has been disposed of / deleted.

      Returns boolean

      True if this block has been disposed of / deleted.

    • Get whether is block is duplicatable or not. If duplicating this block and descendants will put this block over the workspace's capacity this block is not duplicatable. If duplicating this block and descendants will put any type over their maxInstances this block is not duplicatable.

      Returns boolean

      True if duplicatable.

    • Get whether this block is editable or not.

      Returns boolean

      True if editable.

    • Get whether this block is enabled or not.

      Returns boolean

      True if enabled.

    • Get whether this block is an insertion marker block or not.

      Returns boolean

      True if an insertion marker.

    • Get whether this block is movable or not.

      Returns boolean

      True if movable.

    • Get whether this block is a shadow block or not.

      Returns boolean

      True if a shadow.

    • Initialize this block using a cross-platform, internationalization-friendly JSON description.

      Parameters

      • json: Object

        Structured data describing the block.

      Returns void

    • Walks down a stack of blocks and finds the last next connection on the stack.

      Parameters

      • ignoreShadows: boolean

        If true,the last connection on a non-shadow block will be returned. If false, this will follow shadows to find the last connection.

      Returns Blockly.Connection

      The last next connection on the stack, or null.

    • Notify every input on this block to mark its fields as dirty. A dirty field is a field that needs to be re-rendered.

      Returns void

    • Add key/values from mixinObj to this block object. By default, this method will check that the keys in mixinObj will not overwrite existing values in the block, including prototype values. This provides some insurance against mixin / extension incompatibilities with future block features. This check can be disabled by passing true as the second argument.

      Parameters

      • mixinObj: Object

        The key/values pairs to add to this block object.

      • Optionalopt_disableCheck: boolean

        Option flag to disable overwrite checks.

      Returns void

    • Move a block by a relative offset.

      Parameters

      • dx: number

        Horizontal offset in workspace units.

      • dy: number

        Vertical offset in workspace units.

      Returns void

    • Move the connections for this block and all blocks attached under it. Also update any attached bubbles.

      Parameters

      • dx: number

        Horizontal offset from current location, in workspace units.

      • dy: number

        Vertical offset from current location, in workspace units.

      Returns void

    • Move this block during a drag, taking into account whether we are using a drag surface to translate blocks. This block must be a top-level block.

      Parameters

      Returns void

    • Move a named input to a different location on this block.

      Parameters

      • name: string

        The name of the input to move.

      • refName: string

        Name of input that should be after the moved input, or null to be the input at the end.

      Returns void

    • Move a numbered input to a different location on this block.

      Parameters

      • inputIndex: number

        Index of the input to move.

      • refIndex: number

        Index of input that should be after the moved input.

      Returns void

    • Move this block back to the workspace block canvas. Generally should be called at the same time as setDragging_(false). Does nothing if useDragSurface_ is false.

      Parameters

      • newXY: Blockly.utils.Coordinate

        The position the block should take on on the workspace canvas, in workspace coordinates.

      Returns void

    • Move a block to a position.

      Parameters

      Returns void

    • Move this block to its workspace's drag surface, accounting for positioning. Generally should be called at the same time as setDragging_(true). Does nothing if useDragSurface_ is false.

      Returns void

    • Position a block so that it doesn't move the target block when connected. The block to position is usually either the first block in a dragged stack or an insertion marker.

      Parameters

      Returns void

    • Remove an input from this block.

      Parameters

      • name: string

        The name of the input.

      • Optionalopt_quiet: boolean

        True to prevent error if input is not present.

      Returns boolean

      True if operation succeeds, false if input is not present and opt_quiet is true

      if the input is not present and opt_quiet is not true.

    • Unselect this block. Remove its highlighting.

      Returns void

    • Notification that a variable is renaming. If the ID matches one of this block's variables, rename it.

      Parameters

      • oldId: string

        ID of variable to rename.

      • newId: string

        ID of new variable. May be the same as oldId, but with an updated name.

      Returns void

    • Lays out and reflows a block based on its contents and settings.

      Parameters

      • Optionalopt_bubble: boolean

        If false, just render this block. If true, also render block's parent, grandparent, etc. Defaults to true.

      Returns void

    • Schedule snapping to grid and bumping neighbours to occur after a brief delay.

      Returns void

    • Select this block. Highlight it visually.

      Returns void

    • Set whether the block is collapsed or not.

      Parameters

      • collapsed: boolean

        True if collapsed.

      Returns void

    • Change the colour of a block.

      Parameters

      • colour: string | number

        HSV hue value, or #RRGGBB string.

      Returns void

    • Set this block's comment text.

      Parameters

      • text: string

        The text, or null to delete.

      Returns void

    • Sets whether this block's connections are tracked in the database or not.

      Used by the deserializer to be more efficient. Setting a connection's tracked_ value to false keeps it from adding itself to the db when it gets its first moveTo call, saving expensive ops for later.

      Parameters

      • track: boolean

        If true, start tracking. If false, stop tracking.

      Returns void

    • Add the cursor SVG to this block's SVG group.

      Parameters

      • cursorSvg: SVGElement

        The SVG root of the cursor to be added to the block SVG group.

      Returns void

    • Set whether this block is deletable or not.

      Parameters

      • deletable: boolean

        True if deletable.

      Returns void

    • Update the cursor over this block by adding or removing a class.

      Parameters

      • enable: boolean

        True if the delete cursor should be shown, false otherwise.

      Returns void

    • Recursively adds or removes the dragging class to this node and its children.

      Parameters

      • adding: boolean

        True if adding, false if removing.

      Returns void

    • Set whether this block is editable or not.

      Parameters

      • editable: boolean

        True if editable.

      Returns void

    • Set whether the block is enabled or not.

      Parameters

      • enabled: boolean

        True if enabled.

      Returns void

    • Sets the value of the given field for this block.

      Parameters

      • newValue: any

        The value to set.

      • name: string

        The name of the field to set the value of.

      Returns void

    • Set the URL of this block's help page.

      Parameters

      • url: string | Function

        URL string for block help, or function that returns a URL. Null for no help.

      Returns void

    • Set whether the block is highlighted or not. Block highlighting is often used to visually mark blocks currently being executed.

      Parameters

      • highlighted: boolean

        True if highlighted.

      Returns void

    • Set whether value inputs are arranged horizontally or vertically.

      Parameters

      • newBoolean: boolean

        True if inputs are horizontal.

      Returns void

    • Set whether this block is an insertion marker block or not. Once set this cannot be unset.

      Parameters

      • insertionMarker: boolean

        True if an insertion marker.

      Returns void

    • Add the marker SVG to this block's SVG group.

      Parameters

      • markerSvg: SVGElement

        The SVG root of the marker to be added to the block SVG group.

      Returns void

    • Set whether this block is movable or not.

      Parameters

      • movable: boolean

        True if movable.

      Returns void

    • Give this block a mutator dialog.

      Parameters

      Returns void

    • Set whether another block can chain onto the bottom of this block.

      Parameters

      • newBoolean: boolean

        True if there can be a next statement.

      • Optionalopt_check: any

        Statement type or list of statement types. Null/undefined if any type could be connected.

      Returns void

    • Sets a callback function to use whenever the block's parent workspace changes, replacing any prior onchange handler. This is usually only called from the constructor, the block type initializer function, or an extension initializer function.

      Parameters

      • onchangeFn: (_0: Abstract) => any

        The callback to call when the block's workspace changes.

      Returns void

      if onchangeFn is not falsey and not a function.

    • Set whether this block returns a value.

      Parameters

      • newBoolean: boolean

        True if there is an output.

      • Optionalopt_check: any

        Returned type or list of returned types. Null or undefined if any type could be returned (e.g. variable get).

      Returns void

    • Set the block's output shape.

      Parameters

      • outputShape: number

        Value representing an output shape.

      Returns void

    • Set parent of this block to be a new block or null.

      Parameters

      Returns void

    • Set whether this block can chain onto the bottom of another block.

      Parameters

      • newBoolean: boolean

        True if there can be a previous statement.

      • Optionalopt_check: any

        Statement type or list of statement types. Null/undefined if any type could be connected.

      Returns void

    • Set whether this block is a shadow block or not.

      Parameters

      • shadow: boolean

        True if a shadow.

      Returns void

    • Set the style and colour values of a block.

      Parameters

      • blockStyleName: string

        Name of the block style.

      Returns void

      if the block style does not exist.

    • Sets the tooltip for this block.

      Parameters

      • newTip: TipInfo

        The text for the tooltip, a function that returns the text for the tooltip, or a parent object whose tooltip will be used. To not display a tooltip pass the empty string.

      Returns void

    • Set this block's warning text.

      Parameters

      • text: string

        The text, or null to delete.

      • Optionalopt_id: string

        An optional ID for the warning text to be able to maintain multiple warnings.

      Returns void

    • Show the context menu for this block.

      Parameters

      Returns void

    • Load the block's help page in a new window.

      Returns void

    • Snap this block to the nearest grid point.

      Returns void

    • Open the next (or previous) FieldTextInput.

      Parameters

      • start: Blockly.Field

        Current field.

      • forward: boolean

        If true go forward, otherwise backward.

      Returns void

    • Encode a block for copying.

      Returns CopyData

      Copy metadata, or null if the block is an insertion marker.

    • This method returns a string describing this Block in developer terms (type name and ID; English only).

      Intended to on be used in console logs and errors. If you need a string that uses the user's native language (including block text, field values, and child blocks), use [toString()]Blockly.Block#toString.

      Returns string

      The description.

    • Create a human-readable text representation of this block and any children.

      Parameters

      • Optionalopt_maxLength: number

        Truncate the string to this length.

      • Optionalopt_emptyToken: string

        The placeholder string used to denote an empty field. If not specified, '?' is used.

      Returns string

      Text of block.

    • Transforms a block by setting the translation on the transform attribute of the block's SVG.

      Parameters

      • x: number

        The x coordinate of the translation in workspace units.

      • y: number

        The y coordinate of the translation in workspace units.

      Returns void

    • Unplug this block from its superior block. If this block is a statement, optionally reconnect the block underneath with the block on top.

      Parameters

      • Optionalopt_healStack: boolean

        Disconnect child statement and reconnect stack. Defaults to false.

      Returns void

    • Unselect this block. Remove its highlighting.

      Returns void

    • Enable or disable a block.

      Returns void

    • Notification that a variable is renaming but keeping the same ID. If the variable is in use on this block, rerender to show the new name.

      Parameters

      Returns void