UNPKG

dps_canvas

Version:

Html canvas üzerinde şekiller oluşturmanızı sağlar

29 lines (25 loc) 782 B
import Base from "../parent"; const SCOPES = { canView: "can-view", canDrawing: "can-drawing", canShowInput: "can-show-input", canResizable: "can-resizable", canDelete: "can-delete", canMove: "can-move" } /** * TODO * * resize fonksiyonu düzeltilip admin yetkisine eklenecek */ const PERMISSIONS = { onlyView: [SCOPES.canView], admin: [SCOPES.canView, SCOPES.canShowInput, SCOPES.canDrawing, SCOPES.canMove, SCOPES.canDelete] } /** * * @param {Array<"can-view" | "can-drawing" | "can-show-input" | "can-resizable" | "can-move" | "can-delete">} desired */ export const hasPermission = (...desired) => { const permissions = PERMISSIONS[Base.permission] return desired?.map(ds => permissions?.includes(ds)).every(Boolean); }