File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed
layer-3dtiles/src/layer/renderer Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 1+ import * as maptalks from 'maptalks' ;
12/**
23 * from mapbox-gl-js
34 * A [least-recently-used cache](http://en.wikipedia.org/wiki/Cache_algorithms)
@@ -77,13 +78,11 @@ class LRUCache {
7778
7879 shrink ( ) {
7980 if ( this . currentSize > this . max ) {
80- let warned = false ;
8181 const iterator = this . data . keys ( ) ;
8282 let item = iterator . next ( ) ;
8383 while ( this . currentSize > this . max && item . value !== undefined ) {
84- if ( ! warned && this . data . get ( item . value ) . current ) {
85- warned = true ;
86- console . warn ( `current maxGPUMemory(${ this . max / 1024 / 1024 } ) for Geo3DTilesLayer is not enough, one or more current tiles will be discarded.` ) ;
84+ if ( this . data . get ( item . value ) . current ) {
85+ maptalks . Util . warnOnce ( `current maxGPUMemory(${ this . max / 1024 / 1024 } ) for Geo3DTilesLayer is not enough, one or more current tiles will be discarded.` ) ;
8786 }
8887 const removedData = this . getAndRemove ( item . value ) ;
8988 if ( removedData ) {
Original file line number Diff line number Diff line change @@ -646,7 +646,7 @@ export default class GLTFMarker extends Marker {
646646 const length = vec3 . length ( [ max [ 0 ] - min [ 0 ] , max [ 1 ] - min [ 1 ] , max [ 2 ] - min [ 2 ] ] ) ;
647647 const pixelSize = length / map . getGLScale ( ) ;
648648 if ( pixelSize < 20 ) {
649- console . warn ( 'Model\'s size on screen is too small, try to increase its symbol.scaleX/Y/Z' ) ;
649+ Util . warnOnce ( 'Model\'s size on screen is too small, try to increase its symbol.scaleX/Y/Z' ) ;
650650 this . fire ( 'smallonscreen' ) ;
651651 }
652652 }
Original file line number Diff line number Diff line change @@ -153,3 +153,11 @@ export function toRadian(d: number) {
153153export function toDegree ( r : number ) {
154154 return r / pi ;
155155}
156+
157+ const warned = new Set ( ) ;
158+ export function warnOnce ( message ) {
159+ if ( ! warned . has ( message ) ) {
160+ console . warn ( message ) ;
161+ warned . add ( message ) ;
162+ }
163+ }
You can’t perform that action at this time.
0 commit comments