I am currently working on an application that displays an amap view. You can do several actions on the map. A map can become very large, so the user needs a smaller map (Minimap) to track the entire map.
There are currently two phases. One for the big card, one for the mini-card. A large map contains several layers, but only one of them should be displayed on the minimap (its as a layout).
So I thought about adding EventListener for AfterDrawing a certain level.
this.layoutLayer.afterDraw(this._initMinimap);
In the Event Listener, I do the following:
//... _initMinimap : function(event) { var ctrl = event; if (!this.minimap) { this.minimap = new Kinetic.Stage({ container : 'container', width : 165, height : 165 }); } if (!this.mapLayer) { this.mapLayer = new Kinetic.Layer({}); } this.mapLayer.clear(); this.minimap.clear(); this.layoutLayer.toImage({ callback : function(img) { var image = new Kinetic.Image({ image : img }); image.setScale(0.01,0.01); ctrl.mapLayer.add(image); } }); this.minimap.add(this.mapLayer); this.minimap.draw(); }, //...
Does anyone have an idea on how to solve this problem? I am not familiar with JavaScript yet, so I'm not quite sure if this is the right approach.
Thank you in advance: -)
Ality source share