Add toolbar plugin technology.
This commit is contained in:
parent
a59f531ed7
commit
ca4021c3a3
@ -2,15 +2,31 @@ import { SetExternalLibLocation } from '../engine/io/externallibs.js';
|
|||||||
import { Embed } from './embed.js';
|
import { Embed } from './embed.js';
|
||||||
import { Website } from './website.js';
|
import { Website } from './website.js';
|
||||||
import { SetEventHandler } from './eventhandler.js';
|
import { SetEventHandler } from './eventhandler.js';
|
||||||
|
|
||||||
import { PluginType, RegisterPlugin } from './pluginregistry.js';
|
import { PluginType, RegisterPlugin } from './pluginregistry.js';
|
||||||
export { PluginType, RegisterPlugin };
|
|
||||||
|
import * as Engine from '../engine/main.js';
|
||||||
|
export { Engine };
|
||||||
|
|
||||||
|
import { ButtonDialog } from './dialog.js';
|
||||||
|
export const UI = {
|
||||||
|
ButtonDialog
|
||||||
|
};
|
||||||
|
|
||||||
export function SetWebsiteEventHandler (eventHandler)
|
export function SetWebsiteEventHandler (eventHandler)
|
||||||
{
|
{
|
||||||
SetEventHandler (eventHandler );
|
SetEventHandler (eventHandler );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function RegisterHeaderPlugin (plugin)
|
||||||
|
{
|
||||||
|
RegisterPlugin (PluginType.Header, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function RegisterToolbarPlugin (plugin)
|
||||||
|
{
|
||||||
|
RegisterPlugin (PluginType.Toolbar, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
export function StartWebsite (externalLibLocation)
|
export function StartWebsite (externalLibLocation)
|
||||||
{
|
{
|
||||||
SetExternalLibLocation (externalLibLocation);
|
SetExternalLibLocation (externalLibLocation);
|
||||||
|
|||||||
@ -2,7 +2,8 @@ let plugins = new Map ();
|
|||||||
|
|
||||||
export const PluginType =
|
export const PluginType =
|
||||||
{
|
{
|
||||||
Header : 1
|
Header : 1,
|
||||||
|
Toolbar : 2
|
||||||
};
|
};
|
||||||
|
|
||||||
export function RegisterPlugin (type, plugin)
|
export function RegisterPlugin (type, plugin)
|
||||||
|
|||||||
@ -594,6 +594,20 @@ export class Website
|
|||||||
ShowSharingDialog (importer.GetFileList (), this.settings, this.viewer);
|
ShowSharingDialog (importer.GetFileList (), this.settings, this.viewer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
EnumeratePlugins (PluginType.Toolbar, (plugin) => {
|
||||||
|
plugin.registerButtons ({
|
||||||
|
createSeparator : (icon, title, classNames) => {
|
||||||
|
AddSeparator (this.toolbar, icon, title, classNames);
|
||||||
|
},
|
||||||
|
createButton : (icon, title, classNames, onClick) => {
|
||||||
|
AddButton (this.toolbar, icon, title, classNames, onClick);
|
||||||
|
},
|
||||||
|
getModel : () => {
|
||||||
|
return this.model;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
this.parameters.fileInput.addEventListener ('change', (ev) => {
|
this.parameters.fileInput.addEventListener ('change', (ev) => {
|
||||||
if (ev.target.files.length > 0) {
|
if (ev.target.files.length > 0) {
|
||||||
HandleEvent ('model_load_started', 'open_file');
|
HandleEvent ('model_load_started', 'open_file');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user