我的C#程序具有以下代码:
import React, { useState, useEffect, useCallback } from "react";
import PropTypes from "prop-types";
import Container from "../Container";
const Draggable = ({ position, radius }) => {
const [state, setState] = useState({
isDragging: false,
translateX: position && position.x ? position.x : 10,
translateY: position && position.y ? position.y : 10
});
// mouse move (updates x and y coords)
const handleMouseMove = useCallback(
({ clientX, clientY }) => {
if (state.isDragging) {
setState(prevState => ({
...prevState,
translateX: clientX,
translateY: clientY
}));
}
},
[state.isDragging]
);
// mouse left click release (sets isDragging to false if true)
const handleMouseUp = useCallback(() => {
if (state.isDragging) {
setState(prevState => ({
...prevState,
isDragging: false
}));
}
}, [state.isDragging]);
// mouse left click hold (sets isDragging to true)
const handleMouseDown = useCallback(() => {
setState(prevState => ({
...prevState,
isDragging: true
}));
}, []);
useEffect(() => {
window.addEventListener("mousemove", handleMouseMove);
window.addEventListener("mouseup", handleMouseUp);
return () => {
window.removeEventListener("mousemove", handleMouseMove);
window.removeEventListener("mouseup", handleMouseUp);
};
}, [handleMouseMove, handleMouseUp]);
return (
<Container
isDragging={state.isDragging}
onMouseDown={handleMouseDown}
radius={radius || 10}
x={state.translateX}
y={state.translateY}
/>
);
};
Draggable.propTypes = {
position: PropTypes.shape({
x: PropTypes.number,
y: PropTypes.number
}),
radius: PropTypes.number
};
export default Draggable;
这是在装有matlab r2013b 64位的计算机上运行的,但是命令窗口textcreator.m不会在装有matlab r2016a 64位的其他计算机上运行。它给出了这个错误:
SELECT
date,
count(*) FILTER (WHERE score < 3) AS "low0-2",
count(*) FILTER (WHERE score > 2 AND score < 5) AS "high3-4",
count(*) FILTER (WHERE score > 4) AS "perfect"
FROM
my_scores
GROUP BY 1
ORDER BY 1;
为什么会这样?