Commit 2bad4775 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

current zoom level is used when no zoom level is provided

parent ccfcec24
Pipeline #9156 passed with stage
in 10 minutes and 53 seconds
......@@ -65,7 +65,7 @@ var Promise = require("bluebird");
* @property {(function({modelId: number, zoom: number}): Promise|PromiseLike)} setZoom
* @property {(function(*): number)} getZoom
* @property {(function(*): PromiseLike)} openMap
* @property {function({dbOverlayName: string, [query]:string, [perfect]: boolean, [fitBounds]:boolean, [coordinates]:Point}): Promise|PromiseLike} triggerSearch
* @property {function({dbOverlayName: string, [query]:string, [perfect]: boolean, [fitBounds]:boolean, [coordinates]:Point, [zoom]:number}, [modelId]:number): Promise|PromiseLike} triggerSearch
* @property {function(): Promise|PromiseLike} clear
*/
......@@ -452,11 +452,15 @@ function createProjectMap(options) {
if (params.query !== undefined) {
return dbOverlay.searchByQuery(params.query, params.perfect, params.fitBounds);
} else if (dbOverlay instanceof SearchDbOverlay) {
var zoom = params.zoom;
if (zoom ===undefined) {
zoom = map.getSubmapById(params.modelId).getZoom();
}
return dbOverlay.searchByCoordinates({
coordinates: params.coordinates,
coordinates: new Point(params.coordinates),
modelId: params.modelId,
fitBounds: params.fitBounds,
zoom: params.zoom
zoom: zoom
});
} else {
return Promise.reject(new Error("Don't know how to handle your query"));
......
......@@ -977,6 +977,34 @@ describe('MinervaPluginProxy', function () {
return map.destroy();
});
});
it('coordinates without zoom', function () {
var callbackOk = false;
var map;
return ServerConnector.getProject().then(function (project) {
map = helper.createCustomMap(project);
helper.createSearchDbOverlay(map);
var proxy = createProxy(map);
proxy.project.map.addListener({
dbOverlayName: "search",
type: "onSearch",
callback: function (elements) {
assert.ok(elements.length > 0);
assert.ok(elements[0].length > 0);
callbackOk = true;
}
});
return proxy.project.map.triggerSearch({
coordinates: new Point(316.05, 253.61),
modelId: map.getModel().getId(),
dbOverlayName: "search"
});
}).then(function () {
assert.ok(callbackOk);
assert.equal(0, logger.getWarnings().length);
return map.destroy();
});
});
});
describe('drug', function () {
it('query search', function () {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment