Your requirements are a bit vague: what happens with the stroke color?
Should it take into account layers? Should it take into account the color
of the background? How are you limiting the colors to black and white? If I
select the rectangle tool, start dragging from a "banned" area, but the end
of the drag in an "allowed" area, should the rectangle still be created?
A very basic implementation of what you're trying to achieve can be done by
adding these lines at lne 2357 of svgcanvas.js:
var hitColor = evt.target.getAttribute("fill");
var currentColor = document.querySelector("#fill_color
rect").getAttribute("fill");
if (hitColor === currentColor) {
alert("same color");
return;
}
Hopefully this can help you get started coding your modification.
Mark
On Tue, Nov 13, 2012 at 12:24 AM, nicholaskyriakides <
nicholas.kyriaki
...@my.westminster.ac.uk> wrote:
> I need a modification on the application that will only allow the user to
> draw WHITE filled objects on top of ONLY BLACK FILLED objects. The white
> objects must overlap at least at one point with a black filled object
> otherwise an error message should appear, or not draw the object at all.
> Basically i need to forbid the user of drawing invinsible objects(
> white-on-white), or (black on black).
> The objects must overlap at least at some point otherwise this must be
> forbidden.
> Do you have any suggestions?
> I know my question is nearly impossible to answer but i though i try all
> available avenues for help. I am also offering payment if someone figures
> this out(i dont know if its forbidden to state this here, if it is just
> ignore me!:P).
> --
> You received this message because you are subscribed to the Google Groups
> "svg-edit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/svg-edit/-/wGeiE6NPwBYJ.
> To post to this group, send email to svg-edit@googlegroups.com.
> To unsubscribe from this group, send email to
> svg-edit+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/svg-edit?hl=en.
--
Mark MacKay
+011 (52) 984 125 4042
http://duopixel.ca