Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotations redesign #27

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c04e531
Changed save to absolute position so doesn't interfere with annotatio…
jessp Apr 27, 2016
d51deb4
Restyled classes and added 100% height to container divs so that we c…
jessp Apr 27, 2016
b3fea00
Altered CSS so height of svg is no longer contingent on windowsize at…
jessp Apr 27, 2016
9d00fce
undid a dumb change I did for testing
jessp Apr 27, 2016
7af956f
Moved 'New Annotation' button to form so only list will be scrollable
jessp Apr 27, 2016
ce07fef
Changed to flexbox -- will revert to alternative or use shim dependin…
jessp Apr 28, 2016
4c1c4f2
minor changes
jessp Apr 29, 2016
f43f3b9
Still broken, but less so
jessp May 1, 2016
2b34b79
Drag and drop no longer broken but ugly, other changes in progress.
jessp May 2, 2016
d517fdd
Slowly making changes
jessp May 3, 2016
b50f05d
Drag and drop seems to be working though may rework the codde
jessp May 3, 2016
5949c07
Figuring out how to move editing functions directly into annotation list
jessp May 3, 2016
9d676d5
comparing to master
jessp May 3, 2016
ef33a85
Modied annotation lis to have annotation body and to 'show' properly
jessp May 3, 2016
2c836f2
updated styling
jessp May 4, 2016
51119c7
Working on functions + removed no longer user toggleEditor function
jessp May 5, 2016
ffac399
figuring out redux
jessp May 5, 2016
1750b05
Working on redux functions
jessp May 6, 2016
5bdaae5
toggling edit annotations mode seems to work
jessp May 10, 2016
d92eb40
lied, still was much to to
jessp May 11, 2016
cb463b5
fixed some issues with toggling between annotation mode and edit mode
jessp May 12, 2016
6931b64
continuing annotations revamp
jessp May 17, 2016
7ba3a47
added new annotations, reworking margins
jessp May 19, 2016
5e25b8f
margins edited, tests to come
jessp May 19, 2016
33c152f
reverted from flexbox layout to keep button positioning the same
jessp May 19, 2016
f2971db
fixed bug where clicking nodes turned off editing styles
jessp May 23, 2016
8e3ae8b
Integrating medium editor, updated medium editor and anchor seems buggy
jessp May 24, 2016
b454a93
seems like anchor editor is broken in master branch as well. removing…
jessp May 24, 2016
d7f37e5
changing highlights based on edit mode
jessp May 24, 2016
76d2712
colour of node highlight changes based on mode, made tweaks based on …
jessp May 24, 2016
c953104
removed GraphAnnotationForm.jsx as capabilities implemented in GraphA…
jessp May 24, 2016
ab8db50
removed references to GraphAnnotationForm.jsx and styles
jessp May 24, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015", "react"]
}
2 changes: 0 additions & 2 deletions .buildpacks

This file was deleted.

34 changes: 0 additions & 34 deletions .eslintrc

This file was deleted.

13 changes: 0 additions & 13 deletions .tern-project

This file was deleted.

4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: node_js

node_js:
- "6.0.0"
3 changes: 2 additions & 1 deletion app/CaptionDisplaySettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ module.exports = {
selectFillColor: "#0f0",
textOpacity: {
"normal": 1,
"editable": 1,
"highlighted": 1,
"faded": 0.2
"faded": 0.5
},
highlightOpacity: 0.5,
selectOpacity: 0.5
Expand Down
8 changes: 6 additions & 2 deletions app/EdgeDisplaySettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@ module.exports = {
curveStrength: 0.5,
lineColor: {
normal: "#999",
editable: "#999",
highlighted: "#999",
faded: "#ddd"
faded: "#aaa"
},
textColor: {
normal: "#999",
editable: "#444",
highlighted: "#444",
faded: "#ddd"
faded: "#aaa"
},
bgColor: {
normal: "#fff",
editable: "#ff9800",
highlighted: "#ff0",
faded: "#fff"
},
selectColor: "#0f0",
bgOpacity: {
normal: 0,
editable: 0.5,
highlighted: 0.5,
faded: 0
},
Expand Down
15 changes: 11 additions & 4 deletions app/NodeDisplaySettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,46 @@ module.exports = {
cornerRadius: 5,
circleColor: {
normal: "#ccc",
editable: "#ccc",
highlighted: "#ccc",
faded: "#ccc"
},
textColor: {
normal: "#000",
editable: "#000",
highlighted: "#000",
faded: "#000"
},
textOpacity: {
normal: 1,
editable: 1,
highlighted: 1,
faded: 0.2
faded: 0.5
},
bgColor: {
normal: "#fff",
editable: "#ff9800",
highlighted: "#ff0",
faded: "#fff"
},
selectColor: "#0f0",
bgOpacity: {
normal: 0,
highlighted: 0.5,
editable: 0.75,
highlighted: 0.75,
faded: 0
},
imageOpacity: {
normal: 1,
editable: 1,
highlighted: 1,
faded: 0.2
faded: 0.5
},
circleOpacity: {
normal: 1,
editable: 1,
highlighted: 1,
faded: 0.2
faded: 0.5
},
bgRadiusDiff: 4,
selectionRadiusDiff: 10
Expand Down
9 changes: 7 additions & 2 deletions app/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const SET_TITLE = 'SET_TITLE';
export const SET_SETTINGS = 'SET_SETTINGS';
export const TOGGLE_HELP_SCREEN = 'TOGGLE_HELP_SCREEN';
export const TOGGLE_SETTINGS = 'TOGGLE_SETTINGS';
export const TOGGLE_NODE_SELECTABLE = 'TOGGLE_NODE_SELECTABLE';

/*
* action creators
Expand Down Expand Up @@ -184,8 +185,8 @@ export function layoutCircle() {
return { type: LAYOUT_CIRCLE };
}

export function setHighlights(highlights, otherwiseFaded = false) {
return { type: SET_HIGHLIGHTS, highlights, otherwiseFaded };
export function setHighlights(highlights, otherwiseFaded = false, showEditTools, allowEditNodes) {
return { type: SET_HIGHLIGHTS, highlights, otherwiseFaded, showEditTools, allowEditNodes };
}

export function clearHighlights() {
Expand Down Expand Up @@ -247,4 +248,8 @@ export function toggleHelpScreen(value) {

export function toggleSettings(value) {
return { type: TOGGLE_SETTINGS, value };
}

export function toggleNodeSelectable(value) {
return { type: TOGGLE_NODE_SELECTABLE, value };
}
12 changes: 6 additions & 6 deletions app/components/ChangeColorInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ export default class ChangeColorInput extends BaseComponent {

render() {
return (
<div id= "nodeColorInputWrapper">
<div id="swatch" className="input-sm form-control">
<div id="color" style={{background: this.state.color }} onClick={ this.handleClick }/>
<button id="nodeColorInputClearer" onClick={ this.handleClearClick }>
<div className="nodeColorInputWrapper">
<div className="input-sm form-control nodeColorInput">
<div className="nodeColorInputSwatch" style={{ background: this.state.color }} onClick={ this.handleClick }/>
<button className="nodeColorInputClearer" onClick={ this.handleClearClick }>
<span className="glyphicon glyphicon-remove-sign"></span>
</button>
</div>
<div id= "nodeColorPickerWrapper">
<div className="nodeColorPickerWrapper">
{ this.state.displayColorPicker &&
<div is="popover">
<div is="cover" onClick={ this.handleClose }/>
<div className="nodeColorPickerCover" onClick={ this.handleClose }/>
<CompactPicker color={ this.state.color } onChange={ this.handleValueChange } />
</div>
}
Expand Down
5 changes: 3 additions & 2 deletions app/components/Edge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default class Edge extends BaseComponent {
let width = 1 + (e.display.scale - 1) * 5;
let selected = this.props.selected;
let highlighted = e.display.status == "highlighted";
let editable = e.display.status == "editable";

return (
<DraggableCore
Expand All @@ -30,15 +31,15 @@ export default class Edge extends BaseComponent {
onStart={this._handleDragStart}
onDrag={this._handleDrag}
onStop={this._handleDragStop}>
<g id={sp.groupId} className={classNames({ edge: true, selected, highlighted })}>
<g id={sp.groupId} className={classNames({ edge: true, selected, highlighted, editable })}>
{ selected ? <path
className="edge-selection"
d={sp.curve}
stroke={eds.selectColor}
strokeOpacity={eds.selectOpacity}
strokeWidth={width + eds.selectWidthDiff}
fill="none"></path> : null }
{ highlighted ? <path
{ (highlighted || editable) ? <path
className="edge-background"
d={sp.curve}
stroke={sp.bgColor}
Expand Down
4 changes: 4 additions & 0 deletions app/components/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ require('../styles/bootstrap-3.3.6.css');
require('../styles/oligrapher.editor.css');

export default class Editor extends BaseComponent {
constructor(props) {
super(props);
this.state = { helpScreen: false };
}

render() {
let zoomIn, zoomOut, resetZoom;
Expand Down
19 changes: 10 additions & 9 deletions app/components/Graph.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ export default class Graph extends BaseComponent {
this.nodes = {};
this.edges = {};
this.mounted = false;
let viewBox = this._computeViewbox(props.graph, props.zoom);
let viewBox = this._computeViewbox(props.graph, props.zoom, props.viewOnlyHighlighted);
this.state = { x: 0, y: 0, viewBox, height: props.height };
}

render() {
let { x, y, prevGraph, viewBox, height } = this.state;

return (
<svg id="svg" version="1.1" xmlns="http://www.w3.org/2000/svg" className="Graph" width="100%" height={height} viewBox={viewBox} preserveAspectRatio="xMidYMid">
<svg id="svg" version="1.1" xmlns="http://www.w3.org/2000/svg" className="Graph" width="100%" height="100%" viewBox={viewBox} preserveAspectRatio="xMidYMid">
<DraggableCore
handle="#zoom-handle"
moveOnStartChange={false}
Expand All @@ -53,7 +53,7 @@ export default class Graph extends BaseComponent {
}

componentWillReceiveProps(nextProps) {
this._updateViewbox(nextProps.graph, nextProps.zoom);
this._updateViewbox(nextProps.graph, nextProps.zoom, nextProps.viewOnlyHighlighted);
}

// RENDERING
Expand Down Expand Up @@ -83,7 +83,9 @@ export default class Graph extends BaseComponent {
selected={this.props.selection && includes(this.props.selection.nodeIds, n.id)}
clickNode={this.props.clickNode}
moveNode={this.props.moveNode}
isLocked={this.props.isLocked} />);
isLocked={this.props.isLocked}
showEditTools={this.props.showEditTools}
allowEditNodes={this.props.allowEditNodes} />);
}

_renderCaptions() {
Expand All @@ -105,8 +107,8 @@ export default class Graph extends BaseComponent {

// VIEWBOX AND ZOOM

_updateViewbox(graph, zoom) {
let viewBox = this._computeViewbox(graph, zoom);
_updateViewbox(graph, zoom, viewOnlyHighlighted) {
let viewBox = this._computeViewbox(graph, zoom, viewOnlyHighlighted);
let changed = (viewBox !== this.state.viewBox);
let oldViewBox = changed ? this.state.viewBox : null;
this.setState({ viewBox, oldViewBox });
Expand All @@ -130,9 +132,8 @@ export default class Graph extends BaseComponent {
}
}

_computeViewbox(graph, zoom = 1.2) {
let onlyHighlighted = this.props.viewOnlyHighlighted;
let rect = this._computeRect(graph, onlyHighlighted);
_computeViewbox(graph, zoom = 1, viewOnlyHighlighted = true) {
let rect = this._computeRect(graph, viewOnlyHighlighted);
let w = rect.w / zoom;
let h = rect.h / zoom;
let x = rect.x + rect.w/2 - (w/2);
Expand Down
85 changes: 0 additions & 85 deletions app/components/GraphAnnotationForm.jsx

This file was deleted.

Loading