move to iife rather than es, add support for Wx and streamlit
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { Drawing } from "../drawing/drawing";
|
||||
import { DrawingOptions } from "../drawing/options";
|
||||
import { GlobalParams } from "../general/global-params";
|
||||
|
||||
declare const window: GlobalParams;
|
||||
@ -23,7 +24,7 @@ export class ColorPicker {
|
||||
private rgba: number[] | undefined;
|
||||
|
||||
constructor(saveDrawings: Function,
|
||||
private colorOption: string,
|
||||
private colorOption: keyof DrawingOptions,
|
||||
) {
|
||||
this.saveDrawings = saveDrawings
|
||||
|
||||
@ -121,7 +122,9 @@ export class ColorPicker {
|
||||
}
|
||||
openMenu(rect: DOMRect) {
|
||||
if (!Drawing.lastHoveredObject) return;
|
||||
this.rgba = ColorPicker.extractRGBA(Drawing.lastHoveredObject._options[this.colorOption])
|
||||
this.rgba = ColorPicker.extractRGBA(
|
||||
Drawing.lastHoveredObject._options[this.colorOption] as string
|
||||
)
|
||||
this.opacity = this.rgba[3];
|
||||
this._updateOpacitySlider();
|
||||
this._div.style.top = (rect.top-30)+'px'
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { Drawing } from "../drawing/drawing";
|
||||
import { DrawingTool } from "../drawing/drawing-tool";
|
||||
import { DrawingOptions } from "../drawing/options";
|
||||
import { GlobalParams } from "../general/global-params";
|
||||
import { ColorPicker } from "./color-picker";
|
||||
import { StylePicker } from "./style-picker";
|
||||
@ -64,7 +65,7 @@ export class ContextMenu {
|
||||
for (const optionName of Object.keys(Drawing.hoveredObject._options)) {
|
||||
let subMenu;
|
||||
if (optionName.toLowerCase().includes('color')) {
|
||||
subMenu = new ColorPicker(this.saveDrawings, optionName);
|
||||
subMenu = new ColorPicker(this.saveDrawings, optionName as keyof DrawingOptions);
|
||||
} else if (optionName === 'lineStyle') {
|
||||
subMenu = new StylePicker(this.saveDrawings)
|
||||
} else continue;
|
||||
|
||||
Reference in New Issue
Block a user