aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/presentationview/PresElementBox.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-10-25 11:03:39 -0400
committerbobzel <zzzman@gmail.com>2020-10-25 11:03:39 -0400
commit10935eb271443bd390d6b27b616bfcfef4ad01b2 (patch)
treef09abc5d632cc525375b4db15ee7bfc50692965a /src/client/views/presentationview/PresElementBox.tsx
parent7096b3a4c888816db9196f56a7bc01b89558d0ce (diff)
fixed updating pres.box instance and selectedArray to trigger mobx updates properluy
Diffstat (limited to 'src/client/views/presentationview/PresElementBox.tsx')
-rw-r--r--src/client/views/presentationview/PresElementBox.tsx12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/client/views/presentationview/PresElementBox.tsx b/src/client/views/presentationview/PresElementBox.tsx
index 0dc8a2148..2d7a768cc 100644
--- a/src/client/views/presentationview/PresElementBox.tsx
+++ b/src/client/views/presentationview/PresElementBox.tsx
@@ -141,8 +141,8 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc
e.stopPropagation();
e.preventDefault();
if (element && !(e.ctrlKey || e.metaKey)) {
- if (PresBox.Instance._selectedArray.includes(this.rootDoc)) {
- PresBox.Instance._selectedArray.length === 1 && PresBox.Instance.regularSelect(this.rootDoc, this._itemRef.current!, this._dragRef.current!, false);
+ if (PresBox.Instance._selectedArray.has(this.rootDoc)) {
+ PresBox.Instance._selectedArray.size === 1 && PresBox.Instance.regularSelect(this.rootDoc, this._itemRef.current!, this._dragRef.current!, false);
setupMoveUpEvents(this, e, this.startDrag, emptyFunction, emptyFunction);
} else {
setupMoveUpEvents(this, e, ((e: PointerEvent) => {
@@ -171,7 +171,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc
} else if (dragArray.length >= 1) {
const doc = document.createElement('div');
doc.className = "presItem-multiDrag";
- doc.innerText = "Move " + PresBox.Instance._selectedArray.length + " slides";
+ doc.innerText = "Move " + PresBox.Instance._selectedArray.size + " slides";
doc.style.position = 'absolute';
doc.style.top = (e.clientY) + 'px';
doc.style.left = (e.clientX - 50) + 'px';
@@ -226,8 +226,8 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc
@undoBatch
removeItem = action((e: React.MouseEvent) => {
this.props.removeDocument?.(this.rootDoc);
- if (PresBox.Instance._selectedArray.includes(this.rootDoc)) {
- PresBox.Instance._selectedArray.splice(PresBox.Instance._selectedArray.indexOf(this.rootDoc), 1);
+ if (PresBox.Instance._selectedArray.has(this.rootDoc)) {
+ PresBox.Instance._selectedArray.delete(this.rootDoc);
}
e.stopPropagation();
});
@@ -275,7 +275,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc
}
@computed get mainItem() {
- const isSelected: boolean = PresBox.Instance._selectedArray.includes(this.rootDoc);
+ const isSelected: boolean = PresBox.Instance._selectedArray.has(this.rootDoc);
const toolbarWidth: number = this.toolbarWidth;
const showMore: boolean = this.toolbarWidth >= 300;
const miniView: boolean = this.toolbarWidth <= 100;