Comments (6)
Hey, @JamesLMilner . The new features have been used just now, and there are still some problems. The restrictions on the area are equivalent to the restrictions of the radius. I have implemented it in the test demo, but there is a problem. If you quickly move the mouse to enlarge and shrink, it can also be said that it can also be said that Pressure testing, he will break through this limit. For example, the area is 1,000 square meters, and occasionally less than 1000, which may be related to the execution process of the entire program.
The new version will still have irregular circles, and you need to trouble you to adjust.
from terra-draw.
Hey, @JamesLMilner ,In editing mode and without setting the minimum distance. This issue may occur.
from terra-draw.
Hey @Thunder7991 - eventually I'm thinking of adding a function that allows you to set your own custom constraints before committing and edit. This should resolve this problem and be flexible enough to avoid any similar issues (i.e. you could set a minimum area/radius etc)
from terra-draw.
Regarding the issue of circles disappearing when scaled to a very small size. I solved it this way :
drag-coordinate-resize.behavior.ts
public drag {
...
if(scale < 0) {
return false
}
...
}
This ensures that the circle will not disappear abnormally when zoomed in very small.
from terra-draw.
Hey @Thunder7991 - eventually I'm thinking of adding a function that allows you to set your own custom constraints before committing and edit. This should resolve this problem and be flexible enough to avoid any similar issues (i.e. you could set a minimum area/radius etc)
🙌 @JamesLMilner , I can feel that you are very busy now. In addition, when I turned off the function of mouse following point movement when zooming in circles (previous versions), and added a limit on the minimum radius when zooming in, there were calculation errors when the mouse was moving quickly, such as a minimum of 10 kilometers. If I moved normally, the radius would not be less than 10 kilometers, but sometimes it would be less than 10 kilometers. In the end, I abandoned the method of limiting the zoom radius, and the final solution was to avoid the sudden disappearance of the circle as shown in the code above. I am looking forward to your reply and a better solution.
from terra-draw.
In version 0.0.1-alpha.64
- you can now use the validation
property flag to pass a function.
You can do something like this:
const selectMode = new TerraDrawSelectMode({
flags: {
circle: {
feature: {
// The entire Feature can be moved
draggable: true,
// Individual coordinates that make up the Feature...
coordinates: {
// Can be added
midpoints: true,
// Can be moved
draggable: true,
// Allow resizing of the geometry from a given origin.
// center-web-mercator will allow resizing of the aspect ratio from the center
// and opposite-web-mercator allows resizing from the opposite corner of the
// bounding box of the geometry.
resizeable: 'center-web-mercator', // can also be 'opposite-web-mercator', 'center-fixed-web-mercator', 'opposite-fixed-web-mercator'
// Can be deleted
deletable: true,
// Provide a custom validation that will run when we attempt to edit the geometry
validation: (feature) => {
// ValidateMinSizeSquareMeters can be imported from Terra Draw
return feature.geometry.type !== "Polygon" && ValidateMinSizeSquareMeters(feature.geometry, 1000);
}
},
},
},
},
});
Here ValidateMinSizeSquareMeters
is exposed from Terra Draw for convenience, but you can do any sort of validation you like to ensure the circle is correct.
from terra-draw.
Related Issues (20)
- A method for real-time acquisition of circular radius HOT 1
- Draw a circle and add a minimum radius configuration attribute HOT 1
- Enhance opposite-planar HOT 2
- The radiusKilometers attribute was not updated when scaling a circle #221 HOT 1
- Add attributes that can limit the minimum area for drawing HOT 1
- Graphics editing status, no Finish event triggered. HOT 4
- Set Node 20/npm 10 as the default environment for development
- [Bug] Circular shape abnormality in editing state HOT 7
- [Feature Request] Added polygon point adsorption function HOT 1
- [Feature Request] Support custom validation when performing edits in Select mode HOT 1
- [Bug] Broken links in README
- Circle editing status, fast scaling issue HOT 1
- [Feature Request] Bring validation functionality from select mode to all drawing modes
- [Potential Bug] The circle is scaled repeatedly, causing irregular shape problems.
- [Bug] Property 'getCoordinatePrecision' is missing in type 'TerraDrawMapLibreGLAdapter' HOT 9
- [Bug] Issue with right click to delete removing multiple coordinates whilst polygon/linestring editing HOT 6
- [Feature Request] There should be dedicated event for coordinate "drag end" HOT 1
- [Potential Bug] Unexpected result of polygon editing HOT 2
- [Roadmap] Road to v1!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terra-draw.