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

is there someone who managed to make it working in react #36

Open
otiza opened this issue May 17, 2023 · 3 comments
Open

is there someone who managed to make it working in react #36

otiza opened this issue May 17, 2023 · 3 comments

Comments

@otiza
Copy link

otiza commented May 17, 2023

is there a way to make it work in react?

@abewartech
Copy link

i used this on react

import './trackplayback/control.trackplayback';
import './trackplayback/leaflet.trackplayback';
import './trackplayback/control.playback.css';

const areEqual = (prevProps, nextProps) => {
return false;
};
const TrackPlay = React.memo((props) => {
const context = useLeafletContext();
const Options = {
clockOptions: {
speed: 9,
maxSpeed: 30,
},
trackPointOptions: {
isDraw: true,
useCanvas: true,
stroke: false,
color: '#ef0300',
fill: true,
fillColor: '#ef0300',
opacity: 0.5,
radius: 4,
},
trackLineOptions: {
isDraw: true,
stroke: true,
color: '#1C54E2',
weight: 2,
fill: false,
fillColor: '#000',
opacity: 0.5,
},
targetOptions: {
useImg: false,
width: 10,
height: 20,
},
};

// useEffect(() => {
const container = context.layerContainer || context.map;
const playback = L.trackplayback(
	props.data,
	// [JSON.parse(JSON.stringify(props.data))],
	// test,
	container,
	Options,
);
const trackplaybackControl = L.trackplaybackcontrol(playback, {
	position: 'bottomright',
});
// props.setTrackPlaybackControl(trackplaybackControl)
// props.setTrackPlaybackContainer(container)

// setContainerRef(container)
// setPlaybackControl(trackplaybackControl)
window.control = trackplaybackControl;
window.container = container;
trackplaybackControl.addTo(container);
// return () => {
// trackplaybackControl.remove();
// };

// setTimeout(() => {
// 	// trackplaybackControl.addTo(container);
// 	trackplaybackControl.remove();
// }, 5000);
// });

return null;

}, areEqual);

@otiza
Copy link
Author

otiza commented Sep 25, 2023

thank you

@bcaure
Copy link

bcaure commented Oct 20, 2023

please close this issue @otiza

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants