Commit 21311018 authored by Elisabeth Reuhl's avatar Elisabeth Reuhl
Browse files

Timeline: correct circle and text positions

parent 9f95f291
......@@ -4,7 +4,7 @@ import React, {useEffect, useState} from "react";
export const ReturnTimelineObject = (props) => {
const { color, index, item, timespan, timespanIndex, whichTimespan, dispatch, input, itemHeight, adjustYPosition } = props;
const id = whichTimespan === "objectDating" ? item.itemId : item.periodIds[0];
const id = whichTimespan === "objectDating" ? item.itemId : item?.periodIds?.[0];
//TODO: rethink positioning stuff, it may be a bit unnecessarily complicated
const TLRectHeight = 20;
......@@ -75,8 +75,8 @@ export const ReturnTimelineObject = (props) => {
cx={timespan[0]}
cy={
adjustYPosition //whichTimespan === "objectDating"
? adjustYPosition * TLObjectHeight + spaceBetweenTLObjects + TLCircleHeight
: index * TLObjectHeight + spaceBetweenTLObjects + TLCircleHeight
? adjustYPosition * TLObjectHeight + (spaceBetweenTLObjects / 2) + (TLCircleHeight / 2)
: index * TLObjectHeight + (spaceBetweenTLObjects / 2) + (TLCircleHeight / 2)
}
r={itemHeight * TLCircleHeight}
fill={highlighted ? color.darker() : color}
......@@ -89,8 +89,8 @@ export const ReturnTimelineObject = (props) => {
<text
transform={`translate(${timespan[1]} ${
adjustYPosition //whichTimespan === "objectDating"
? index * TLObjectHeight + spaceBetweenTLObjects
: adjustYPosition * TLObjectHeight + spaceBetweenTLObjects
? adjustYPosition * TLObjectHeight + spaceBetweenTLObjects
: index * TLObjectHeight + spaceBetweenTLObjects
})`}
x="0"
y="0"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment