map = {
var map = new PIXI.Container();
var map_container1 = new PIXI.Container();
var map_container2 = new PIXI.Container();
var map_container3 = new PIXI.Container();
map_container2.position.x = map_width;
map_container3.position.x = map_width * 2;
map_container1.interactive = true;
map_container1.hitArea = new PIXI.Rectangle(0, 0, map_width, map_height);
map_container2.interactive = true;
map_container2.hitArea = new PIXI.Rectangle(0, 0, map_width, map_height);
map_container3.interactive = true;
map_container3.hitArea = new PIXI.Rectangle(0, 0, map_width, map_height);
var graphics = new PIXI.Graphics();
var graphics2 = new PIXI.Graphics();
var graphics3 = new PIXI.Graphics();
let path1 = d3.geoPath(projection, graphics);
let path2 = d3.geoPath(projection, graphics2);
let path3 = d3.geoPath(projection, graphics3);
graphics.beginFill(0x66CCFF, 0.15);
path1(data);
graphics.endFill();
graphics2.beginFill(0x66CCFF, 0.15);
path2(data);
graphics2.endFill();
graphics2.blendMode = PIXI.BLEND_MODES.MULTIPLY;
graphics3.beginFill(0x66CCFF, 0.15);
path3(data);
graphics3.endFill();
let color_ramp_texture = PIXI.Texture.fromCanvas(color_ramp);
const uniformsData = {
u_color_ramp: {
type: 'sampler2D',
value: color_ramp_texture
}
};
let shader = new PIXI.Filter('', fragment_shader, uniformsData);
map_container1.filters = [shader];
map.addChild(map_container1);
map_container1.addChild(graphics);
map.addChild(map_container2);
map_container2.addChild(graphics2);
map.addChild(map_container3);
map_container3.addChild(graphics3);
var mouseIn_1 = false,
mouseIn_2 = false,
mouseIn_3 = false;
map_container1.on('mouseover', () => (mouseIn_1 = true));
map_container1.on('mouseout', () => (mouseIn_1 = false));
map_container1.on('mousemove', onHover1);
map_container2.on('mouseover', () => (mouseIn_2 = true));
map_container2.on('mouseout', () => (mouseIn_2 = false));
map_container2.on('mousemove', onHover2);
map_container3.on('mouseover', () => (mouseIn_3 = true));
map_container3.on('mouseout', () => (mouseIn_3 = false));
map_container3.on('mousemove', onHover3);
function onHover1(event) {
if (mouseIn_1) getOverlaps(event);
}
function onHover2(event) {
if (mouseIn_2) getOverlaps(event, map_width);
}
function onHover3(event) {
if (mouseIn_3) getOverlaps(event, map_width * 2);
}
function getOverlaps(event, offset = 0) {
let hoverx = event.data.global.x,
hovery = event.data.global.y;
let hoverx_relative = (hoverx - map.position.x) / map.scale.x - offset,
hovery_relative = (hovery - map.position.y) / map.scale.y;
let [hover_lng, hover_lat] = projection.invert([
hoverx_relative,
hovery_relative
]);
let hover_data = lookup.search(hover_lng, hover_lat, -1);
mutable clickedSheet = hover_data.features.length;
}
return map;
}