aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/MainOverlayTextBox.tsx
diff options
context:
space:
mode:
authorandrewdkim <adkim414@gmail.com>2019-09-15 17:00:46 -0400
committerandrewdkim <adkim414@gmail.com>2019-09-15 17:00:46 -0400
commit7dba132c37b0f4402e375d95c068a5fe31904a1f (patch)
treecd4ab0558f6b599cf685f99e542f24d86328e0cc /src/client/views/MainOverlayTextBox.tsx
parentc7678db105f952e7562f1b573266fb295e13cf7b (diff)
parent143d4669e764f6967d4d826b00b29912892ca637 (diff)
new changes + pull from master
Diffstat (limited to 'src/client/views/MainOverlayTextBox.tsx')
-rw-r--r--src/client/views/MainOverlayTextBox.tsx17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/client/views/MainOverlayTextBox.tsx b/src/client/views/MainOverlayTextBox.tsx
index b14a1e0ea..71fb2707d 100644
--- a/src/client/views/MainOverlayTextBox.tsx
+++ b/src/client/views/MainOverlayTextBox.tsx
@@ -2,7 +2,7 @@ import { action, observable, reaction, trace } from 'mobx';
import { observer } from 'mobx-react';
import "normalize.css";
import * as React from 'react';
-import { Doc } from '../../new_fields/Doc';
+import { Doc, DocListCast } from '../../new_fields/Doc';
import { BoolCast } from '../../new_fields/Types';
import { emptyFunction, returnTrue, returnZero, Utils, returnOne } from '../../Utils';
import { DragManager } from '../util/DragManager';
@@ -25,7 +25,6 @@ export class MainOverlayTextBox extends React.Component<MainOverlayTextBoxProps>
private _textTargetDiv: HTMLDivElement | undefined;
private _textProxyDiv: React.RefObject<HTMLDivElement>;
private _textBottom: boolean | undefined;
- private _textAutoHeight: boolean | undefined;
private _setouterdiv = (outerdiv: HTMLElement | null) => { this._outerdiv = outerdiv; this.updateTooltip(); };
private _outerdiv: HTMLElement | null = null;
private _textBox: FormattedTextBox | undefined;
@@ -42,7 +41,6 @@ export class MainOverlayTextBox extends React.Component<MainOverlayTextBoxProps>
return this._textBox && this._textBox.setFontColor(color);
}
-
constructor(props: MainOverlayTextBoxProps) {
super(props);
this._textProxyDiv = React.createRef();
@@ -59,7 +57,7 @@ export class MainOverlayTextBox extends React.Component<MainOverlayTextBoxProps>
let sxf = Utils.GetScreenTransform(box ? box.CurrentDiv : undefined);
return new Transform(-sxf.translateX, -sxf.translateY, 1 / sxf.scale);
};
- this.setTextDoc(box.props.fieldKey, box.CurrentDiv, xf, BoolCast(box.props.Document.autoHeight, false) || box.props.height === "min-content");
+ this.setTextDoc(box.props.fieldKey, box.CurrentDiv, xf, BoolCast(box.props.Document.autoHeight) || box.props.height === "min-content");
}
else {
this.TextDoc = undefined;
@@ -74,7 +72,6 @@ export class MainOverlayTextBox extends React.Component<MainOverlayTextBoxProps>
if (this._textTargetDiv) {
this._textTargetDiv.style.color = this._textColor;
}
- this._textAutoHeight = autoHeight;
this.TextFieldKey = textFieldKey!;
let txf = tx ? tx : () => Transform.Identity();
this._textXf = txf;
@@ -131,10 +128,11 @@ export class MainOverlayTextBox extends React.Component<MainOverlayTextBoxProps>
this.TextDoc; this.TextDataDoc;
if (FormattedTextBox.InputBoxOverlay && this._textTargetDiv) {
let wid = FormattedTextBox.InputBoxOverlay.props.Document.width; // need to force overlay to render when underlying text box is resized (eg, w/ DocDecorations)
+ let hgtx = FormattedTextBox.InputBoxOverlay.props.Document.height; // need to force overlay to render when underlying text box is resized (eg, w/ DocDecorations)
let textRect = this._textTargetDiv.getBoundingClientRect();
let s = this._textXf().Scale;
let location = this._textBottom ? textRect.bottom : textRect.top;
- let hgt = this._textAutoHeight || this._textBottom ? "auto" : this._textTargetDiv.clientHeight;
+ let hgt = (this._textBox && this._textBox.props.Document.autoHeight) || this._textBottom ? "auto" : this._textTargetDiv.clientHeight;
return <div ref={this._setouterdiv} className="mainOverlayTextBox-unscaled_div" style={{ transform: `translate(${textRect.left}px, ${location}px)` }} >
<div className="mainOverlayTextBox-textInput" style={{ transform: `scale(${1 / s})`, width: "auto", height: "0px" }} >
<div className="mainOverlayTextBox-textInput" onPointerDown={this.textBoxDown} ref={this._textProxyDiv} onScroll={this.textScroll}
@@ -144,9 +142,12 @@ export class MainOverlayTextBox extends React.Component<MainOverlayTextBoxProps>
Document={FormattedTextBox.InputBoxOverlay.props.Document}
DataDoc={FormattedTextBox.InputBoxOverlay.props.DataDoc}
onClick={undefined}
- isSelected={returnTrue} select={emptyFunction} renderDepth={0} selectOnLoad={true}
+ ruleProvider={this._textBox ? this._textBox.props.ruleProvider : undefined}
+ ChromeHeight={this.ChromeHeight}
+ isSelected={returnTrue} select={emptyFunction} renderDepth={0}
ContainingCollectionView={undefined} whenActiveChanged={emptyFunction} active={returnTrue} ContentScaling={returnOne}
- ScreenToLocalTransform={this._textXf} PanelWidth={returnZero} PanelHeight={returnZero} focus={emptyFunction} addDocTab={this.addDocTab} outer_div={(tooltip: HTMLElement) => { this._tooltip = tooltip; this.updateTooltip(); }} />
+ ScreenToLocalTransform={this._textXf} PanelWidth={returnZero} PanelHeight={returnZero} focus={emptyFunction}
+ pinToPres={returnZero} addDocTab={this.addDocTab} outer_div={(tooltip: HTMLElement) => { this._tooltip = tooltip; this.updateTooltip(); }} />
</div>
</div>
</div>