diff options
author | Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> | 2022-07-06 15:57:21 -0700 |
---|---|---|
committer | Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> | 2022-07-06 15:57:21 -0700 |
commit | ab6aaa10e1ee4f465bf328e15e1f612fa94318d2 (patch) | |
tree | 1b17b0cf25d78fb2f1e29e63f252dfc8f5fb6073 | |
parent | a32633937d2978daa2cb1c6d4df89a58edb9ec97 (diff) |
edting -> editing
-rw-r--r-- | src/client/views/DocumentDecorations.tsx | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index 336ec9c83..9544c588b 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -50,7 +50,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P @observable private _accumulatedTitle = ''; @observable private _titleControlString: string = '#title'; - @observable private _edtingTitle = false; + @observable private _editingTitle = false; @observable private _hidden = false; @observable public AddToSelection = false; // if Shift is pressed, then this should be set so that clicking on the selection background is ignored so overlapped documents can be added to the selection set. @observable public Interacting = false; @@ -66,7 +66,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P DocumentDecorations.Instance = this; reaction( () => SelectionManager.Views().slice(), - action(docs => (this._edtingTitle = false)) + action(docs => (this._editingTitle = false)) ); } @@ -93,7 +93,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P @action titleBlur = () => { - this._edtingTitle = false; + this._editingTitle = false; if (this._accumulatedTitle.startsWith('#') || this._accumulatedTitle.startsWith('=')) { this._titleControlString = this._accumulatedTitle; } else if (this._titleControlString.startsWith('#')) { @@ -147,8 +147,8 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P e => this.onBackgroundMove(true, e), e => {}, action(e => { - !this._edtingTitle && (this._accumulatedTitle = this._titleControlString.startsWith('#') ? this.selectionTitle : this._titleControlString); - this._edtingTitle = true; + !this._editingTitle && (this._accumulatedTitle = this._titleControlString.startsWith('#') ? this.selectionTitle : this._titleControlString); + this._editingTitle = true; this._keyinput.current && setTimeout(this._keyinput.current.focus); }) ); @@ -320,12 +320,29 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P if (selectedInk.length) { angle && InkStrokeProperties.Instance.rotateInk(selectedInk, -angle, centerPoint); } else { - SelectionManager.Views().forEach(dv => (dv.rootDoc._jitterRotation = NumCast(dv.rootDoc._jitterRotation) - (angle * 180) / Math.PI)); + SelectionManager.Views().forEach(dv => { + const oldRotation = NumCast(dv.rootDoc._jitterRotation); + // Rotation between -360 and 360 + let newRotation = (oldRotation - (angle * 180) / Math.PI) % 360; + + const diff = Math.round(newRotation / 45) - newRotation / 45 + if (diff < .05) { + console.log('show lines'); + } + dv.rootDoc._jitterRotation = newRotation; + }); } return false; }, // moveEvent action(() => { - console.log('up') + SelectionManager.Views().forEach(dv => { + const oldRotation = NumCast(dv.rootDoc._jitterRotation); + const diff = Math.round(oldRotation / 45) - oldRotation / 45 + if (diff < .05) { + let newRotation = Math.round(oldRotation / 45) * 45; + dv.rootDoc._jitterRotation = newRotation; + } + }) this._isRotating = false; rotateUndo?.end(); UndoManager.FilterBatches(['data', 'x', 'y', 'width', 'height']); @@ -619,7 +636,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P ); const colorScheme = StrCast(CurrentUserUtils.ActiveDashboard?.colorScheme); - const titleArea = hideTitle ? null : this._edtingTitle ? ( + const titleArea = hideTitle ? null : this._editingTitle ? ( <input ref={this._keyinput} className={`documentDecorations-title${colorScheme}`} @@ -659,8 +676,6 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P const maxDist = Math.min((this.Bounds.r - this.Bounds.x) / 2, (this.Bounds.b - this.Bounds.y) / 2); const radiusHandle = (borderRadius / docMax) * maxDist; const radiusHandleLocation = Math.min(radiusHandle, maxDist); - const reachedMax:boolean = numbersAlmostEqual(radiusHandleLocation, maxDist); - console.log("reachedMax: ", reachedMax); return ( <div className={`documentDecorations${colorScheme}`}> <div @@ -719,7 +734,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P {useRounding && ( <div key="rad" style={{ - background: `${reachedMax === true ? Colors.ERROR_RED : undefined}`, + background: `${this._isRounding ? Colors.MEDIUM_BLUE : undefined}`, left:`${radiusHandleLocation + 3}`, top:`${radiusHandleLocation + 23}` }} className={`documentDecorations-borderRadius`} onPointerDown={this.onRadiusDown} onContextMenu={e => e.preventDefault()} |