-
Notifications
You must be signed in to change notification settings - Fork 120
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
Can I use ol Constructor like this? #234
Comments
Not sure about the goal. Using this lib that way, isn't what it's build for. However: the injects won't provide the direct API from Openlayers. Please have a look at the implementation. I mean: of course you can go this way (with a little adjustments). But I am wondering why? The goal of this lib is to provide a reactive declarative API which automatically applied changes on the sources/layers. When implementing features the way you do, you have to keep in mind, that it's not reactive. |
The reason I go this way is that I want to get the 'Linestring/Polygon' target drawed by 'ol-interaction-draw', and then I can remove it easier by using direct Openlayers APIs. |
Not sure if you are going the right way. Can you describe the context a bit more? Probably as kind of a user story? Maybe this helps to understand you use-case better and to point you in the right direction. |
ok, I drawed a polygon with the demo. how to remove the polygon? I can't find a way.
|
One way: move your <ol-source-vector :projection="projection" v-if="drawEnable"> And: set const drawend = (event) => {
console.log(event);
drawEnable.value = false;
}; |
Thanks , it works. But if I add points to the the source vector, when I move‘v-if‘ to the source vector, the points is also hidden. it's another problem.
|
What if you place the points in a separate layer with its own source vector? |
Thanks , it works. Another question: if it is possible to make the mouse pointer locate to the start point or end point automatically when drawing a line, just like the style implemented by 'ol-interaction-snap'?And how can I get the start point or end point in order to obtain their properties. |
Sorry I didn't catch it. Can you describe it a bit more? About the start/end point: You should receive an event for each point with all points already drawn, the first one and the last one are the relevant ones. Or did I got something wrong? |
Ok, I add the points in another layer. For example, I draw a line form point A to B, I hope the mouse automatically snaps to point A when approaching point A, snaps to point B when approaching point B.
|
@kankantian sorry but I am quite busy currently. Can you please open separate issues (snap-problem and attribute access). The original issue here has already been answered, so I will close this issue. |
ok,thanks for your time |
The text was updated successfully, but these errors were encountered: