aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-11-30 13:38:35 -0500
committerbobzel <zzzman@gmail.com>2022-11-30 13:38:35 -0500
commit9d88adb19c2caf715b56c5ed40a500b9ef1491aa (patch)
tree47673cf07195e6b6ffe00b209ee10f04e22ffe61
parentae8e487fbf7a5e662a04c14e805041bbdf49c87d (diff)
fixed link properties for link anchors to set fields affecting target, not source.
-rw-r--r--src/client/views/PropertiesView.tsx40
1 files changed, 12 insertions, 28 deletions
diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx
index 05dd376f2..3e199919e 100644
--- a/src/client/views/PropertiesView.tsx
+++ b/src/client/views/PropertiesView.tsx
@@ -4,7 +4,7 @@ import { faAnchor, faArrowRight } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Checkbox, Tooltip } from '@material-ui/core';
import { intersection } from 'lodash';
-import { action, autorun, computed, Lambda, observable, trace } from 'mobx';
+import { action, autorun, computed, Lambda, observable } from 'mobx';
import { observer } from 'mobx-react';
import { ColorState, SketchPicker } from 'react-color';
import { AclAdmin, AclAugment, AclEdit, AclPrivate, AclReadonly, AclSelfEdit, AclSym, AclUnset, DataSym, Doc, DocListCast, Field, HeightSym, NumListCast, Opt, StrListCast, WidthSym } from '../../fields/Doc';
@@ -23,6 +23,7 @@ import { SharingManager } from '../util/SharingManager';
import { Transform } from '../util/Transform';
import { undoBatch, UndoManager } from '../util/UndoManager';
import { EditableView } from './EditableView';
+import { Colors } from './global/globalEnums';
import { InkStrokeProperties } from './InkStrokeProperties';
import { DocumentView, OpenWhere, StyleProviderFunc } from './nodes/DocumentView';
import { FilterBox } from './nodes/FilterBox';
@@ -33,7 +34,6 @@ import { PropertiesDocBacklinksSelector } from './PropertiesDocBacklinksSelector
import { PropertiesDocContextSelector } from './PropertiesDocContextSelector';
import './PropertiesView.scss';
import { DefaultStyleProvider } from './StyleProvider';
-import { Colors } from './global/globalEnums';
const higflyout = require('@hig/flyout');
export const { anchorPoints } = higflyout;
export const Flyout = higflyout.default;
@@ -1409,44 +1409,28 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
});
@undoBatch
- changeAnimationBehavior = action((behavior: string) => {
- const lanch = this.sourceAnchor;
- if (lanch) {
- lanch.presEffect = behavior;
- }
- });
+ changeFollowBehavior = action((follow: string) => this.selectedDoc && (this.selectedDoc.followLinkLocation = follow));
+
@undoBatch
- @action
- updateEffectDirection = (effect: PresEffectDirection) => {
- const lanch = this.sourceAnchor;
- if (lanch) {
- lanch.presEffectDirection = effect;
- }
- };
+ changeAnimationBehavior = action((behavior: string) => this.destinationAnchor && (this.destinationAnchor.presEffect = behavior);
@undoBatch
+ changeEffectDirection = action((effect: PresEffectDirection) => this.destinationAnchor && (this.destinationAnchor.presEffectDirection = effect);
+
animationDirection = (direction: PresEffectDirection, icon: string, gridColumn: number, gridRow: number, opts: object) => {
- const lanch = this.sourceAnchor;
+ const lanch = this.destinationAnchor;
const color = lanch?.presEffectDirection === direction || (direction === PresEffectDirection.Center && !lanch?.presEffectDirection) ? Colors.MEDIUM_BLUE : '';
return (
<Tooltip title={<div className="dash-tooltip">{direction}</div>}>
<div
style={{ ...opts, border: direction === PresEffectDirection.Center ? `solid 2px ${color}` : undefined, borderRadius: '20%', cursor: 'pointer', gridColumn, gridRow, justifySelf: 'center', background: color, color: 'black' }}
- onClick={() => this.updateEffectDirection(direction)}>
+ onClick={() => this.changeEffectDirection(direction)}>
{icon ? <FontAwesomeIcon icon={icon as any} /> : null}
</div>
</Tooltip>
);
};
- @undoBatch
- changeFollowBehavior = action((follow: string) => {
- if (LinkManager.currentLink && this.selectedDoc) {
- this.selectedDoc.followLinkLocation = follow;
- return true;
- }
- });
-
onSelectOutDesc = () => {
this.setDescripValue(this.description);
document.getElementById('link_description_input')?.blur();
@@ -1637,7 +1621,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
</div>
<div className="propertiesView-input inline first" style={{ display: 'grid', gridTemplateColumns: '84px calc(100% - 134px) 50px' }}>
<p>Animation</p>
- <select style={{ width: '100%', gridColumn: 2 }} onChange={e => this.changeAnimationBehavior(e.currentTarget.value)} value={StrCast(this.sourceAnchor?.presEffect, 'default')}>
+ <select style={{ width: '100%', gridColumn: 2 }} onChange={e => this.changeAnimationBehavior(e.currentTarget.value)} value={StrCast(this.destinationAnchor?.presEffect, 'default')}>
<option value="default">Default</option>
{[PresEffect.None, PresEffect.Zoom, PresEffect.Lightspeed, PresEffect.Fade, PresEffect.Flip, PresEffect.Rotate, PresEffect.Bounce, PresEffect.Roll].map(effect => (
<option value={effect.toString()}>{effect.toString()}</option>
@@ -1655,9 +1639,9 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
'0.1',
'0.1',
'10',
- NumCast(this.sourceAnchor?.presTransition) / 1000,
+ NumCast(this.destinationAnchor?.presTransition) / 1000,
true,
- (val: string) => PresBox.SetTransitionTime(val, (timeInMS: number) => this.sourceAnchor && (this.sourceAnchor.presTransition = timeInMS)),
+ (val: string) => PresBox.SetTransitionTime(val, (timeInMS: number) => this.destinationAnchor && (this.destinationAnchor.presTransition = timeInMS)),
indent
)}{' '}
<div