Canvas: Improve Selection System (#41065)

This commit is contained in:
Nathan Marrs
2021-10-29 14:32:52 -07:00
committed by GitHub
parent 161d92e12f
commit 268c20203b
7 changed files with 72 additions and 15 deletions

View File

@@ -44,8 +44,7 @@ export class CanvasPanel extends Component<Props, State> {
this.subs.add(
this.props.eventBus.subscribe(PanelEditEnteredEvent, (evt) => {
// Remove current selection when entering edit mode for any panel in dashboard
let event: MouseEvent = new MouseEvent('click');
this.scene?.selecto?.clickTarget(event, this.scene?.div);
this.scene.clearCurrentSelection();
})
);

View File

@@ -44,7 +44,7 @@ export class LayerElementListEditor extends PureComponent<Props> {
try {
settings.scene.selecto.clickTarget(item, item?.div);
} catch (error) {
appEvents.emit(AppEvents.alertError, ['Unable to select element with inline editing disabled']);
appEvents.emit(AppEvents.alertError, ['Unable to select element, try selecting element in panel instead']);
}
}
};

View File

@@ -46,8 +46,6 @@ export function getElementEditor(opts: CanvasEditorOptions): NestedPanelOptions<
// Dynamically fill the selected element
build: (builder, context) => {
console.log('MAKE element editor', opts.element.UID);
const { options } = opts.element;
const layerTypes = canvasElementRegistry.selectOptions(
options?.type // the selected value

View File

@@ -30,8 +30,6 @@ export function getLayerEditor(opts: InstanceState): NestedPanelOptions<Instance
// Dynamically fill the selected element
build: (builder, context) => {
console.log('MAKE layer editor', layer.UID);
builder.addCustomEditor({
id: 'content',
path: 'root',

View File

@@ -28,8 +28,6 @@ export const plugin = new PanelPlugin<PanelOptions>(CanvasPanel)
scene: state.scene,
})
);
} else {
console.log('NO Single seleciton', selection?.length);
}
builder.addNestedOptions(getLayerEditor(state));