Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Gemetry getContainerExtent is error when markerWidth is 0 #2176

Merged
merged 3 commits into from
Jan 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix typo
deyihu committed Jan 1, 2024
commit 09f77a89bdffcfa1fb2a861101f52605a615ffb0
4 changes: 2 additions & 2 deletions src/geometry/Geometry.js
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ const TEMP_POINT0 = new Point(0, 0);
const TEMP_EXTENT = new PointExtent();
const TEMP_PROPERTIES = {};

function validteExtent(extent) {
function validateExtent(extent) {
if (!extent) {
return false;
}
@@ -461,7 +461,7 @@ class Geometry extends JSONAble(Eventable(Handlerable(Class))) {
}
if (extent) {
const fixedExtent = this._getFixedExtent();
if (validteExtent(fixedExtent)) {
if (validateExtent(fixedExtent)) {
extent._add(fixedExtent);
}
}
1 change: 0 additions & 1 deletion src/renderer/geometry/symbolizers/ImageMarkerSymbolizer.js
Original file line number Diff line number Diff line change
@@ -24,7 +24,6 @@ export default class ImageMarkerSymbolizer extends PointSymbolizer {
symbolize(ctx, resources) {
const style = this.style;
if (!this.painter.isHitTesting() && (style['markerWidth'] === 0 || style['markerHeight'] === 0 || style['markerOpacity'] === 0)) {
this._resetBBOX(ctx);
return;
}
const cookedPoints = this._getRenderContainerPoints();
7 changes: 1 addition & 6 deletions src/renderer/geometry/symbolizers/Symbolizer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { COLOR_PROPERTIES } from '../../../core/Constants';
import { isString } from '../../../core/util';
import { bufferBBOX, getDefaultBBOX, resetBBOX, setBBOX } from '../../../core/util/bbox';
import { bufferBBOX, getDefaultBBOX, setBBOX } from '../../../core/util/bbox';

/**
* @classdesc
@@ -21,11 +21,6 @@ class Symbolizer {
}
return this;
}
_resetBBOX(ctx) {
if (!ctx.isHitTesting) {
resetBBOX(this.bbox);
}
}

_bufferBBOX(ctx, bufferSize = 0) {
if (!ctx.isHitTesting) {
1 change: 0 additions & 1 deletion src/renderer/geometry/symbolizers/TextMarkerSymbolizer.js
Original file line number Diff line number Diff line change
@@ -36,7 +36,6 @@ export default class TextMarkerSymbolizer extends PointSymbolizer {
if (!this.painter.isHitTesting() && (this.style['textSize'] === 0 ||
!this.style['textOpacity'] && (!this.style['textHaloRadius'] || !this.style['textHaloOpacity']) ||
this.style['textWrapWidth'] === 0)) {
this._resetBBOX(ctx);
return;
}
const cookedPoints = this._getRenderContainerPoints();
Original file line number Diff line number Diff line change
@@ -38,7 +38,6 @@ export default class VectorMarkerSymbolizer extends PointSymbolizer {
const style = this.style;
if (!this.painter.isHitTesting() && (style['markerWidth'] === 0 || style['markerHeight'] === 0 ||
(style['polygonOpacity'] === 0 && style['lineOpacity'] === 0))) {
this._resetBBOX(ctx);
return;
}
const cookedPoints = this._getRenderContainerPoints();
7 changes: 2 additions & 5 deletions test/geometry/MarkerSpec.js
Original file line number Diff line number Diff line change
@@ -910,7 +910,7 @@ describe('Geometry.Marker', function () {
done();
});

it('#2175 marker ContainerExtent/RenderBBOX when markerWidth/markerHeight/textSize =0', function (done) {
it('#2175 marker ContainerExtent when markerWidth/markerHeight/textSize =0', function (done) {
const imageSymbol = {
markerWidth: 10,
markerHeight: 10,
@@ -957,8 +957,7 @@ describe('Geometry.Marker', function () {
const extent = point.getContainerExtent();
expect(extent.getWidth()).not.to.be.eql(0);
expect(extent.getHeight()).not.to.be.eql(0);
const bbox = point._getPainter().getRenderBBOX();
expect(bbox[0]).not.to.be.eql(Infinity);

if (isText) {
symbol.textSize = 0;
point.setSymbol(symbol)
@@ -971,8 +970,6 @@ describe('Geometry.Marker', function () {
const extent = point.getContainerExtent();
expect(extent.getWidth()).to.be.eql(0);
expect(extent.getHeight()).to.be.eql(0);
const bbox = point._getPainter().getRenderBBOX();
expect(bbox).to.be.eql(null);
idx++;
test();
}, 50);