maptalks / maptalks/maptalks.js

Please add a parameter to the "fitZoom" and "fitExtent" functions to control whether the calculation result is "cover" or "contain".

Open
#2,233 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
HTML
Stars
4.5k
Forks
511
Avg merge
3d 58m
Merged PRs (30d)
1

Description

**maptalks's version and what browser you use?**
1.0.0-rc.33 Edge/122.0.2365.92

**Issue description**
I was using the "fitZoom" function and realized that it only makes the short side of the container fit the map, similar to the css "object-fit:contain" in css. But now I need to make the map fill the whole screen, like the "object-fit:cover" in css, so I want to add a parameter to control the result of this function.

**Please provide a reproduction URL (on any jsfiddle like site)**
----

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the fitZoom and fitExtent entry points and reading how each currently calculates the fitting scale. Define the parameter's contain and cover behavior from the issue description, then add coverage for both outcomes using the repository's existing tests. Done means callers can choose either result without changing the existing default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.