Holds injection information pertaining to LEADVIEW's Annotations Panel.
function lt.LEADVIEW.AnnPanelInjector
export class InjectionManagerExample {
public constructor() {
if (lt.RasterSupport.kernelExpired)
lt.RasterSupport.setLicenseUri("https://demo.leadtools.com/licenses/js/LEADTOOLSEVAL.txt", "EVAL", null);
lt.LEADVIEW.InjectionManager.Instance.inject = this.inject;
}
public run = (divID: string): void => {
const lv = new lt.LEADVIEW.Viewer();
lv.run(null, {
'rootDivId': divID
});
}
private inject = (e: lt.LEADVIEW.InjectionArgs) => {
/**
* Simple example for showcasinbg injection functionality.
* We will inject a red square in every area that is capable of being injected.
*
* Since we are not wiring up any callbacks -- we don't need to perform any
* cleanup actions, so we can ignore all unmounting calls.
*/
if (e.state === lt.LEADVIEW.InjectionState.unmounting) return;
switch (e.type) {
case lt.LEADVIEW.InjectionType.toolbar:
this.injectToolbar(e.data);
break;
case lt.LEADVIEW.InjectionType.menu:
this.injectMenu(e.data);
break;
case lt.LEADVIEW.InjectionType.annToolbar:
this.injectAnnToolbar(e.data)
break;
}
}
private injectToolbar = (obj: any) => {
const injector = obj as lt.LEADVIEW.ToolbarInjector;
document.getElementById(injector.start).appendChild(this.getRedSquare());
document.getElementById(injector.end).appendChild(this.getRedSquare());
}
private injectMenu = (obj: any) => {
const injector = obj as lt.LEADVIEW.MenuInjector;
document.getElementById(injector.start).appendChild(this.getRedSquare());
document.getElementById(injector.end).appendChild(this.getRedSquare());
document.getElementById(injector.tabStart).appendChild(this.getRedSquare());
document.getElementById(injector.tabEnd).appendChild(this.getRedSquare());
document.getElementById(injector.content).appendChild(this.getRedSquare());
}
private injectAnnToolbar = (obj: any) => {
const injector = obj as lt.LEADVIEW.AnnPanelInjector;
document.getElementById(injector.start).appendChild(this.getRedSquare());
document.getElementById(injector.end).appendChild(this.getRedSquare());
}
private getRedSquare = () => {
const ele = document.createElement('div');
ele.style.width = '10px';
ele.style.height = '10px';
ele.style.backgroundColor = 'red';
return ele;
}
}