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

Feature tooltip #94

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
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
216267e
Feature Tooltip angefangen
julia221501 Sep 2, 2022
4107a0e
Feature Tooltip erweitert
julia221501 Sep 4, 2022
3dc45eb
Feature Tooltip richtige Person ausgewählt
julia221501 Sep 6, 2022
53b4c04
Eröffnung eines Kontaktfeldes mit Klick in Karte
julia221501 Sep 14, 2022
5864428
Prettier angewendet
julia221501 Sep 15, 2022
163193d
Klick in Karte wurde zu Doppelklick geändert; prettier wurde angewendet
julia221501 Sep 15, 2022
2136e7c
refactor setPosition; Escape bricht Eingabe ab; dblclick funktioniert…
julia221501 Sep 19, 2022
dccf23c
Rect zu Tooltip hinzugefügt
julia221501 Sep 21, 2022
eb1bd14
Backup commit
julia221501 Sep 22, 2022
ed4be78
Pdf Report Export erstellt
julia221501 Aug 22, 2022
a5652ea
Alter-Info in Pdf
julia221501 Aug 23, 2022
7e0c68e
Alter-Info styled & Tab close
julia221501 Aug 24, 2022
6f214df
Alter-Info in pdf, Tab close
julia221501 Aug 26, 2022
ed84449
Beziehung in pdf hinzugefügt
julia221501 Aug 30, 2022
1de9397
Close icon hinzugefügt
julia221501 Sep 1, 2022
e789c52
pdf export erstellt #47; lint angewendet
julia221501 Sep 1, 2022
f5020d3
style PDF link button using Bulma & encapsulate custom link styles di…
alex-rind Sep 2, 2022
44474d1
remove unneeded dependency and component
alex-rind Sep 2, 2022
72f974d
print without a popup window & hide buttons using CSS media display none
alex-rind Sep 2, 2022
14555e1
add some explanatory text, which will not be printed
alex-rind Sep 2, 2022
89f846f
use defineComponent for better vue typescript compatibility
alex-rind Sep 2, 2022
7edc5a8
Nicht-Mensch: nicht das Geschlecht angezeigt sondern Kategorie; Daten…
julia221501 Sep 16, 2022
32628f0
simplify brand header
alex-rind Sep 21, 2022
b57f144
NWK Ansichtseinstellungen an PDF übergeben
julia221501 Sep 22, 2022
77c7ad6
PDF vue nicht benötigte Code-Zeilen gelöscht
julia221501 Sep 22, 2022
1c0a648
Merge branch 'main' of https://github.com/fhstp/easynwk-web
julia221501 Sep 29, 2022
3c4f275
Merge branch 'main' into feature_tooltip
julia221501 Sep 29, 2022
a7ae00a
Ecken abgerundet und erste Anpassungsschritte (größe von Rect)
julia221501 Sep 30, 2022
c802117
Alter Notiz wird ab bestimmter länge abgekürzt und rect ist im Vorder…
julia221501 Sep 30, 2022
068fdfe
Tooltip in andere vue Datei gebracht, rect-Breite passt sich korrekt …
julia221501 Oct 3, 2022
b660e6d
Höhe angepasst, Anzeigelogik verbessert
julia221501 Oct 5, 2022
22caebf
Hover auch auf Punkten, Notiz wird bei Leertaste getrennt und nicht i…
julia221501 Oct 6, 2022
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
12 changes: 8 additions & 4 deletions src/components/AlteriEditForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,6 @@ export default defineComponent({
alterNameInUI.value = newValue;
});

const invalidName = computed(() => {
return alterNameInUI.value.trim().length === 0;
});

const invalidPosition = computed(() => {
return props.alter?.distance <= 0;
});
Expand Down Expand Up @@ -332,6 +328,13 @@ export default defineComponent({
commitEdit(evt, "role");
}
};
const invalidName = computed(() => {
return alterNameInUI.value.trim().length === 0;
});

const getInvalidName = function () {
return invalidName;
};

// apparently v-for needs this to be a data item
const genderOptions = ref(Gender);
Expand Down Expand Up @@ -392,6 +395,7 @@ export default defineComponent({
alterEdgeType: accessor("edgeType"),
isConnectable: computed(() => isConnectable(props.alter as Alter)),
commitEdit,
getInvalidName,
cancelEdit,
focusRole,
blurRole,
Expand Down
97 changes: 76 additions & 21 deletions src/components/NetworkMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,12 @@
:filter="mark.d.edgeType == 2 ? 'url(#dilate-and-xor)' : undefined"
/>
<use
@mouseover="showTooltip(mark, true)"
@mouseleave="showTooltip(mark, false)"
:href="'#' + mark.shape"
:x="mark.x"
:y="mark.y"
class="mark clickAble"
class="mark clickAble hover"
width="4"
height="4"
transform="translate(-2,-2)"
Expand All @@ -143,7 +145,11 @@
{{ showAge && mark.d.age.length >= 1 ? "/ " + mark.d.age : "" }}
{{ showRole ? " / " + getRoleShort(mark.d.role) : "" }}
</text>

<text
@mouseover="showTooltip(mark, true)"
@mouseleave="showTooltip(mark, false)"
class="hover"
v-if="alteriNames"
:x="mark.x"
:y="mark.y"
Expand Down Expand Up @@ -178,6 +184,7 @@
width="220"
height="220"
/>
<ToolTip :marks="alteriMarks" :names="alteriNames" :text="useTextBG" />
</svg>
</template>

Expand All @@ -193,6 +200,7 @@ import { shapeByGender } from "@/data/Gender";
import { TAB_BASE, TAB_CONNECTIONS } from "@/store/viewOptionsModule";
import { SYMBOL_DECEASED } from "@/assets/utils";
import { getRoleAbbrev } from "../data/Roles";
import ToolTip from "@/components/ToolTip.vue";

interface AlterMark {
d: Alter;
Expand All @@ -216,7 +224,9 @@ interface ConnectionMark {
// emit "map-click" (which is not currently used)

export default defineComponent({
setup(props, { emit }) {
components: { ToolTip },

setup: function (props, { emit }) {
const store = useStore();

const isEditMode = computed(() => {
Expand All @@ -226,34 +236,57 @@ export default defineComponent({
);
});

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const setPosition = (event: any) => {
const coords = d3.pointer(event);

// cp. https://stackoverflow.com/a/33043899/1140589
const distance = Math.sqrt(coords[0] * coords[0] + coords[1] * coords[1]);
const angle = Math.atan2(-1 * coords[1], coords[0]) * (180 / Math.PI);

if (isEditMode.value) {
const payload = {
index: store.state.view.editIndex,
changes: { distance: distance, angle: angle },
};
store.commit("editAlter", payload);
// } else {
// store.commit("view/clearSelectedAlters");
}

emit("map-click", { distance, angle });
};

const isConnectMode = computed(
() => store.state.view.editTab === TAB_CONNECTIONS
);

onMounted(() => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
document.onkeydown = (event: any) => {
if (event.key === "Escape" || event.key === "Esc") {
if (isEditMode.value) {
store.commit("cancelAddAlter", store.state.view.editIndex);
} else {
console.log("close");
store.commit("editAlterFinished");
}
}
};
// d3.mouse only works if the event is registered using D3 .on
const g = d3.select("#nwkmap");
// eslint-disable-next-line @typescript-eslint/no-explicit-any

// eslint-disable-next-line @typescript-eslint/no-explicit-any
g.on("click", (event: any) => {
const coords = d3.pointer(event);

// cp. https://stackoverflow.com/a/33043899/1140589
const distance = Math.sqrt(
coords[0] * coords[0] + coords[1] * coords[1]
);
const angle = Math.atan2(-1 * coords[1], coords[0]) * (180 / Math.PI);

if (isEditMode.value) {
const payload = {
index: store.state.view.editIndex,
changes: { distance: distance, angle: angle },
};
store.commit("editAlter", payload);
// } else {
// store.commit("view/clearSelectedAlters");
setPosition(event);
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
g.on("dblclick", (event: any) => {
if (!isEditMode.value) {
store.commit("addAlter");
setPosition(event);
}

emit("map-click", { distance, angle });
});
});

Expand Down Expand Up @@ -327,6 +360,19 @@ export default defineComponent({
return buffer.sort((a, b) => b.d.distance - a.d.distance);
});

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function showTooltip(mark: any, active: boolean) {
var element = document.querySelectorAll(`[markid="${mark.d.id}"]`);
for (var i = 0; i < element.length; i++) {
active
? element[i].classList.remove("toolhover")
: element[i].classList.remove("toolhover-active");
active
? element[i].classList.add("toolhover-active")
: element[i].classList.add("toolhover");
}
}

const connectionMarks = computed((): Array<ConnectionMark> => {
return store.state.nwk.connections.map((conn) => {
const coords1 = alteriCoords.value.get(conn.id1);
Expand All @@ -345,7 +391,6 @@ export default defineComponent({
};
});
});

return {
egoShape: computed(() =>
shapeByGender(true, store.state.nwk.ego.currentGender)
Expand All @@ -354,6 +399,7 @@ export default defineComponent({
isConnectMode,
clickAlter,
alteriMarks,
showTooltip,
connectionMarks,
showAge: computed(() => store.state.view.ageInNwk),
showRole: computed(() => store.state.view.roleInNwk),
Expand Down Expand Up @@ -385,6 +431,15 @@ export default defineComponent({
text {
font-family: $family-primary;
font-size: 4px;
cursor: pointer;
}

.text {
display: block;
width: 20px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}

.textbg {
Expand Down
Loading