PageSourceSearch

https://pdfedit.com/v2/js/interaction/SelectionManager.js

js pdfedit.com collected 2026-09-28 07:08:58 UTC 1,472 bytes, 3 lines download raw bytes

1/*! PDF Edit (c) 2026 pdfedit.com — All rights reserved. Source files are MIT/Apache-licensed third-party libraries plus original work. Copying, redistribution, or derivative works require attribution. Contact: [email protected] */
2/*! PDF Edit (c) 2026 pdfedit.com — All rights reserved. Source files are MIT/Apache-licensed third-party libraries plus original work. Copying, redistribution, or derivative works require attribution. Contact: [email protected] */
3import{state as s}from"../state.js";import*as l from"../elements/registry.js";function u(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}export const SelectionManager={select(e){const t=l.get(e);!t||!t.selectable||t.locked||(s.selectedIds=new Set([e]))},toggleSelect(e){const t=l.get(e);if(!t||!t.selectable||t.locked)return;const c=new Set(s.selectedIds);c.has(e)?c.delete(e):c.add(e),s.selectedIds=c},deselectAll(){s.selectedIds.size!==0&&(s.selectedIds=new Set)},selectInRect(e,t,c,n,r){const i={x:e,y:t,width:c,height:n},g=l.getByPage(r),o=new Set;for(const d of g){if(!d.visible||!d.selectable||d.locked)continue;const h=d.getBounds();u(i,h)&&o.add(d.id)}s.selectedIds=o},getSelected(){const e=[];for(const t of s.selectedIds){const c=l.get(t);c&&e.push(c)}return e},getSelectedIds(){return new Set(s.selectedIds)},isSelected(e){return s.selectedIds.has(e)},hasSelection(){return s.selectedIds.size>0},setHovered(e){s.hoveredId=e},clearHovered(){s.hoveredId=null}};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.