Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>My suggestion is not to impose restriction but just drawing say just a red wireframe polygon if for you it's unacceptable.</p> <p>It's more or less like when programmers put restriction on form input fields e.g. begin date must come before end date and don't allow you to type in a date in the begin field that's after the date in the end field... forcing users to tab to end field first, then entering the end date, then tabbing back to the begin field to enter the correct begin date.</p> <p>Just showing the fields in red is MUCH more usable... and actually requires less coding.</p> <p>Trapping user mouse movements is rarely a sensible idea. If you can't apply what user is asking just make this evident instead of constraining the movement... may be the user is moving the first vertex and wants to move another vertex later to a position that will make your transform valid (exactly like the two date fields example).</p> <p>If you really think you MUST prevent invalid positions at all times (and that for example will forbid the user from flipping the image even if your transform would allow a flipping operation without problems) then the simplest solution that comes to my mind is just having an <code>isValid()</code> function and just not moving the keypoint to the new position if it's invalid.</p> <p>Having code that "slides" around invalid state space areas is IMO quite difficult to handle nicely, also because invalid areas are going to be quite close to "almost invalid" areas. Even in case "sliding" is a requirement I'd probably go for implementing an implicit <code>isValid()</code> approach by doing a local search around the keypoint position to find what is the closest valid point to the point the user is asking for.</p> <p>Explicitly computing all sliding possibilities would be a nightmare to get correct and also to maintain if you need to change something in the transformation algorithm (and consequently in what is valid and what is not).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload