mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
* chore: add linting for tsdoc * chore: don't require types on return * chore: remove redundant fileoverview from ts * chore: change return to returns and add some newlines * chore: remove license tag * chore: don't require params/return docs * chore: remove spurious struct tags * Revert "chore: change return to returns and add some newlines" This reverts commitd6d8656a45. * chore: don't auto-add param names * chore: disable require-param bc it breaks on this * return to returns and add line breaks * chore: configure additional jsdoc rules * chore: run format * Revert "chore: remove license tag" This reverts commit173455588a. * chore: allow license tag format * chore: only require jsdoc on exported items * chore: add missing jsdoc or silence where needed * chore: run format * chore: lint fixes
82 lines
2.2 KiB
TypeScript
82 lines
2.2 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2022 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* All the values that we expect developers to be able to change
|
|
* before injecting Blockly. Changing these values during run time is not
|
|
* generally recommended.
|
|
*
|
|
* @namespace Blockly.config
|
|
*/
|
|
import * as goog from '../closure/goog/goog.js';
|
|
goog.declareModuleId('Blockly.config');
|
|
|
|
|
|
/**
|
|
* All the values that we expect developers to be able to change
|
|
* before injecting Blockly.
|
|
*/
|
|
interface Config {
|
|
dragRadius: number;
|
|
flyoutDragRadius: number;
|
|
snapRadius: number;
|
|
currentConnectionPreference: number;
|
|
bumpDelay: number;
|
|
connectingSnapRadius: number;
|
|
}
|
|
|
|
/** Default snap radius. */
|
|
const DEFAULT_SNAP_RADIUS = 28;
|
|
|
|
/**
|
|
* Object holding all the values on Blockly that we expect developers to be
|
|
* able to change.
|
|
*/
|
|
export const config: Config = {
|
|
/**
|
|
* Number of pixels the mouse must move before a drag starts.
|
|
*
|
|
* @alias Blockly.config.dragRadius
|
|
*/
|
|
dragRadius: 5,
|
|
/**
|
|
* Number of pixels the mouse must move before a drag/scroll starts from the
|
|
* flyout. Because the drag-intention is determined when this is reached, it
|
|
* is larger than dragRadius so that the drag-direction is clearer.
|
|
*
|
|
* @alias Blockly.config.flyoutDragRadius
|
|
*/
|
|
flyoutDragRadius: 10,
|
|
/**
|
|
* Maximum misalignment between connections for them to snap together.
|
|
*
|
|
* @alias Blockly.config.snapRadius
|
|
*/
|
|
snapRadius: DEFAULT_SNAP_RADIUS,
|
|
/**
|
|
* Maximum misalignment between connections for them to snap together.
|
|
* This should be the same as the snap radius.
|
|
*
|
|
* @alias Blockly.config.connectingSnapRadius
|
|
*/
|
|
connectingSnapRadius: DEFAULT_SNAP_RADIUS,
|
|
/**
|
|
* How much to prefer staying connected to the current connection over moving
|
|
* to a new connection. The current previewed connection is considered to be
|
|
* this much closer to the matching connection on the block than it actually
|
|
* is.
|
|
*
|
|
* @alias Blockly.config.currentConnectionPreference
|
|
*/
|
|
currentConnectionPreference: 8,
|
|
/**
|
|
* Delay in ms between trigger and bumping unconnected block out of alignment.
|
|
*
|
|
* @alias Blockly.config.bumpDelay
|
|
*/
|
|
bumpDelay: 250,
|
|
};
|