npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mapbox-draw-expand

v1.4.5

Published

Expanded development based on mapbox-gl-draw

Downloads

42

Readme

mapbox-draw-expand

npm version

Expanded development based on mapbox-gl-draw.

CHANGE LOGS

1.3.5

FEAT: support removeLayer.

1.3.4 1.3.3

FIX: delete auxiliaryLine.

1.3.2

DOCS: update change logs.

1.3.1

FIX: Optimize the adsorption effect.

1.3.0

FEAT: support Angle Snapping.

Use this function to draw segment that is parallel, perpendicular or at precisely defined angles (30°, 45°, 60°, 90°) degrees to the base segment.

Basic usage

  1. Activate Draw mode as usual
  2. To select base segment:
    • click Right mouse click on segment you want to use as reference OR
    • move mouse that you can choose the direction of next segment to make specific angle between segments (0,30,45,90, degrees etc.).
  3. Angle snapping mode will snap angle of the new segments to predefined list of angles - thus it's name

EXPAND FUNCTIONS

  • [x] In the simple_select or direct_mode, hold Esc to switch to simple_select mode and clear all selected features.
  • [x] In the simple_select mode, hold down shift + e to select the feature that has an intersection with the selected feature. And hold down shift + r to select all.
  • [x] In the direct_select mode and the seleted feature's type is LineString, when you select the first or last vertex, press and hold shift + q to enter the draw_line_string mode. This allows you to continue drawing the current feature.
  • [x] In the simple_select mode, if some features are selected, press ctrl + v to paste the features, and the new features will be rendered to the position centered on the mouse position.

NOTES

同层吸附说明

// 进入绘制 mode 时会触发 draw.drawingInit 事件,可在此设置绘制图形的属性
map.on('draw.drawingInit', function(e) {
    Draw.setFeatureProperty(e.featureId, 'level', 1);
})

// mapbox-gl-draw 初始化时增加 adsorbFilterFunc 配置项
/**
 * 可吸附 features 过滤
 * @param {Object} nowFeature 当前绘制 feature
 * @param {Array<Object>} allAdsorbFeatures 当前鼠标位置下可吸附的 features
 * @return {Array<Object>} 返回所有可吸附的 features 集合 默认为 allAdsorbFeatures
 */
{
    ...
    adsorbFilterFunc: (nowFeature, allAdsorbFeatures) => {
        return allAdsorbFeatures.filter(v => Number(v.properties.level) === Number(nowFeature.properties.level));
    }
}