@@ -12,13 +12,11 @@ import { getDefaultVAlign, getDefaultHAlign, DEFAULT_MARKER_SYMBOLS } from '../.
1212import { Geometry } from '../../../geometry' ;
1313import Painter from '../Painter' ;
1414import { Extent } from '../../../geo' ;
15- import { ResourceCache } from '../../layer/CanvasRenderer' ;
16- import { getDefaultBBOX , resetBBOX } from '../../../core/util/bbox' ;
15+ import { ResourceCache } from '../../layer/LayerAbstractRenderer' ;
1716
1817const MARKER_SIZE : [ number , number ] = [ 0 , 0 ] ;
1918const TEMP_EXTENT = new PointExtent ( ) ;
2019const DEFAULT_ANCHOR = new Point ( 0 , 0 ) ;
21- const TEMP_BBOX = getDefaultBBOX ( ) ;
2220
2321export default class VectorMarkerSymbolizer extends PointSymbolizer {
2422 //@internal
@@ -68,16 +66,14 @@ export default class VectorMarkerSymbolizer extends PointSymbolizer {
6866 this . geometry . getLayer ( ) . getMask ( ) === this . geometry ||
6967 this . _dynamic ||
7068 this . geometry . getLayer ( ) . options [ 'cacheVectorOnCanvas' ] === false ) {
71- //动态样式或者不缓存,function-type style, or not cache vector on canvas
72- this . _drawMarkersWithDynamic ( ctx , cookedPoints , resources ) ;
69+ this . _drawMarkers ( ctx , cookedPoints , resources ) ;
7370 } else {
7471 this . _drawMarkersWithCache ( ctx , cookedPoints , resources ) ;
7572 }
7673 }
7774
78- //rename to _drawMarkersWithDynamic
7975 //@internal
80- _drawMarkersWithDynamic ( ctx : CanvasRenderingContext2D , cookedPoints : any [ ] , resources : ResourceCache ) {
76+ _drawMarkers ( ctx : CanvasRenderingContext2D , cookedPoints : any [ ] , resources : ResourceCache ) {
8177 for ( let i = cookedPoints . length - 1 ; i >= 0 ; i -- ) {
8278 let point = cookedPoints [ i ] ;
8379 const size = calVectorMarkerSize ( MARKER_SIZE , this . style ) ;
@@ -94,17 +90,13 @@ export default class VectorMarkerSymbolizer extends PointSymbolizer {
9490 this . rotations . push ( rad ) ;
9591 }
9692
97- const bbox = this . _drawVectorMarker ( ctx , point , resources ) ;
93+ this . _drawVectorMarker ( ctx , point , resources ) ;
9894 if ( origin ) {
9995 ctx . restore ( ) ;
10096 this . _setBBOX ( ctx , extent . xmin , extent . ymin , extent . xmax , extent . ymax ) ;
10197 } else {
102- if ( bbox ) {
103- this . _setBBOX ( ctx , bbox [ 0 ] , bbox [ 1 ] , bbox [ 2 ] , bbox [ 3 ] ) ;
104- } else {
105- const { x, y } = point ;
106- this . _setBBOX ( ctx , x , y , x + width , y + height ) ;
107- }
98+ const { x, y } = point ;
99+ this . _setBBOX ( ctx , x , y , x + width , y + height ) ;
108100 }
109101 }
110102 }
@@ -211,21 +203,15 @@ export default class VectorMarkerSymbolizer extends PointSymbolizer {
211203
212204 //@internal
213205 _drawVectorMarker ( ctx : CanvasRenderingContext2D , point : Point , resources : ResourceCache ) {
214- resetBBOX ( TEMP_BBOX ) ;
215- drawVectorMarker ( ctx , point , this . style , resources , TEMP_BBOX ) ;
216- return TEMP_BBOX ;
206+ drawVectorMarker ( ctx , point , this . style , resources ) ;
217207 }
218208
219209 getFixedExtent ( ) : PointExtent {
220- // const isDynamic = this.isDynamicSize();
221- // const w = this.style.markerWidth;
222- // const h = this.style.markerHeight;
223- // this._fixedExtent = this._fixedExtent || new PointExtent();
224- // return getVectorMarkerFixedExtent(this._fixedExtent, this.style, isDynamic ? [128, 128 * (w === 0 ? 1 : h / w)] : null);
225-
210+ const isDynamic = this . isDynamicSize ( ) ;
211+ const w = this . style . markerWidth ;
212+ const h = this . style . markerHeight ;
226213 this . _fixedExtent = this . _fixedExtent || new PointExtent ( ) ;
227- return getVectorMarkerFixedExtent ( this . _fixedExtent , this . style , null ) ;
228-
214+ return getVectorMarkerFixedExtent ( this . _fixedExtent , this . style , isDynamic ? [ 128 , 128 * ( w === 0 ? 1 : h / w ) ] : null ) ;
229215 }
230216
231217 translate ( ) : any {
0 commit comments