aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/trails
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-12-08 10:08:33 -0500
committerbobzel <zzzman@gmail.com>2022-12-08 10:08:33 -0500
commit52a435b09013619209b8bcc6758baeca47d5d350 (patch)
tree0b8f24da5b18a5f5436c18b952c02fa2e03a91be /src/client/views/nodes/trails
parent4d10925f535f3d2c09ab4fa01de83897cc13fc43 (diff)
cleaned up animation effects to not reference presBox. fixed anchors in text to have link properties set properly from properties view.
Diffstat (limited to 'src/client/views/nodes/trails')
-rw-r--r--src/client/views/nodes/trails/PresBox.tsx45
1 files changed, 13 insertions, 32 deletions
diff --git a/src/client/views/nodes/trails/PresBox.tsx b/src/client/views/nodes/trails/PresBox.tsx
index 2694cb350..e0f64e7aa 100644
--- a/src/client/views/nodes/trails/PresBox.tsx
+++ b/src/client/views/nodes/trails/PresBox.tsx
@@ -1,11 +1,10 @@
import React = require('react');
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Tooltip } from '@material-ui/core';
-import { action, computed, IReactionDisposer, observable, ObservableSet, reaction, runInAction } from 'mobx';
+import { action, computed, IReactionDisposer, observable, ObservableSet, observe, reaction, runInAction } from 'mobx';
import { observer } from 'mobx-react';
import { ColorState, SketchPicker } from 'react-color';
-import { Bounce, Fade, Flip, LightSpeed, Roll, Rotate, Zoom } from 'react-reveal';
-import { Doc, DocListCast, FieldResult, Opt, StrListCast } from '../../../../fields/Doc';
+import { AnimationSym, Doc, DocListCast, FieldResult, HighlightSym, Opt, StrListCast } from '../../../../fields/Doc';
import { Copy, Id } from '../../../../fields/FieldSymbols';
import { InkTool } from '../../../../fields/InkField';
import { List } from '../../../../fields/List';
@@ -64,36 +63,8 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
return FieldView.LayoutString(PresBox, fieldKey);
}
- /**
- * returns an entrance animation effect function to wrap a JSX element
- * @param presEffectDoc presentation effects document that specifies the animation effect parameters
- * @returns a function that will wrap a JSX animation element wrapping any JSX element
- */
- public static AnimationEffect(renderDoc: JSX.Element, presEffectDoc: Opt<Doc>, root: Doc) {
- const effectProps = {
- left: presEffectDoc?.presEffectDirection === PresEffectDirection.Left,
- right: presEffectDoc?.presEffectDirection === PresEffectDirection.Right,
- top: presEffectDoc?.presEffectDirection === PresEffectDirection.Top,
- bottom: presEffectDoc?.presEffectDirection === PresEffectDirection.Bottom,
- opposite: true,
- delay: 0,
- duration: Cast(presEffectDoc?.presTransition, 'number', null),
- };
- //prettier-ignore
- switch (StrCast(presEffectDoc?.presEffect)) {
- default:
- case PresEffect.None: return renderDoc;
- case PresEffect.Zoom: return <Zoom {...effectProps}>{renderDoc}</Zoom>;
- case PresEffect.Fade: return <Fade {...effectProps}>{renderDoc}</Fade>;
- case PresEffect.Flip: return <Flip {...effectProps}>{renderDoc}</Flip>;
- case PresEffect.Rotate: return <Rotate {...effectProps}>{renderDoc}</Rotate>;
- case PresEffect.Bounce: return <Bounce {...effectProps}>{renderDoc}</Bounce>;
- case PresEffect.Roll: return <Roll {...effectProps}>{renderDoc}</Roll>;
- case PresEffect.Lightspeed: return <LightSpeed {...effectProps}>{renderDoc}</LightSpeed>;
- }
- }
-
private _disposers: { [name: string]: IReactionDisposer } = {};
+ private _obDisposers: { [name: string]: any } = {};
public selectedArray = new ObservableSet<Doc>();
@observable public static Instance: PresBox;
@@ -170,10 +141,20 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
// Turn of progressivize editors
this.turnOffEdit(true);
Object.values(this._disposers).forEach(disposer => disposer?.());
+ Object.values(this._obDisposers).forEach(disposer => disposer?.());
}
@action
componentDidMount() {
+ this._obDisposers.anim = observe(
+ this,
+ 'activeItem',
+ change => {
+ change.oldValue && (DocCast((change.oldValue as Doc).presentationTargetDoc)[AnimationSym] = undefined);
+ change.newValue && (DocCast((change.newValue as Doc).presentationTargetDoc)[AnimationSym] = change.newValue as Doc);
+ },
+ true
+ );
this._disposers.keyboard = reaction(
() => this.selectedDoc,
selected => {