From e8938d5d7b889551c1d32bcf5385e369ed67cea5 Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 7 Apr 2022 14:42:11 -0400 Subject: fixed iconizing images to not get the wrong height because of templates. fixed cross-fade of images to work without needing doc to be selected. --- src/client/views/nodes/DocumentView.tsx | 8 +++++++- src/client/views/nodes/ImageBox.scss | 16 +++++++--------- src/client/views/nodes/ImageBox.tsx | 18 +++++++++--------- 3 files changed, 23 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index a9abf066e..103c3624d 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -111,6 +111,7 @@ export interface DocumentViewSharedProps { ContainingCollectionView: Opt; ContainingCollectionDoc: Opt; thumbShown?: () => boolean; + isHovering?: () => boolean; setContentView?: (view: DocComponentView) => any; CollectionFreeFormDocumentView?: () => CollectionFreeFormDocumentView; PanelWidth: () => number; @@ -873,6 +874,7 @@ export class DocumentViewInternal extends DocComponent {this.layoutDoc.hideAllLinks ? (null) : this.allLinkEndpoints} - {this.hideLinkButton || this.props.renderDepth === -1 || SnappingManager.GetIsDragging() ? (null) : + {!this.props.isSelected() || this.hideLinkButton || this.props.renderDepth === -1 || SnappingManager.GetIsDragging() ? (null) : @@ -1065,6 +1067,8 @@ export class DocumentViewInternal extends DocComponent; } + isHovering = () => this._isHovering; + @observable _isHovering = false; @observable _: string = ""; @computed get renderDoc() { TraceMobx(); @@ -1074,6 +1078,8 @@ export class DocumentViewInternal extends DocComponent this._isHovering = true)} + onPointerLeave={action(() => this._isHovering = false)} style={{ background: isButton || thumb ? undefined : this.backgroundColor, opacity: this.opacity, diff --git a/src/client/views/nodes/ImageBox.scss b/src/client/views/nodes/ImageBox.scss index 4238f6d29..cd2b23f02 100644 --- a/src/client/views/nodes/ImageBox.scss +++ b/src/client/views/nodes/ImageBox.scss @@ -103,7 +103,7 @@ display: flex; height: 100%; - .imageBox-fadeBlocker { + .imageBox-fadeBlocker, .imageBox-fadeBlocker-hover{ width: 100%; height: 100%; position: absolute; @@ -133,12 +133,10 @@ transition: opacity 1s ease-in-out; } -.imageBox:hover { - .imageBox-fadeBlocker { - -webkit-transition: opacity 1s ease-in-out; - -moz-transition: opacity 1s ease-in-out; - -o-transition: opacity 1s ease-in-out; - transition: opacity 1s ease-in-out; - opacity: 0; - } +.imageBox-fadeBlocker-hover { + -webkit-transition: opacity 1s ease-in-out; + -moz-transition: opacity 1s ease-in-out; + -o-transition: opacity 1s ease-in-out; + transition: opacity 1s ease-in-out; + opacity: 0; } \ No newline at end of file diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index 0a4168698..17f95c1cc 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -45,7 +45,6 @@ const uploadIcons = { export class ImageBox extends ViewBoxAnnotatableComponent() { protected _multiTouchDisposer?: import("../../util/InteractionUtils").InteractionUtils.MultiTouchEventDisposer | undefined; public static LayoutString(fieldKey: string) { return FieldView.LayoutString(ImageBox, fieldKey); } - private _imgRef: React.RefObject = React.createRef(); private _dropDisposer?: DragManager.DragDropDisposer; private _disposers: { [name: string]: IReactionDisposer } = {}; @observable _curSuffix = ""; @@ -78,7 +77,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent ({ nativeSize: this.nativeSize, width: this.layoutDoc[WidthSym]() }), ({ nativeSize, width }) => { - if (!this.layoutDoc._height) { + if (true || !this.layoutDoc._height) { this.layoutDoc._height = width * nativeSize.nativeHeight / nativeSize.nativeWidth; } }, @@ -282,17 +281,18 @@ export class ImageBox extends ViewBoxAnnotatableComponent
- - {fadepath === srcpath ? (null) :
- -
} + {fadepath === srcpath ? (null) : +
+ +
}
{this.considerDownloadIcon} {this.considerGooglePhotosLink()} -- cgit v1.2.3-70-g09d2