aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocumentDecorations.tsx
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-05-15 15:05:57 -0400
committerbob <bcz@cs.brown.edu>2019-05-15 15:05:57 -0400
commitd79d721baa25947dfbbd17eda173835d9ae93fa6 (patch)
tree376b3d887db13bdd5b98ba5dc0023d03a0fc2c23 /src/client/views/DocumentDecorations.tsx
parentdae85deb62168cbfae4557aa8632896592d71cf9 (diff)
several smaller fixes.
Diffstat (limited to 'src/client/views/DocumentDecorations.tsx')
-rw-r--r--src/client/views/DocumentDecorations.tsx30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 627bedde2..8d85f7e2c 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -252,18 +252,20 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
if (!this._removeIcon) {
if (selectedDocs.length === 1)
this.getIconDoc(selectedDocs[0]).then(icon => selectedDocs[0].props.toggleMinimized());
- else {
- let docViews = SelectionManager.ViewsSortedVertically();
- let topDocView = docViews[0];
- let ind = topDocView.templates.indexOf(Templates.Bullet.Layout);
- if (ind !== -1) {
- topDocView.templates.splice(ind, 1);
- topDocView.props.Document.subBulletDocs = undefined;
- } else {
- topDocView.addTemplate(Templates.Bullet);
- topDocView.props.Document.subBulletDocs = new List<Doc>(docViews.filter(v => v !== topDocView).map(v => v.props.Document));
+ else
+ if (Math.abs(e.pageX - this._downX) < Utils.DRAG_THRESHOLD &&
+ Math.abs(e.pageY - this._downY) < Utils.DRAG_THRESHOLD) {
+ let docViews = SelectionManager.ViewsSortedVertically();
+ let topDocView = docViews[0];
+ let ind = topDocView.templates.indexOf(Templates.Bullet.Layout);
+ if (ind !== -1) {
+ topDocView.templates.splice(ind, 1);
+ topDocView.props.Document.subBulletDocs = undefined;
+ } else {
+ topDocView.addTemplate(Templates.Bullet);
+ topDocView.props.Document.subBulletDocs = new List<Doc>(docViews.filter(v => v !== topDocView).map(v => v.props.Document));
+ }
}
- }
}
this._removeIcon = false;
}
@@ -275,9 +277,9 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
let doc = selected[0].props.Document;
let iconDoc = Docs.IconDocument(layoutString);
iconDoc.isButton = true;
- iconDoc.title = selected.length > 1 ? "ICONset" : "ICON" + StrCast(doc.title);
- iconDoc.labelField = this._fieldKey;
- iconDoc[this._fieldKey] = selected.length > 1 ? "collection" : undefined;
+ iconDoc.proto!.title = selected.length > 1 ? "ICONset" : "ICON" + StrCast(doc.title);
+ iconDoc.labelField = selected.length > 1 ? undefined : this._fieldKey;
+ iconDoc.proto![this._fieldKey] = selected.length > 1 ? "collection" : undefined;
iconDoc.isMinimized = false;
iconDoc.width = Number(MINIMIZED_ICON_SIZE);
iconDoc.height = Number(MINIMIZED_ICON_SIZE);