Added 'clickable' class to all elements with interactivity. This allows css styling for clickable elements

This commit is contained in:
abzicht
2019-03-09 20:08:52 +01:00
parent 10057217cb
commit 4587f5a73d
2 changed files with 27 additions and 9 deletions

View File

@@ -142,6 +142,11 @@ export const draw = function (text, id) {
.attr('class', function (d) { .attr('class', function (d) {
const res = 'task ' const res = 'task '
let classStr = ''
if (d.classes.length > 0) {
classStr = d.classes.join(' ')
}
let secNum = 0 let secNum = 0
for (let i = 0; i < categories.length; i++) { for (let i = 0; i < categories.length; i++) {
if (d.type === categories[i]) { if (d.type === categories[i]) {
@@ -151,25 +156,25 @@ export const draw = function (text, id) {
if (d.active) { if (d.active) {
if (d.crit) { if (d.crit) {
return res + ' activeCrit' + secNum return res + classStr + ' activeCrit' + secNum
} else { } else {
return res + ' active' + secNum return res + classStr + ' active' + secNum
} }
} }
if (d.done) { if (d.done) {
if (d.crit) { if (d.crit) {
return res + ' doneCrit' + secNum return res + classStr + ' doneCrit' + secNum
} else { } else {
return res + ' done' + secNum return res + classStr + ' done' + secNum
} }
} }
if (d.crit) { if (d.crit) {
return res + ' crit' + secNum return res + classStr + ' crit' + secNum
} }
return res + ' task' + secNum return res + classStr + ' task' + secNum
}) })
rectangles.append('a').attr('href', function (d) { rectangles.append('a').attr('href', function (d) {
@@ -206,6 +211,13 @@ export const draw = function (text, id) {
const startX = timeScale(d.startTime) const startX = timeScale(d.startTime)
const endX = timeScale(d.endTime) const endX = timeScale(d.endTime)
const textWidth = this.getBBox().width const textWidth = this.getBBox().width
let classStr = ''
if (d.classes.length > 0) {
classStr = d.classes.join(' ')
}
let secNum = 0 let secNum = 0
for (let i = 0; i < categories.length; i++) { for (let i = 0; i < categories.length; i++) {
if (d.type === categories[i]) { if (d.type === categories[i]) {
@@ -237,12 +249,12 @@ export const draw = function (text, id) {
// Check id text width > width of rectangle // Check id text width > width of rectangle
if (textWidth > (endX - startX)) { if (textWidth > (endX - startX)) {
if (endX + textWidth + 1.5 * conf.leftPadding > w) { if (endX + textWidth + 1.5 * conf.leftPadding > w) {
return 'taskTextOutsideLeft taskTextOutside' + secNum + ' ' + taskType return classStr + ' taskTextOutsideLeft taskTextOutside' + secNum + ' ' + taskType
} else { } else {
return 'taskTextOutsideRight taskTextOutside' + secNum + ' ' + taskType return classStr + ' taskTextOutsideRight taskTextOutside' + secNum + ' ' + taskType
} }
} else { } else {
return 'taskText taskText' + secNum + ' ' + taskType return classStr + ' taskText taskText' + secNum + ' ' + taskType
} }
}) })
} }

View File

@@ -90,6 +90,12 @@
font-size: 11px; font-size: 11px;
} }
.task.clickable {
cursor: pointer;
}
.taskText.clickable {
cursor: pointer;
}
/* Specific task settings for the sections*/ /* Specific task settings for the sections*/