@decidables/prospectable-elements 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/lib/prospectableElements.esm.js +948 -972
- package/lib/prospectableElements.esm.js.map +1 -1
- package/lib/prospectableElements.esm.min.js +199 -223
- package/lib/prospectableElements.esm.min.js.map +1 -1
- package/lib/prospectableElements.umd.js +948 -972
- package/lib/prospectableElements.umd.js.map +1 -1
- package/lib/prospectableElements.umd.min.js +199 -223
- package/lib/prospectableElements.umd.min.js.map +1 -1
- package/package.json +8 -7
- package/src/components/cpt-parameters.js +1 -0
- package/src/components/cpt-probability.js +7 -7
- package/src/components/cpt-space.js +99 -25
- package/src/components/cpt-value.js +8 -8
- package/src/components/decision-space.js +99 -25
- package/src/components/prospectable-response.js +2 -0
- package/src/components/risky-option.js +18 -21
- package/src/equations/cpt-equation.js +2 -0
|
@@ -397,6 +397,7 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
397
397
|
font-weight: 600;
|
|
398
398
|
|
|
399
399
|
alignment-baseline: middle;
|
|
400
|
+
|
|
400
401
|
text-anchor: middle;
|
|
401
402
|
}
|
|
402
403
|
|
|
@@ -420,6 +421,7 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
420
421
|
font-size: 0.75rem;
|
|
421
422
|
|
|
422
423
|
alignment-baseline: middle;
|
|
424
|
+
|
|
423
425
|
text-anchor: end;
|
|
424
426
|
}
|
|
425
427
|
|
|
@@ -460,6 +462,7 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
460
462
|
font-weight: 600;
|
|
461
463
|
|
|
462
464
|
alignment-baseline: middle;
|
|
465
|
+
|
|
463
466
|
text-anchor: middle;
|
|
464
467
|
}
|
|
465
468
|
|
|
@@ -544,7 +547,7 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
544
547
|
};
|
|
545
548
|
const startRotationX = (-0.85 * Math.PI) / 8;
|
|
546
549
|
const startRotationY = (3 * Math.PI) / 8;
|
|
547
|
-
const startRotationZ = 0;
|
|
550
|
+
const startRotationZ = 0.0000001; // Avoid d3-3d bug
|
|
548
551
|
|
|
549
552
|
const lineStrips3D = d33d.lineStrips3D()
|
|
550
553
|
.origin(startOrigin)
|
|
@@ -648,21 +651,24 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
648
651
|
lineStrips3D
|
|
649
652
|
.x((datum) => { return datum.x; })
|
|
650
653
|
.y(() => { return yScale.range()[0]; })
|
|
651
|
-
.z(() => { return zScale.range()[0]; })
|
|
654
|
+
.z(() => { return zScale.range()[0]; })
|
|
655
|
+
.data(xAxis),
|
|
652
656
|
);
|
|
653
657
|
const axisYUpdate = svgMerge.selectAll('.axis-y')
|
|
654
658
|
.data(
|
|
655
659
|
lineStrips3D
|
|
656
660
|
.x(() => { return xScale.range()[0]; })
|
|
657
661
|
.y((datum) => { return datum.y; })
|
|
658
|
-
.z(() => { return zScale.range()[1]; })
|
|
662
|
+
.z(() => { return zScale.range()[1]; })
|
|
663
|
+
.data(yAxis),
|
|
659
664
|
);
|
|
660
665
|
const axisZUpdate = svgMerge.selectAll('.axis-z')
|
|
661
666
|
.data(
|
|
662
667
|
lineStrips3D
|
|
663
668
|
.x(() => { return xScale.range()[0]; })
|
|
664
669
|
.y(() => { return yScale.range()[0]; })
|
|
665
|
-
.z((datum) => { return datum.z; })
|
|
670
|
+
.z((datum) => { return datum.z; })
|
|
671
|
+
.data(zAxis),
|
|
666
672
|
);
|
|
667
673
|
// ENTER
|
|
668
674
|
const axisXEnter = axisXUpdate.enter().append('path')
|
|
@@ -692,7 +698,8 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
692
698
|
return datum.id === 'min' ? datum.x - this.rem * 20 : datum.x + this.rem * 20;
|
|
693
699
|
})
|
|
694
700
|
.y(() => { return yScale.range()[0] + this.rem * 1.75; })
|
|
695
|
-
.z(() => { return zScale.range()[0] + this.rem * 1.75; })
|
|
701
|
+
.z(() => { return zScale.range()[0] + this.rem * 1.75; })
|
|
702
|
+
.data(xAxis),
|
|
696
703
|
);
|
|
697
704
|
const titlePathYUpdate = svgMerge.selectAll('.title-path-y')
|
|
698
705
|
.data(
|
|
@@ -701,7 +708,8 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
701
708
|
.y((datum) => {
|
|
702
709
|
return datum.id === 'min' ? datum.y + this.rem * 20 : datum.y - this.rem * 20;
|
|
703
710
|
})
|
|
704
|
-
.z(() => { return zScale.range()[1] - this.rem * 1.75; })
|
|
711
|
+
.z(() => { return zScale.range()[1] - this.rem * 1.75; })
|
|
712
|
+
.data(yAxis),
|
|
705
713
|
);
|
|
706
714
|
const titlePathZUpdate = svgMerge.selectAll('.title-path-z')
|
|
707
715
|
.data(
|
|
@@ -710,21 +718,40 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
710
718
|
.y(() => { return yScale.range()[0] + this.rem * 1.75; })
|
|
711
719
|
.z((datum) => {
|
|
712
720
|
return datum.id === 'min' ? datum.z - this.rem * 20 : datum.z + this.rem * 20;
|
|
713
|
-
})
|
|
721
|
+
})
|
|
722
|
+
.data(zAxis),
|
|
714
723
|
);
|
|
715
724
|
const titleXUpdate = svgMerge.selectAll('.title-x')
|
|
716
725
|
.data(
|
|
717
|
-
|
|
726
|
+
lineStrips3D
|
|
727
|
+
.x((datum) => {
|
|
728
|
+
return datum.id === 'min' ? datum.x - this.rem * 20 : datum.x + this.rem * 20;
|
|
729
|
+
})
|
|
730
|
+
.y(() => { return yScale.range()[0] + this.rem * 1.75; })
|
|
731
|
+
.z(() => { return zScale.range()[0] + this.rem * 1.75; })
|
|
732
|
+
.data(xAxis),
|
|
718
733
|
(datum) => { return datum[0].title; },
|
|
719
734
|
);
|
|
720
735
|
const titleYUpdate = svgMerge.selectAll('.title-y')
|
|
721
736
|
.data(
|
|
722
|
-
|
|
737
|
+
lineStrips3D
|
|
738
|
+
.x(() => { return xScale.range()[0] - this.rem * 1.75; })
|
|
739
|
+
.y((datum) => {
|
|
740
|
+
return datum.id === 'min' ? datum.y + this.rem * 20 : datum.y - this.rem * 20;
|
|
741
|
+
})
|
|
742
|
+
.z(() => { return zScale.range()[1] - this.rem * 1.75; })
|
|
743
|
+
.data(yAxis),
|
|
723
744
|
(datum) => { return datum[0].title; },
|
|
724
745
|
);
|
|
725
746
|
const titleZUpdate = svgMerge.selectAll('.title-z')
|
|
726
747
|
.data(
|
|
727
|
-
|
|
748
|
+
lineStrips3D
|
|
749
|
+
.x(() => { return xScale.range()[0] - this.rem * 1.75; })
|
|
750
|
+
.y(() => { return yScale.range()[0] + this.rem * 1.75; })
|
|
751
|
+
.z((datum) => {
|
|
752
|
+
return datum.id === 'min' ? datum.z - this.rem * 20 : datum.z + this.rem * 20;
|
|
753
|
+
})
|
|
754
|
+
.data(zAxis),
|
|
728
755
|
(datum) => { return datum[0].title; },
|
|
729
756
|
);
|
|
730
757
|
// ENTER
|
|
@@ -811,7 +838,8 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
811
838
|
})
|
|
812
839
|
.z((datum) => {
|
|
813
840
|
return datum.id === 'min' ? zScale.range()[0] : zScale.range()[0] + this.rem * 0.35;
|
|
814
|
-
})
|
|
841
|
+
})
|
|
842
|
+
.data(xTicks),
|
|
815
843
|
);
|
|
816
844
|
const ticksYUpdate = svgMerge.selectAll('.tick-y')
|
|
817
845
|
.data(
|
|
@@ -822,7 +850,8 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
822
850
|
.y((datum) => { return datum.y; })
|
|
823
851
|
.z((datum) => {
|
|
824
852
|
return datum.id === 'min' ? zScale.range()[1] : zScale.range()[1] - this.rem * 0.35;
|
|
825
|
-
})
|
|
853
|
+
})
|
|
854
|
+
.data(yTicks),
|
|
826
855
|
);
|
|
827
856
|
const ticksZUpdate = svgMerge.selectAll('.tick-z')
|
|
828
857
|
.data(
|
|
@@ -833,7 +862,8 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
833
862
|
.y((datum) => {
|
|
834
863
|
return datum.id === 'min' ? yScale.range()[0] : yScale.range()[0] + this.rem * 0.35;
|
|
835
864
|
})
|
|
836
|
-
.z((datum) => { return datum.z; })
|
|
865
|
+
.z((datum) => { return datum.z; })
|
|
866
|
+
.data(zTicks),
|
|
837
867
|
);
|
|
838
868
|
// ENTER
|
|
839
869
|
const ticksXEnter = ticksXUpdate.enter().append('path')
|
|
@@ -869,7 +899,8 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
869
899
|
return datum.id === 'min'
|
|
870
900
|
? zScale.range()[0] + this.rem * 4
|
|
871
901
|
: zScale.range()[0] + this.rem * 0.5;
|
|
872
|
-
})
|
|
902
|
+
})
|
|
903
|
+
.data(xTicks),
|
|
873
904
|
(datum) => { return datum[0].label; },
|
|
874
905
|
);
|
|
875
906
|
const labelPathsYUpdate = svgMerge.selectAll('.label-path-y')
|
|
@@ -885,7 +916,8 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
885
916
|
return datum.id === 'min'
|
|
886
917
|
? zScale.range()[1] - this.rem * 0.5
|
|
887
918
|
: zScale.range()[1] - this.rem * 4;
|
|
888
|
-
})
|
|
919
|
+
})
|
|
920
|
+
.data(yTicks),
|
|
889
921
|
(datum) => { return datum[0].label; },
|
|
890
922
|
);
|
|
891
923
|
const labelPathsZUpdate = svgMerge.selectAll('.label-path-z')
|
|
@@ -901,22 +933,59 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
901
933
|
? yScale.range()[0] + this.rem * 4
|
|
902
934
|
: yScale.range()[0] + this.rem * 0.5;
|
|
903
935
|
})
|
|
904
|
-
.z((datum) => { return datum.z; })
|
|
936
|
+
.z((datum) => { return datum.z; })
|
|
937
|
+
.data(zTicks),
|
|
905
938
|
(datum) => { return datum[0].label; },
|
|
906
939
|
);
|
|
907
940
|
const labelsXUpdate = svgMerge.selectAll('.label-x')
|
|
908
941
|
.data(
|
|
909
|
-
|
|
942
|
+
lineStrips3D
|
|
943
|
+
.x((datum) => { return datum.x; })
|
|
944
|
+
.y((datum) => {
|
|
945
|
+
return datum.id === 'min'
|
|
946
|
+
? yScale.range()[0] + this.rem * 4
|
|
947
|
+
: yScale.range()[0] + this.rem * 0.5;
|
|
948
|
+
})
|
|
949
|
+
.z((datum) => {
|
|
950
|
+
return datum.id === 'min'
|
|
951
|
+
? zScale.range()[0] + this.rem * 4
|
|
952
|
+
: zScale.range()[0] + this.rem * 0.5;
|
|
953
|
+
})
|
|
954
|
+
.data(xTicks),
|
|
910
955
|
(datum) => { return datum[0].label; },
|
|
911
956
|
);
|
|
912
957
|
const labelsYUpdate = svgMerge.selectAll('.label-y')
|
|
913
958
|
.data(
|
|
914
|
-
|
|
959
|
+
lineStrips3D
|
|
960
|
+
.x((datum) => {
|
|
961
|
+
return datum.id === 'min'
|
|
962
|
+
? xScale.range()[0] - this.rem * 0.5
|
|
963
|
+
: xScale.range()[0] - this.rem * 4;
|
|
964
|
+
})
|
|
965
|
+
.y((datum) => { return datum.y; })
|
|
966
|
+
.z((datum) => {
|
|
967
|
+
return datum.id === 'min'
|
|
968
|
+
? zScale.range()[1] - this.rem * 0.5
|
|
969
|
+
: zScale.range()[1] - this.rem * 4;
|
|
970
|
+
})
|
|
971
|
+
.data(yTicks),
|
|
915
972
|
(datum) => { return datum[0].label; },
|
|
916
973
|
);
|
|
917
974
|
const labelsZUpdate = svgMerge.selectAll('.label-z')
|
|
918
975
|
.data(
|
|
919
|
-
|
|
976
|
+
lineStrips3D
|
|
977
|
+
.x((datum) => {
|
|
978
|
+
return datum.id === 'min'
|
|
979
|
+
? xScale.range()[0] - this.rem * 4
|
|
980
|
+
: xScale.range()[0] - this.rem * 0.5;
|
|
981
|
+
})
|
|
982
|
+
.y((datum) => {
|
|
983
|
+
return datum.id === 'min'
|
|
984
|
+
? yScale.range()[0] + this.rem * 4
|
|
985
|
+
: yScale.range()[0] + this.rem * 0.5;
|
|
986
|
+
})
|
|
987
|
+
.z((datum) => { return datum.z; })
|
|
988
|
+
.data(zTicks),
|
|
920
989
|
(datum) => { return datum[0].label; },
|
|
921
990
|
);
|
|
922
991
|
// ENTER
|
|
@@ -978,7 +1047,8 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
978
1047
|
points3d
|
|
979
1048
|
.x((datum) => { return xScale(datum.xs); })
|
|
980
1049
|
.y((datum) => { return yScale(datum.pw); })
|
|
981
|
-
.z((datum) => { return zScale(datum.xw); })
|
|
1050
|
+
.z((datum) => { return zScale(datum.xw); })
|
|
1051
|
+
.data(
|
|
982
1052
|
this.choices.slice(
|
|
983
1053
|
this.point === 'rest' ? 1 : 0,
|
|
984
1054
|
this.point === 'first' ? 1 : undefined,
|
|
@@ -1056,7 +1126,8 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
1056
1126
|
)
|
|
1057
1127
|
.x((datum) => { return xScale(datum.xs); })
|
|
1058
1128
|
.y((datum) => { return yScale(datum.pw); })
|
|
1059
|
-
.z((datum) => { return zScale(datum.xw); })
|
|
1129
|
+
.z((datum) => { return zScale(datum.xw); })
|
|
1130
|
+
.data(this.boundary)
|
|
1060
1131
|
.filter((datum) => {
|
|
1061
1132
|
return (
|
|
1062
1133
|
(datum[0].pw >= this.range.pw.start && datum[0].pw <= this.range.pw.stop)
|
|
@@ -1093,7 +1164,8 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
1093
1164
|
.rows(d3.range(this.range.pw.start, this.range.pw.stop + 0.01, this.range.pw.step).length)
|
|
1094
1165
|
.x((datum) => { return xScale(datum.xs); })
|
|
1095
1166
|
.y((datum) => { return yScale(datum.pw); })
|
|
1096
|
-
.z((datum) => { return zScale(datum.xw); })
|
|
1167
|
+
.z((datum) => { return zScale(datum.xw); })
|
|
1168
|
+
.data(this.mapXY),
|
|
1097
1169
|
);
|
|
1098
1170
|
const mapXZUpdate = svgMerge.selectAll('.map-xz')
|
|
1099
1171
|
.data(
|
|
@@ -1101,7 +1173,8 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
1101
1173
|
.rows(d3.range(this.range.xw.start, this.range.xw.stop + 0.01, this.range.xw.step).length)
|
|
1102
1174
|
.x((datum) => { return xScale(datum.xs); })
|
|
1103
1175
|
.y((datum) => { return yScale(datum.pw); })
|
|
1104
|
-
.z((datum) => { return zScale(datum.xw); })
|
|
1176
|
+
.z((datum) => { return zScale(datum.xw); })
|
|
1177
|
+
.data(this.mapXZ),
|
|
1105
1178
|
);
|
|
1106
1179
|
const mapYZUpdate = svgMerge.selectAll('.map-yz')
|
|
1107
1180
|
.data(
|
|
@@ -1109,7 +1182,8 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
1109
1182
|
.rows(d3.range(this.range.xw.start, this.range.xw.stop + 0.01, this.range.xw.step).length)
|
|
1110
1183
|
.x((datum) => { return xScale(datum.xs); })
|
|
1111
1184
|
.y((datum) => { return yScale(datum.pw); })
|
|
1112
|
-
.z((datum) => { return zScale(datum.xw); })
|
|
1185
|
+
.z((datum) => { return zScale(datum.xw); })
|
|
1186
|
+
.data(this.mapYZ),
|
|
1113
1187
|
);
|
|
1114
1188
|
// ENTER
|
|
1115
1189
|
const mapXYEnter = mapXYUpdate.enter().append('path')
|
|
@@ -1158,7 +1232,7 @@ export default class DecisionSpace extends DecidablesMixinResizeable(Prospectabl
|
|
|
1158
1232
|
mapYZUpdate.exit().remove();
|
|
1159
1233
|
|
|
1160
1234
|
// Depth sorting
|
|
1161
|
-
d3.select(this.renderRoot).selectAll('.d3-3d').sort(
|
|
1235
|
+
d3.select(this.renderRoot).selectAll('.d3-3d').sort(d33d.sort);
|
|
1162
1236
|
|
|
1163
1237
|
// Color Legend
|
|
1164
1238
|
// DATA-JOIN
|
|
@@ -265,6 +265,7 @@ export default class ProspectableResponse extends ProspectableElement {
|
|
|
265
265
|
|
|
266
266
|
width: 5.25rem;
|
|
267
267
|
height: 3.5rem;
|
|
268
|
+
|
|
268
269
|
padding: 0.375rem 0.75rem;
|
|
269
270
|
margin: 0.25rem;
|
|
270
271
|
|
|
@@ -292,6 +293,7 @@ export default class ProspectableResponse extends ProspectableElement {
|
|
|
292
293
|
|
|
293
294
|
.feedback .outcome {
|
|
294
295
|
font-weight: 600;
|
|
296
|
+
|
|
295
297
|
line-height: 1.15;
|
|
296
298
|
}
|
|
297
299
|
|
|
@@ -23,6 +23,8 @@ export default class RiskyOption extends DecidablesMixinResizeable(ProspectableE
|
|
|
23
23
|
--decidables-spinner-input-width: 4rem;
|
|
24
24
|
--decidables-spinner-prefix: "$";
|
|
25
25
|
|
|
26
|
+
position: relative;
|
|
27
|
+
|
|
26
28
|
display: inline-block;
|
|
27
29
|
|
|
28
30
|
width: 10rem;
|
|
@@ -32,6 +34,7 @@ export default class RiskyOption extends DecidablesMixinResizeable(ProspectableE
|
|
|
32
34
|
.main {
|
|
33
35
|
width: 100%;
|
|
34
36
|
height: 100%;
|
|
37
|
+
|
|
35
38
|
overflow: visible;
|
|
36
39
|
}
|
|
37
40
|
|
|
@@ -48,9 +51,9 @@ export default class RiskyOption extends DecidablesMixinResizeable(ProspectableE
|
|
|
48
51
|
|
|
49
52
|
.arc.interactive {
|
|
50
53
|
cursor: ns-resize;
|
|
54
|
+
outline: none;
|
|
51
55
|
|
|
52
56
|
filter: url("#shadow-2");
|
|
53
|
-
outline: none;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
.arc.interactive:hover {
|
|
@@ -61,7 +64,7 @@ export default class RiskyOption extends DecidablesMixinResizeable(ProspectableE
|
|
|
61
64
|
filter: url("#shadow-8");
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
|
|
67
|
+
.arc.interactive:focus-visible {
|
|
65
68
|
filter: url("#shadow-8");
|
|
66
69
|
}
|
|
67
70
|
|
|
@@ -80,23 +83,20 @@ export default class RiskyOption extends DecidablesMixinResizeable(ProspectableE
|
|
|
80
83
|
.label.static {
|
|
81
84
|
font-size: 1.75rem;
|
|
82
85
|
|
|
86
|
+
dominant-baseline: middle;
|
|
87
|
+
|
|
83
88
|
user-select: none;
|
|
84
89
|
|
|
85
|
-
dominant-baseline: middle;
|
|
86
90
|
text-anchor: middle;
|
|
87
91
|
}
|
|
88
92
|
|
|
89
93
|
.label.interactive {
|
|
94
|
+
position: absolute;
|
|
95
|
+
|
|
90
96
|
width: var(--decidables-spinner-input-width);
|
|
91
97
|
height: calc(var(--decidables-spinner-font-size) * 1.5);
|
|
92
|
-
overflow: visible;
|
|
93
|
-
}
|
|
94
98
|
|
|
95
|
-
|
|
96
|
-
/* https://stackoverflow.com/questions/51313873/svg-foreignobject-not-working-properly-on-safari */
|
|
97
|
-
/* https://bugs.webkit.org/show_bug.cgi?id=23113 */
|
|
98
|
-
.label.interactive decidables-spinner {
|
|
99
|
-
position: fixed;
|
|
99
|
+
overflow: visible;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
.label.interactive.win decidables-spinner {
|
|
@@ -332,12 +332,12 @@ export default class RiskyOption extends DecidablesMixinResizeable(ProspectableE
|
|
|
332
332
|
// DATA-JOIN
|
|
333
333
|
const labelStaticUpdate = pieMerge.selectAll('.label.static')
|
|
334
334
|
.data(arcsStatic);
|
|
335
|
-
const labelInteractiveUpdate =
|
|
335
|
+
const labelInteractiveUpdate = d3.select(this.renderRoot).selectAll('.label.interactive')
|
|
336
336
|
.data(arcsInteractive);
|
|
337
337
|
// ENTER
|
|
338
338
|
const labelStaticEnter = labelStaticUpdate.enter().append('text');
|
|
339
|
-
const labelInteractiveEnter = labelInteractiveUpdate.enter().append('
|
|
340
|
-
labelInteractiveEnter.append('
|
|
339
|
+
const labelInteractiveEnter = labelInteractiveUpdate.enter().append('xhtml:div');
|
|
340
|
+
labelInteractiveEnter.append('decidables-spinner')
|
|
341
341
|
.on('input', (event, datum) => {
|
|
342
342
|
datum.data.x = parseFloat(event.target.value);
|
|
343
343
|
|
|
@@ -364,22 +364,19 @@ export default class RiskyOption extends DecidablesMixinResizeable(ProspectableE
|
|
|
364
364
|
.text((datum) => { return `$${datum.data.x.toFixed(0)}`; });
|
|
365
365
|
const labelInteractiveMerge = labelInteractiveEnter.merge(labelInteractiveUpdate)
|
|
366
366
|
.attr('class', (datum) => { return `label interactive ${datum.data.name}`; })
|
|
367
|
-
.attr('
|
|
368
|
-
// HACK: Center spinner here instead of CSS for Safari SVG foreignObject
|
|
369
|
-
// x: calc(var(--decidables-spinner-input-width) / -2);
|
|
370
|
-
// y: calc(var(--decidables-spinner-font-size) * 1.5 / -2);
|
|
367
|
+
.attr('style', (datum) => {
|
|
371
368
|
const inputWidth = parseFloat(this.getComputedStyleValue('--decidables-spinner-input-width'));
|
|
372
369
|
const fontSize = parseFloat(this.getComputedStyleValue('--decidables-spinner-font-size'));
|
|
373
370
|
const rem = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('font-size'), 10);
|
|
374
|
-
const x = (inputWidth * rem) / -2;
|
|
375
|
-
const y = (fontSize * rem * 1.5) / -2;
|
|
371
|
+
const x = (width / 2) + (inputWidth * rem) / -2;
|
|
372
|
+
const y = (height / 2) + (fontSize * rem * 1.5) / -2;
|
|
376
373
|
|
|
377
374
|
if (arcs.length === 1) {
|
|
378
|
-
return `
|
|
375
|
+
return `left: ${x}px; top: ${y}px;`;
|
|
379
376
|
}
|
|
380
377
|
const radius = (Math.min(width, height) / 2) * 0.6;
|
|
381
378
|
const arcLabel = d3.arc().innerRadius(radius).outerRadius(radius);
|
|
382
|
-
return `
|
|
379
|
+
return `left: ${arcLabel.centroid(datum)[0] + x}px; top: ${arcLabel.centroid(datum)[1] + y}px;`;
|
|
383
380
|
});
|
|
384
381
|
labelInteractiveMerge.select('decidables-spinner')
|
|
385
382
|
.attr('value', (datum) => { return `${datum.data.x.toFixed(0)}`; });
|