1 decade ago by OLee
Hello impactors,
i had some trouble to pick entities drawn on top of other entities (ordered by the zIndex). The mouse entity selection stops at the first touching entity. Which is in most cases not the correct one. So i wrote a quick fix for this annoying behaviour.
just replace the selectEntityAt function in lib/weltmeister/edit-entities.js with this one:
i had some trouble to pick entities drawn on top of other entities (ordered by the zIndex). The mouse entity selection stops at the first touching entity. Which is in most cases not the correct one. So i wrote a quick fix for this annoying behaviour.
just replace the selectEntityAt function in lib/weltmeister/edit-entities.js with this one:
selectEntityAt: function( x, y ) { var collected = [],i,ent; this.selector.pos = { x: x, y: y }; for(i = 0; i < this.entities.length; i++ ) { ent = this.entities[i]; if( ent.touches(this.selector) ) { collected.push(ent); } } collected.sort(function(a,b){ return a.zIndex < b.zIndex; }); if(collected.length && collected[0]){ ent = collected[0]; this.selector.offset = {x: (x - ent.pos.x + ent.offset.x), y: (y - ent.pos.y + ent.offset.y)}; this.selectEntity( ent ); this.wasSelectedOnScaleBorder = this.isOnScaleBorder( ent, this.selector ); return ent; } this.selectEntity( null ); return false; },