Skip to content

Commit

Permalink
Adjust jsxgraph layers so points on same DoenetML layer are on top
Browse files Browse the repository at this point in the history
  • Loading branch information
dqnykamp committed Mar 20, 2023
1 parent 96efa5c commit be72671
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/Viewer/renderers/angle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default React.memo(function Angle(props) {
visible: !SVs.hidden,
withLabel: SVs.showLabel && SVs.labelForGraph !== "",
fixed: true,//SVs.draggable !== true,
layer: 10 * SVs.layer + 7,
layer: 10 * SVs.layer + 5,
radius: SVs.numericalRadius,
fillColor: SVs.selectedStyle.fillColor,
strokeColor: SVs.selectedStyle.lineColor,
Expand Down
4 changes: 2 additions & 2 deletions src/Viewer/renderers/cobwebPolyline.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default React.memo(function CobwebPolyline(props) {
visible: !SVs.hidden && validCoords,
withLabel: SVs.showLabel && SVs.labelForGraph !== "",
fixed: true,
layer: 10 * SVs.layer + 7,
layer: 10 * SVs.layer + 5,
strokeColor: SVs.selectedStyle.lineColor,
highlightStrokeColor: SVs.selectedStyle.lineColor,
strokeWidth: SVs.selectedStyle.lineWidth,
Expand All @@ -112,7 +112,7 @@ export default React.memo(function CobwebPolyline(props) {
visible: !SVs.hidden && validCoords && SVs.draggable,
withLabel: true,
name: "A",
layer: 10 * SVs.layer + 9,
layer: 10 * SVs.layer + 7,
fillColor: SVs.selectedStyle.markerColor,
strokeColor: SVs.selectedStyle.markerColor,
size: SVs.selectedStyle.markerSize,
Expand Down
22 changes: 11 additions & 11 deletions src/Viewer/renderers/curve.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export default React.memo(function Curve(props) {
fixed: true,
strokeColor: 'var(--mainGray)',
highlightStrokeColor: 'var(--mainGray)',
layer: 10 * SVs.layer + 7,
layer: 10 * SVs.layer + 6,
strokeWidth: 1,
highlightStrokeWidth: 1,
};
Expand All @@ -234,7 +234,7 @@ export default React.memo(function Curve(props) {
highlightStrokeColor: 'var(--mainGray)',
strokeWidth: 1,
highlightStrokeWidth: 1,
layer: 10 * SVs.layer + 7,
layer: 10 * SVs.layer + 6,
size: 3,
};
throughPointAlwaysVisible.current = {
Expand All @@ -256,7 +256,7 @@ export default React.memo(function Curve(props) {
highlightStrokeColor: 'var(--mainGray)',
strokeWidth: 1,
highlightStrokeWidth: 1,
layer: 10 * SVs.layer + 8,
layer: 10 * SVs.layer + 7,
size: 2,
};

Expand Down Expand Up @@ -616,9 +616,9 @@ export default React.memo(function Curve(props) {

if (layerChanged) {
curveJXG.current.setAttribute({ layer: curveLayer });
segmentAttributes.current.layer = curveLayer + 2;
throughPointAttributes.current.layer = curveLayer + 2;
controlPointAttributes.current.layer = curveLayer + 3;
segmentAttributes.current.layer = curveLayer + 1;
throughPointAttributes.current.layer = curveLayer + 1;
controlPointAttributes.current.layer = curveLayer + 2;
}

if (curveJXG.current.visProp.strokecolor !== SVs.selectedStyle.lineColor) {
Expand Down Expand Up @@ -811,11 +811,11 @@ export default React.memo(function Curve(props) {
}

if (layerChanged) {
throughPointsJXG.current[i].setAttribute({ layer: curveLayer + 2 });
segmentsJXG.current[i][0].setAttribute({ layer: curveLayer + 2 });
controlPointsJXG.current[i][0].setAttribute({ layer: curveLayer + 3 });
segmentsJXG.current[i][1].setAttribute({ layer: curveLayer + 2 });
controlPointsJXG.current[i][1].setAttribute({ layer: curveLayer + 3 });
throughPointsJXG.current[i].setAttribute({ layer: curveLayer + 1 });
segmentsJXG.current[i][0].setAttribute({ layer: curveLayer + 1 });
controlPointsJXG.current[i][0].setAttribute({ layer: curveLayer + 2 });
segmentsJXG.current[i][1].setAttribute({ layer: curveLayer + 1 });
controlPointsJXG.current[i][1].setAttribute({ layer: curveLayer + 2 });
}

throughPointsJXG.current[i].coords.setCoordinates(JXG.COORDS_BY_USER, [...SVs.numericalThroughPoints[i]]);
Expand Down
4 changes: 2 additions & 2 deletions src/Viewer/renderers/line.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default React.memo(function Line(props) {
visible: !SVs.hidden,
withlabel,
fixed,
layer: 10 * SVs.layer + 7,
layer: 10 * SVs.layer + 5,
strokeColor: SVs.selectedStyle.lineColor,
strokeOpacity: SVs.selectedStyle.lineOpacity,
highlightStrokeColor: SVs.selectedStyle.lineColor,
Expand Down Expand Up @@ -271,7 +271,7 @@ export default React.memo(function Line(props) {
lineJXG.current.visProp.fixed = fixed;
lineJXG.current.visProp.highlight = !fixed;

let layer = 10 * SVs.layer + 7;
let layer = 10 * SVs.layer + 5;
let layerChanged = lineJXG.current.visProp.layer !== layer;

if (layerChanged) {
Expand Down
6 changes: 3 additions & 3 deletions src/Viewer/renderers/lineSegment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default React.memo(function LineSegment(props) {
visible: !SVs.hidden,
withlabel,
fixed,
layer: 10 * SVs.layer + 7,
layer: 10 * SVs.layer + 5,
strokeColor: SVs.selectedStyle.lineColor,
strokeOpacity: SVs.selectedStyle.lineOpacity,
highlightStrokeColor: SVs.selectedStyle.lineColor,
Expand Down Expand Up @@ -128,7 +128,7 @@ export default React.memo(function LineSegment(props) {
strokeColor: 'none',
highlightStrokeColor: 'none',
highlightFillColor: getComputedStyle(document.documentElement).getPropertyValue("--mainGray"),
layer: 10 * SVs.layer + 8,
layer: 10 * SVs.layer + 6,
showInfoBox: SVs.showCoordsWhenDragging,
visible: endpointsVisible
});
Expand Down Expand Up @@ -405,7 +405,7 @@ export default React.memo(function LineSegment(props) {
lineSegmentJXG.current.visProp.fixed = fixed;
lineSegmentJXG.current.visProp.highlight = !fixed;

let layer = 10 * SVs.layer + 7;
let layer = 10 * SVs.layer + 5;
let layerChanged = lineSegmentJXG.current.visProp.layer !== layer;

if (layerChanged) {
Expand Down
1 change: 1 addition & 0 deletions src/Viewer/renderers/point.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ export default React.memo(function Point(props) {

if (layerChanged) {
pointJXG.current.setAttribute({ layer });
shadowPointJXG.current.setAttribute({ layer: layer - 1 });
}

let fixed = !SVs.draggable || SVs.fixed;
Expand Down
8 changes: 4 additions & 4 deletions src/Viewer/renderers/polygon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ export default React.memo(function Polygon(props) {
highlightFillColor: getComputedStyle(document.documentElement).getPropertyValue("--mainGray"),
visible: !verticesFixed && !SVs.hidden,
withLabel: false,
layer: 10 * SVs.layer + 9,
layer: 10 * SVs.layer + 7,
highlight: true,
};

let jsxBorderAttributes = {
highlight: false,
visible: !SVs.hidden,
layer: 10 * SVs.layer + 8,
layer: 10 * SVs.layer + 6,
fixed: true,
strokeColor: SVs.selectedStyle.lineColor,
strokeOpacity: SVs.selectedStyle.lineOpacity,
Expand All @@ -79,7 +79,7 @@ export default React.memo(function Polygon(props) {
visible: !SVs.hidden,
withLabel: SVs.showLabel && SVs.labelForGraph !== "",
fixed,
layer: 10 * SVs.layer + 7,
layer: 10 * SVs.layer + 5,

//specific to polygon
fillColor,
Expand Down Expand Up @@ -354,7 +354,7 @@ export default React.memo(function Polygon(props) {
polygonJXG.current.visPropCalc["visible"] = visibleNow;
// polygonJXG.current.setAttribute({visible: visibleNow})

let polygonLayer = 10 * SVs.layer + 7;
let polygonLayer = 10 * SVs.layer + 5;
let layerChanged = polygonJXG.current.visProp.layer !== polygonLayer;

if (layerChanged) {
Expand Down
6 changes: 3 additions & 3 deletions src/Viewer/renderers/polyline.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default React.memo(function Polyline(props) {
name: SVs.labelForGraph,
visible: !SVs.hidden && validCoords,
withLabel: SVs.showLabel && SVs.labelForGraph !== "",
layer: 10 * SVs.layer + 7,
layer: 10 * SVs.layer + 5,
fixed,
strokeColor: SVs.selectedStyle.lineColor,
strokeOpacity: SVs.selectedStyle.lineOpacity,
Expand All @@ -89,7 +89,7 @@ export default React.memo(function Polyline(props) {
strokeColor: 'none',
highlightStrokeColor: 'none',
highlightFillColor: getComputedStyle(document.documentElement).getPropertyValue("--mainGray"),
layer: 10 * SVs.layer + 9,
layer: 10 * SVs.layer + 7,
});
if (verticesFixed || SVs.hidden || !validCoords) {
jsxPointAttributes.current.visible = false;
Expand Down Expand Up @@ -301,7 +301,7 @@ export default React.memo(function Polyline(props) {
polylineJXG.current.visProp.fixed = fixed;
polylineJXG.current.visProp.highlight = !fixed;

let polylineLayer = 10 * SVs.layer + 7;
let polylineLayer = 10 * SVs.layer + 5;
let layerChanged = polylineJXG.current.visProp.layer !== polylineLayer;

if (layerChanged) {
Expand Down
4 changes: 2 additions & 2 deletions src/Viewer/renderers/ray.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default React.memo(function Ray(props) {
name: SVs.labelForGraph,
visible: !SVs.hidden,
withLabel: SVs.showLabel && SVs.labelForGraph !== "",
layer: 10 * SVs.layer + 7,
layer: 10 * SVs.layer + 5,
fixed,
strokeColor: SVs.selectedStyle.lineColor,
strokeOpacity: SVs.selectedStyle.lineOpacity,
Expand Down Expand Up @@ -228,7 +228,7 @@ export default React.memo(function Ray(props) {
rayJXG.current.visProp.fixed = fixed;
rayJXG.current.visProp.highlight = !fixed;

let layer = 10 * SVs.layer + 7;
let layer = 10 * SVs.layer + 5;
let layerChanged = rayJXG.current.visProp.layer !== layer;

if (layerChanged) {
Expand Down
6 changes: 3 additions & 3 deletions src/Viewer/renderers/regionBetweenCurveXAxis.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default React.memo(function RegionBetweenCurveXAxis(props) {
visible: !SVs.hidden,
withLabel: SVs.showLabel && SVs.labelForGraph !== "",
fixed: true,
layer: 10 * SVs.layer + 7,
layer: 10 * SVs.layer + 5,

fillColor,
fillOpacity: SVs.selectedStyle.fillOpacity,
Expand Down Expand Up @@ -105,7 +105,7 @@ export default React.memo(function RegionBetweenCurveXAxis(props) {
integralJXG.current.curveLeft.coords.setCoordinates(JXG.COORDS_BY_USER, [x1, y1]);
integralJXG.current.curveRight.coords.setCoordinates(JXG.COORDS_BY_USER, [x2, y2]);

let layer = 10 * SVs.layer + 7;
let layer = 10 * SVs.layer + 5;
let layerChanged = integralJXG.current.visProp.layer !== layer;

if (layerChanged) {
Expand Down Expand Up @@ -136,7 +136,7 @@ export default React.memo(function RegionBetweenCurveXAxis(props) {
integralJXG.current.needsUpdate = true;
integralJXG.current.curveLeft.update();
integralJXG.current.fullUpdate();

board.update();
board.fullUpdate();

Expand Down
4 changes: 2 additions & 2 deletions src/Viewer/renderers/vector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default React.memo(function Vector(props) {

}

let layer = 10 * SVs.layer + 7;
let layer = 10 * SVs.layer + 5;
let fixed = !SVs.draggable || SVs.fixed;

//things to be passed to JSXGraph as attributes
Expand Down Expand Up @@ -358,7 +358,7 @@ export default React.memo(function Vector(props) {
}


let layer = 10 * SVs.layer + 7;
let layer = 10 * SVs.layer + 5;
let layerChanged = vectorJXG.current.visProp.layer !== layer;

if (layerChanged) {
Expand Down

0 comments on commit be72671

Please sign in to comment.