optimize scaleGrid