-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update map-layer._registerMediaQuery so that when the observed media
attribute is removed or set to the empty string, the map-layer goes through the initialization process, as though it was newly connected to the DOM (it may go from disabled to enabled due to the removal).
- Loading branch information
1 parent
f8fff7f
commit 8e4aa79
Showing
2 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title><map-layer> media attribute test</title> | ||
<meta charset="UTF-8"> | ||
<script type="module" src="mapml.js"></script> | ||
<style> | ||
html { | ||
height: 100% | ||
} | ||
|
||
body { | ||
height: inherit | ||
} | ||
|
||
* { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<mapml-viewer data-testid="viewer" style="height: 500px;width:500px;" controls zoom="2" lat="68" lon="-87" controls projection="CBMTILE"> | ||
<!-- map loads at z=2, so both layers should be enabled --> | ||
<map-layer data-testid="initial-mq" media="(0 <= map-zoom <=3)" checked> | ||
<map-title>media query: (0 <= map-zoom <=3)</map-title> | ||
<map-meta name="projection" content="CBMTILE"></map-meta> | ||
<map-meta name="extent" content="top-left-easting=-2985112, top-left-northing=5403578, bottom-right-easting=3629485, bottom-right-northing=-1211019"></map-meta> | ||
<!<!-- to be enabled, a map-layer must have in-view content --> | ||
<map-feature min="0" max="17"><map-geometry cs="gcrs"><map-point><map-coordinates>-87 68</map-coordinates></map-point></map-geometry></map-feature> | ||
</map-layer> | ||
<!-- at z=4, only this layer should be enabled --> | ||
<map-layer data-testid="no-initial-mq" src="dummy-cbmtile-cbmt.mapml" checked></map-layer> | ||
|
||
<!-- adding a media attribute value of media="(0 <= map-zoom <=3)" to the above layer while map is at z=4 | ||
should result in the above layer being disabled until z is in range. | ||
This tests that the media attribute is 'observed' --> | ||
|
||
<!-- removing the media attribute while the above layer is disabled due to | ||
the media query mismatch should result in the layer being re-enanbled and the | ||
disable attribute cleared --> | ||
</mapml-viewer> | ||
</body> | ||
</html> |