diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index c95f50e3bb05..d454e725344b 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -2808,7 +2808,6 @@ define([ // override the rectangle dimensions if defined rectangleWidth = defaultValue(width, 3.0); rectangleHeight = defaultValue(height, rectangleWidth); - scratchRectangle = new BoundingRectangle(0.0, 0.0, rectangleWidth, rectangleHeight); var context = this._context; var us = context.uniformState; @@ -2831,6 +2830,8 @@ define([ scratchRectangle.x = drawingBufferPosition.x - ((rectangleWidth - 1.0) * 0.5); scratchRectangle.y = (this.drawingBufferHeight - drawingBufferPosition.y) - ((rectangleHeight - 1.0) * 0.5); + scratchRectangle.width = rectangleWidth; + scratchRectangle.height = rectangleHeight; var passState = this._pickFramebuffer.begin(scratchRectangle); updateEnvironment(this, passState); diff --git a/Specs/Scene/PickSpec.js b/Specs/Scene/PickSpec.js index 28fd6b324c3f..0e978e8da542 100644 --- a/Specs/Scene/PickSpec.js +++ b/Specs/Scene/PickSpec.js @@ -11,6 +11,7 @@ defineSuite([ 'Scene/Primitive', 'Scene/SceneMode', 'Specs/createScene', + 'Specs/createCanvas' ], 'Scene/Pick', function( FeatureDetection, GeometryInstance, @@ -23,7 +24,8 @@ defineSuite([ PerspectiveFrustum, Primitive, SceneMode, - createScene) { + createScene, + createCanvas) { 'use strict'; var scene; @@ -32,7 +34,7 @@ defineSuite([ var primitiveRectangle = Rectangle.fromDegrees(-1.0, -1.0, 1.0, 1.0); beforeAll(function() { - scene = createScene(); + scene = createScene({ canvas: createCanvas(10,10) }); primitives = scene.primitives; camera = scene.camera; }); @@ -106,25 +108,10 @@ defineSuite([ var rectangle = createRectangle(); - expect(scene).toPickPrimitive(rectangle,7,7,5); + expect(scene).toPickPrimitive(rectangle, 7, 7, 5); + expect(scene).notToPick(7, 7, 3); }); - it('does not pick a primitive with a modified pick search area', function() { - if (FeatureDetection.isInternetExplorer()) { - // Workaround IE 11.0.9. This test fails when all tests are ran without a breakpoint here. - return; - } - - camera.setView({ - destination : Rectangle.fromDegrees(-10.0, -10.0, 10.0, 10.0) - }); - - createRectangle(); - - expect(scene).notToPick(0,0,3); - }); - - it('does not pick primitives when show is false', function() { var rectangle = createRectangle(); rectangle.show = false; diff --git a/Specs/addDefaultMatchers.js b/Specs/addDefaultMatchers.js index 35122a4996aa..8b28b1de2216 100644 --- a/Specs/addDefaultMatchers.js +++ b/Specs/addDefaultMatchers.js @@ -263,16 +263,16 @@ define([ toPickPrimitive : function(util, customEqualityTesters) { return { - compare : function(actual, expected, x, y, size) { - return pickPrimitiveEquals(actual, expected, x, y, size); + compare : function(actual, expected, x, y, width, height) { + return pickPrimitiveEquals(actual, expected, x, y, width, height); } }; }, notToPick : function(util, customEqualityTesters) { return { - compare : function(actual, expected, x, y, size) { - return pickPrimitiveEquals(actual, undefined, x, y, size); + compare : function(actual, expected, x, y, width, height) { + return pickPrimitiveEquals(actual, undefined, x, y, width, height); } }; }, @@ -467,7 +467,7 @@ define([ function pickPrimitiveEquals(actual, expected, x, y, pickWidth, pickHeight) { var scene = actual; - var windowPosition = new Cartesian2(defaultValue(x,0), defaultValue(y,0)); + var windowPosition = new Cartesian2(x,y); var result = scene.pick(windowPosition, pickWidth, pickHeight); if (!!window.webglStub) { diff --git a/Specs/createScene.js b/Specs/createScene.js index 8be224eb2b2f..277548492693 100644 --- a/Specs/createScene.js +++ b/Specs/createScene.js @@ -20,7 +20,7 @@ define([ options = defaultValue(options, {}); // save the canvas so we don't try to clone an HTMLCanvasElement - var canvas = defined(options.canvas) ? options.canvas : createCanvas(10,10); + var canvas = defined(options.canvas) ? options.canvas : createCanvas(); options.canvas = undefined; options = clone(options, true);