Skip to content

Commit

Permalink
chore: Added minimap to gh pages (google#1868)
Browse files Browse the repository at this point in the history
* removed private from package.json

* chore: Added minimap to gh pages

* Revert "removed private from package.json"

This reverts commit 13d971a.

* added advanced playground

* packagelock

* new picture

* Revert "packagelock"

This reverts commit e354d4a.
  • Loading branch information
cesarades authored and gonfunko committed Aug 25, 2023
1 parent 9476895 commit e0aaf33
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 22 deletions.
11 changes: 11 additions & 0 deletions gh-pages/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ <h4>
</p>
</div>
</a>
<a class="card" href="plugins/workspace-minimap/test/index.html">
<img srcset="media/workspace-minimap.png 2x">
<div>
<h4>
Minimap
</h4>
<p>
A plugin that adds a minimap to the workspace for improved navigation and organization.
</p>
</div>
</a>
<a class="card" href="plugins/zoom-to-fit/test/index.html">
<img srcset="media/zoom-to-fit.png 2x">
<div>
Expand Down
Binary file added gh-pages/media/workspace-minimap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion plugins/workspace-minimap/test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</head>

<body>
<div id="root" style="height: 99vh; width: 100vw;"></div>
<div id="root"></div>
<script src="../build/test_bundle.js"></script>
</body>

Expand Down
40 changes: 19 additions & 21 deletions plugins/workspace-minimap/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,26 @@
*/

import * as Blockly from 'blockly';
import {toolboxCategories} from '@blockly/dev-tools';
import {toolboxCategories, createPlayground} from '@blockly/dev-tools';
import {Minimap, PositionedMinimap} from '../src/index';

// Creates the primary workspace and adds the minimap.
const positionedWorkspace = Blockly.inject('root',
{toolbox: toolboxCategories});
const positionedMinimap = new PositionedMinimap(positionedWorkspace);
positionedMinimap.init();
/**
* Create a workspace.
* @param blocklyDiv The blockly container div.
* @param options The Blockly options.
* @returns The created workspace.
*/
function createWorkspace(blocklyDiv: HTMLElement,
options: Blockly.BlocklyOptions): Blockly.WorkspaceSvg {
// Creates the primary workspace and adds the minimap.
const workspace = Blockly.inject(blocklyDiv, options);
const minimap = new PositionedMinimap(workspace);
minimap.init();

const seedTest = (workspace: Blockly.WorkspaceSvg): void => {
// Creates 100 if blocks
for (let i = 0; i < 100; i++) {
const block = workspace.newBlock('controls_if');
block.initSvg();
block.render();
}
return workspace;
}

// Move the blocks to random locations.
for (const block of workspace.getAllBlocks(true)) {
const cord = new Blockly.utils.Coordinate(
Math.round(Math.random() * 450 + 40),
Math.round(Math.random() * 600 + 40));
block.moveTo(cord);
}
};
document.addEventListener('DOMContentLoaded', function() {
createPlayground(document.getElementById('root'), createWorkspace as any,
{toolbox: toolboxCategories});
});

0 comments on commit e0aaf33

Please sign in to comment.