My question has two parts - the first and second part. Let's consider an example code that I am working on. I am creating a map of my country with regions, and I want to perform actions on the entire map such as scaling or translating (as seen in the commented line). Additionally, I also need to work with individual regions or only one region at a time. Since I am new to Raphaels and JavaScript, I am unsure about how to achieve this. Below is some pseudocode illustrating how I would approach it, but I know there is a better way to do it. Can someone guide me on how to proceed? Here is the code snippet:
window.onload = function() {
var p = Raphael("paper");
p.rect(0,0,600,350);
p.setStart();
var region1 = p.path("M404 ...");//I wont write all path here, "..." = rest of the path
var region2 = p.path("M173.5 ...");
//... rest of regions
var map = p.setFinish();
//map.scale(...).translate(...);// ... means just something correct is inthere
//I wanna do first for example something like this
map.region1.attr({
fill: "blue"
});
//how should I do it?
//Then second I would do also something like this
for (region in map) {
region.attr({//something...});
}
};