調査アンケート: Blockly のご利用体験についてお聞かせください
アンケートを開始
ズーム オプション
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Blockly のメイン ワークスペースは、ユーザーが動的に、またはデベロッパーが静的にスケーリングできます。
ズーム設定は、Blockly の構成オプションの一部であるオブジェクトによって定義されます。以下に例を示します。
var workspace = Blockly.inject('blocklyDiv',
{toolbox: document.getElementById('toolbox'),
zoom:
{controls: true,
wheel: true,
startScale: 1.0,
maxScale: 3,
minScale: 0.3,
scaleSpeed: 1.2,
pinch: true},
trashcan: true});
設定;コントロール(# など適宜文脈に応じて)
true
に設定すると、ズーム センター、ズームイン、ズームアウトのボタンが表示されます。デフォルトは false
です。

wheel
マウスホイールでズームできるようにするには、true
に設定します。デフォルトは false
です。
startScale
初期の拡大率。複数のレベルがあるアプリでは、startScale
は通常、最初のレベルで高い値に設定され、その後のレベルが複雑になるにつれて徐々に減少します。デフォルトは 1.0
です。
maxScale
最大倍率(ズームインできる範囲)。デフォルトは 3
です。
minScale
ズームアウトできる最小倍率。デフォルトは 0.3
です。
scaleSpeed
ズームイン / ズームアウトのステップごとに、スケールはスケール速度でそれぞれ乗算または除算されます。つまり、scale = scaleSpeed ^ steps
です。この式では、ズームアウトのステップは減算され、ズームインのステップは加算されます。デフォルトは 1.2
です。
ピンチ操作する
タッチデバイスでピンチ操作によるズームを有効にするには、true
に設定します。wheel
オプションまたは controls
オプションが true
に設定されている場合、デフォルトは true
です。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-25 UTC。"],[[["\u003cp\u003eBlockly workspaces can be scaled dynamically by users or statically by developers.\u003c/p\u003e\n"],["\u003cp\u003eZoom settings are customizable using Blockly's configuration options, controlling aspects like zoom controls, mouse wheel zoom, and initial scale.\u003c/p\u003e\n"],["\u003cp\u003eZoom levels can be defined using \u003ccode\u003estartScale\u003c/code\u003e, \u003ccode\u003emaxScale\u003c/code\u003e, and \u003ccode\u003eminScale\u003c/code\u003e properties within the configuration object to manage the zoom extent.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003escaleSpeed\u003c/code\u003e property determines the rate at which the workspace is zoomed in or out with each step.\u003c/p\u003e\n"],["\u003cp\u003ePinch-to-zoom functionality on touch devices can be enabled through the \u003ccode\u003epinch\u003c/code\u003e option in the zoom settings.\u003c/p\u003e\n"]]],[],null,["# Zoom option\n\nBlockly's main workspace may be scalable, either dynamically by the user,\nor statically by the developer.\n\nThe zoom settings are defined by an object that is part of Blockly's\n[configuration\noptions](/blockly/guides/configure/web/configuration_struct#the_options_dictionary).\nHere is an example: \n\n```gdscript\nvar workspace = Blockly.inject('blocklyDiv',\n {toolbox: document.getElementById('toolbox'),\n zoom:\n {controls: true,\n wheel: true,\n startScale: 1.0,\n maxScale: 3,\n minScale: 0.3,\n scaleSpeed: 1.2,\n pinch: true},\n trashcan: true});\n```\n\ncontrols\n--------\n\nSet to `true` to show zoom-centre, zoom-in, and zoom-out buttons.\nDefaults to `false`.\n\nwheel\n-----\n\nSet to `true` to allow the mouse wheel to zoom. Defaults to `false`.\n\nstartScale\n----------\n\nInitial magnification factor. For applications with multiple levels,\n`startScale` is often set to a higher value on the first level, then\nincrementally decreased as subsequent levels become more complex.\nDefaults to `1.0`.\n\nmaxScale\n--------\n\nMaximum multiplication factor for how far one can zoom in. Defaults to `3`.\n\nminScale\n--------\n\nMinimum multiplication factor for how far one can zoom out. Defaults to `0.3`.\n\nscaleSpeed\n----------\n\nFor each zooming in-out step the scale is multiplied or divided respectively by\nthe scale speed, this means that: `scale = scaleSpeed ^ steps`. Note that in\nthis formula steps of zoom-out are subtracted and zoom-in steps are added.\nDefaults to `1.2`.\n\npinch\n-----\n\nSet to `true` to enable pinch to zoom support on touch devices. Defaults to\n`true` if either the `wheel` or `controls` option is set to `true`."]]