aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-05-01 11:33:44 -0400
committerbob <bcz@cs.brown.edu>2019-05-01 11:33:44 -0400
commita419ad773840611e6f1c43f892cb0ffab748f1e2 (patch)
tree2fb44a0884c286ec5802700b4e6d1c6d04b07202 /src
parentd6ecb1cabeb34b5e55bc107f308f63071e4c40f7 (diff)
fixed icon opacity
Diffstat (limited to 'src')
-rw-r--r--src/client/documents/Documents.ts1
-rw-r--r--src/client/views/DocumentDecorations.tsx18
-rw-r--r--src/client/views/nodes/CollectionFreeFormDocumentView.tsx2
3 files changed, 11 insertions, 10 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index d9ee7a736..ca25744af 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -125,7 +125,6 @@ export namespace Docs {
function CreateIconPrototype(): Doc {
let iconProto = setupPrototypeOptions(iconProtoId, "ICON_PROTO", IconBox.LayoutString(),
{ x: 0, y: 0, width: Number(MINIMIZED_ICON_SIZE), height: Number(MINIMIZED_ICON_SIZE) });
- console.log("iconpr" + iconProto.layout)
return iconProto;
}
function CreateTextPrototype(): Doc {
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 2a6d72dbc..a6c7f9718 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -24,6 +24,7 @@ export const Flyout = higflyout.default;
import { faLink } from '@fortawesome/free-solid-svg-icons';
import { library } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { MINIMIZED_ICON_SIZE } from "../views/globalCssVariables.scss";
library.add(faLink);
@@ -232,13 +233,14 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
let iconDoc = Docs.IconDocument(layoutString);
iconDoc.title = "ICON" + StrCast(doc.title);
iconDoc.isMinimized = false;
- iconDoc.nativeWidth = 0;
- iconDoc.nativeHeight = 0;
+ iconDoc.nativeWidth = Number(MINIMIZED_ICON_SIZE);
+ iconDoc.nativeHeight = Number(MINIMIZED_ICON_SIZE);
+ iconDoc.width = Number(MINIMIZED_ICON_SIZE);
+ iconDoc.height = Number(MINIMIZED_ICON_SIZE);
iconDoc.x = NumCast(doc.x);
iconDoc.y = NumCast(doc.y) - 24;
iconDoc.maximizedDoc = doc;
doc.minimizedDoc = iconDoc;
- console.log("Layout " + iconDoc.layout);
docView.props.addDocument && docView.props.addDocument(iconDoc, false);
return iconDoc;
}
@@ -247,13 +249,13 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
let doc = docView.props.Document;
let iconDoc: Doc | undefined = await Cast(doc.minimizedDoc, Doc);
if (!iconDoc) {
- const field = StrCast(doc.backgroundLayout, undefined);
- if (field !== undefined) {
- iconDoc = this.createIcon(docView, field);
+ const background = StrCast(doc.backgroundLayout, undefined);
+ if (background) {
+ iconDoc = this.createIcon(docView, background);
} else {
const layout = StrCast(doc.layout, undefined);
- if (layout !== undefined) {
- iconDoc = this.createIcon(docView, field);
+ if (layout) {
+ iconDoc = this.createIcon(docView, layout);
}
}
}
diff --git a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
index 56c2a80fa..b43571eb0 100644
--- a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
+++ b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
@@ -172,7 +172,7 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
let [bptX, bptY] = transform.transformPoint(this.props.PanelWidth(), this.props.PanelHeight());
let w = bptX - sptX;
//zoomFade = area < 100 || area > 800 ? Math.max(0, Math.min(1, 2 - 5 * (zoom < this.scale ? this.scale / zoom : zoom / this.scale))) : 1;
- const screenWidth = 1800;
+ const screenWidth = Math.min(50 * NumCast(this.props.Document.nativeWidth, 0), 1800);
let fadeUp = .75 * screenWidth;
let fadeDown = (maximizedDoc ? .0075 : .075) * screenWidth;
zoomFade = w < fadeDown /* || w > fadeUp */ ? Math.max(0.1, Math.min(1, 2 - (w < fadeDown ? fadeDown / w : w / fadeUp))) : 1;