mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
Simple SVGRectText as foreignObject
This commit is contained in:
parent
67c371b483
commit
0a18bdd2a0
1 changed files with 15 additions and 12 deletions
|
@ -1,13 +1,18 @@
|
||||||
<template>
|
<template>
|
||||||
<text
|
<foreignObject
|
||||||
:x="Math.round(parent_aspect_ratio * rectangle.middle.x)"
|
:x="Math.round(parent_aspect_ratio * rectangle.left)"
|
||||||
:y="Math.round(rectangle.middle.y)"
|
:y="rectangle.top"
|
||||||
|
:width="Math.round(parent_aspect_ratio * rectangle.width)"
|
||||||
|
:height="rectangle.height"
|
||||||
:style="`transform: scaleX(${1 / parent_aspect_ratio})`"
|
:style="`transform: scaleX(${1 / parent_aspect_ratio})`"
|
||||||
text-anchor="middle"
|
|
||||||
dominant-baseline="middle"
|
|
||||||
>
|
>
|
||||||
{{ text }}
|
<div
|
||||||
</text>
|
xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
class="is-flex is-align-items-center is-justify-content-center"
|
||||||
|
>
|
||||||
|
<div class="is-size-1 has-text-weight-bold">{{ text }}</div>
|
||||||
|
</div>
|
||||||
|
</foreignObject>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -54,10 +59,8 @@ export default class extends Vue {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
text {
|
foreignObject > div {
|
||||||
fill: red;
|
color: red;
|
||||||
|
height: inherit;
|
||||||
font-weight: bold;
|
|
||||||
font-size: 50px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
Loading…
Reference in a new issue