From 64c2656a5836deae4823d8214faf48192ffc5073 Mon Sep 17 00:00:00 2001 From: Quentin Roy Date: Fri, 8 Apr 2022 17:58:12 +0200 Subject: [PATCH] feat: increase submenu opening delay --- docs/vendors/marking-menu.js | 4 ++-- docs/vendors/marking-menu.js.map | 2 +- src/main.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/vendors/marking-menu.js b/docs/vendors/marking-menu.js index b9edf06..28fba91 100644 --- a/docs/vendors/marking-menu.js +++ b/docs/vendors/marking-menu.js @@ -7,7 +7,7 @@ * * Marking Menus may be patented independently from this software. * - * Date: Fri, 08 Apr 2022 15:53:10 GMT + * Date: Fri, 08 Apr 2022 15:57:23 GMT */ (function (global, factory) { @@ -1432,7 +1432,7 @@ let { minSelectionDist = 40, minMenuSelectionDist = 80, - subMenuOpeningDelay = 25, + subMenuOpeningDelay = 100, movementsThreshold = 5, noviceDwellingTime = 1000 / 3, strokeColor = '#000', diff --git a/docs/vendors/marking-menu.js.map b/docs/vendors/marking-menu.js.map index 039f4cc..684aeef 100644 --- a/docs/vendors/marking-menu.js.map +++ b/docs/vendors/marking-menu.js.map @@ -1 +1 @@ -{"version":3,"file":"marking-menu.js","sources":["src/utils.js","src/move/pointer-events.js","src/move/linear-drag.js","src/move/long-move.js","src/move/dwelling.js","src/move/draw.js","src/navigation/novice-navigation.js","src/recognizer/find-points.js","src/recognizer/articulation-points.js","src/recognizer/stroke-length.js","src/recognizer/recognize-mm-stroke.js","src/navigation/expert-navigation.js","src/navigation/navigation.js","node_modules/style-inject/dist/style-inject.es.js","src/layout/menu.js","src/layout/stroke.js","node_modules/raf-schd/dist/raf-schd.esm.js","src/layout/connect.js","src/layout/gesture-feedback.js","src/model.js","src/main.js"],"sourcesContent":["/**\n * @param {number} a the dividend\n * @param {number} n the divisor\n * @return {number} The modulo of `a` over `n` (% is not exactly modulo but remainder).\n */\nexport const mod = (a, n) => ((a % n) + n) % n;\n\n/**\n * @param {number} radians an angle in radians\n * @return {number} The angle in degrees.\n */\nexport const radiansToDegrees = (radians) => radians * (180 / Math.PI);\n\n/**\n * @param {number} degrees an angle in degrees\n * @return {number} The angle in radians.\n */\nexport const degreesToRadians = (degrees) => degrees * (Math.PI / 180);\n\n/**\n * @param {number} alpha a first angle (in degrees)\n * @param {number} beta a second angle (in degrees)\n * @return {number} The (signed) delta between the two angles (in degrees).\n */\nexport const deltaAngle = (alpha, beta) => mod(beta - alpha + 180, 360) - 180;\n\n/**\n * Calculate the euclidean distance between two\n * points.\n *\n * @param {List} point1 - The first point\n * @param {List} point2 - The second point\n * @return {number} The distance between the two points.\n */\nexport const dist = (point1, point2) => {\n const sum = point1.reduce((acc, x1i, i) => {\n const x2i = point2[i];\n return acc + (x2i - x1i) ** 2;\n }, 0);\n return Math.sqrt(sum);\n};\n\nconst ANGLE_ROUNDING = 10e-8;\n/**\n * @param {number[]} a - The first point.\n * @param {number[]} b - The second point, center of the angle.\n * @param {number[]} c - The third point.\n * @return {number} The angle abc (in degrees) rounded at the 8th decimal.\n */\nexport const angle = (a, b, c) => {\n const lab = dist(a, b);\n const lbc = dist(b, c);\n const lac = dist(a, c);\n const cos = (lab ** 2 + lbc ** 2 - lac ** 2) / (2 * lab * lbc);\n // Due to rounding, it can happen than cos ends up being slight > 1 or slightly < -1.\n // This fixes it.\n const adjustedCos = Math.max(-1, Math.min(1, cos));\n const angleABC = radiansToDegrees(Math.acos(adjustedCos));\n // Round the angle to avoid rounding issues.\n return Math.round(angleABC / ANGLE_ROUNDING) * ANGLE_ROUNDING;\n};\n\n/**\n * @callback findMaxEntryComp\n * @param {*} item1 - A first item.\n * @param {*} item2 - A second item.\n * @return {number} A positive number if the second item should be ranked higher than the first,\n * a negative number if it should be ranked lower and 0 if they should be ranked\n * the same.\n */\n\n/**\n * @param {List} list - A list of items.\n * @param {findMaxEntryComp} comp - A function to calculate a value from an item.\n * @return {[index, item]} The found entry.\n */\nexport const findMaxEntry = (list, comp) =>\n list.slice(0).reduce(\n (result, item, index) => {\n if (comp(result[1], item) > 1) return [index, item];\n return result;\n },\n [0, list[0]]\n );\n\n/**\n * Converts the coordinates of a point in polar coordinates (angle in degrees).\n *\n * @param {number[]} point - A point.\n * @param {number[]} [pole=[0, 0]] - The pole of a polar coordinate\n * system\n * @return {{azymuth, radius}} The angle coordinate of the point in the polar\n * coordinate system in degrees.\n */\nexport const toPolar = ([px, py], [cx, cy] = [0, 0]) => {\n const x = px - cx;\n const y = py - cy;\n return {\n azymuth: radiansToDegrees(Math.atan2(y, x)),\n radius: Math.sqrt(x * x + y * y),\n };\n};\n","// Create a custom pointer event from a touch event.\nexport const createPEventFromTouchEvent = (touchEvt) => {\n const touchList = Array.from(touchEvt.targetTouches);\n const sumX = touchList.reduce((acc, t) => acc + t.clientX, 0);\n const sumY = touchList.reduce((acc, t) => acc + t.clientY, 0);\n const meanX = sumX / touchList.length;\n const meanY = sumY / touchList.length;\n return {\n originalEvent: touchEvt,\n position: [meanX, meanY],\n timeStamp: touchEvt.timeStamp,\n };\n};\n\n// Create a custom pointer from a mouse event.\nexport const createPEventFromMouseEvent = (mouseEvt) => ({\n originalEvent: mouseEvt,\n position: [mouseEvt.clientX, mouseEvt.clientY],\n timeStamp: mouseEvt.timeStamp,\n});\n","import { fromEvent, of, merge } from 'rxjs';\nimport {\n map,\n takeUntil,\n publishBehavior,\n filter,\n startWith,\n} from 'rxjs/operators';\nimport {\n createPEventFromMouseEvent,\n createPEventFromTouchEvent,\n} from './pointer-events';\n\n// Higher order observable tracking mouse drags.\nexport const mouseDrags = (rootDOM) =>\n fromEvent(rootDOM, 'mousedown').pipe(\n map((downEvt) => {\n // Make sure we include the first mouse down event.\n const drag$ = merge(of(downEvt), fromEvent(rootDOM, 'mousemove')).pipe(\n takeUntil(fromEvent(rootDOM, 'mouseup')),\n // Publish it as a behavior so that any new subscription will\n // get the last drag position.\n publishBehavior()\n );\n drag$.connect();\n return drag$;\n }),\n map((o) => o.pipe(map((...args) => createPEventFromMouseEvent(...args))))\n );\n\n// Higher order observable tracking touch drags.\nexport const touchDrags = (rootDOM) =>\n fromEvent(rootDOM, 'touchstart').pipe(\n // Menu is supposed to have pointer-events: none so we can safely rely on\n // targetTouches.\n filter((evt) => evt.targetTouches.length === 1),\n map((firstEvent) => {\n const drag$ = fromEvent(rootDOM, 'touchmove').pipe(\n startWith(firstEvent),\n takeUntil(\n merge(\n fromEvent(rootDOM, 'touchend'),\n fromEvent(rootDOM, 'touchcancel'),\n fromEvent(rootDOM, 'touchstart')\n ).pipe(filter((evt) => evt.targetTouches.length !== 1))\n ),\n publishBehavior()\n );\n // FIXME: the line below retains the subscription until next touch end.\n drag$.connect();\n return drag$;\n }),\n map((o) => o.pipe(map(createPEventFromTouchEvent)))\n );\n\n/**\n * @param {HTMLElement} rootDOM - the DOM element to observe pointer events on.\n * @return {Observable} A higher order observable that drag observables. The sub-observables are\n * published as behaviors so that any new subscription immediately get the last\n * position.\n * @param {function[]} [dragObsFactories] - factory to use to observe drags.\n */\nconst watchDrags = (rootDOM, dragObsFactories = [touchDrags, mouseDrags]) =>\n merge(...dragObsFactories.map((f) => f(rootDOM)));\n\nexport default watchDrags;\n","import { scan, filter, map } from 'rxjs/operators';\nimport { dist } from '../utils';\n\n/**\n * Filter out small movements out of a drag observable.\n * @param {Observable} drag$ - An observable on drag movements.\n * @param {number} movementsThreshold - The threshold below which movements are considered\n * static.\n * @return {Observable} An observable only emitting on long enough movements.\n */\nexport default (drag$, movementsThreshold = 0) =>\n drag$.pipe(\n scan(([prev], cur) => {\n // Initial value.\n if (prev == null) return [cur, false];\n\n // End of drag can never be a long move. Such events aren't supposed to be\n // emitted by drag observable though.\n if (cur.type === 'end' || cur.type === 'cancel') return [cur, false];\n\n // If the distance is still below the threshold, re-emit the previous\n // event. It will be filtered-out later, but will come back again as\n // prev on the next scan call.\n if (dist(prev.position, cur.position) < movementsThreshold)\n return [prev, false];\n\n // Otherwise, emit the new event.\n return [cur, true];\n }, []),\n filter(([, pass]) => pass),\n map((x) => x[0])\n );\n","import { merge } from 'rxjs';\nimport {\n debounceTime,\n takeUntil,\n first,\n withLatestFrom,\n last,\n} from 'rxjs/operators';\nimport longMoves from './long-move';\n\n/**\n * @param {Observable} drag$ - An observable on drag movements.\n * @param {number} delay - The time (in ms) to wait before considering an absence of movements\n * as a dwell.\n * @param {number} [movementsThreshold=0] - The threshold below which movements are considered\n * static.\n * @param {Scheduler} [scheduler] - The scheduler to use for managing the timers that handle the timeout\n * for each value\n * @return {Observable} An observable on dwellings in the movement.\n */\nexport default (drag$, delay, movementsThreshold = 0, scheduler = undefined) =>\n merge(drag$.pipe(first()), longMoves(drag$, movementsThreshold)).pipe(\n // Emit when no long movements happend for delay time.\n debounceTime(delay, scheduler),\n // debounceTime emits the last item when the source observable completes.\n // We don't want that here so we only take until drag is done.\n takeUntil(drag$.pipe(last())),\n // Make sure we do emit the last position.\n withLatestFrom(drag$, (_, last_) => last_)\n );\n","import { scan } from 'rxjs/operators';\n\n/**\n * Augment a drag$ observable so that events also include the stroke.\n * @param {Observable} drag$ - An observable of drag movements.\n * @param {List} initStroke - Initial stroke.\n * @return {Observable} An observable on the gesture drawing.\n */\nexport default (drag$, { initStroke = [], type = undefined }) => {\n const typeOpts = type === undefined ? {} : { type };\n return drag$.pipe(\n scan(\n (acc, notification) => ({\n stroke: [...acc.stroke, notification.position],\n ...typeOpts,\n ...notification,\n }),\n { stroke: initStroke }\n )\n );\n};\n","import { merge } from 'rxjs';\nimport {\n scan,\n startWith,\n share,\n last,\n map,\n filter,\n switchAll,\n take,\n} from 'rxjs/operators';\nimport { toPolar } from '../utils';\nimport { dwellings } from '../move';\n\nexport const noviceMoves = (drag$, menu, { menuCenter, minSelectionDist }) => {\n // Analyse local movements.\n const moves$ = drag$.pipe(\n scan(\n (last_, n) => {\n const { azymuth, radius } = toPolar(n.position, menuCenter);\n const active =\n radius < minSelectionDist ? null : menu.getNearestChild(azymuth);\n const type = last_.active === active ? 'move' : 'change';\n return { active, type, azymuth, radius, ...n };\n },\n { active: null }\n ),\n startWith({\n type: 'open',\n menu,\n center: menuCenter,\n timeStamp: performance ? performance.now() : Date.now(),\n }),\n share()\n );\n\n const end$ = moves$.pipe(\n startWith({}),\n last(),\n map((n) => ({\n ...n,\n type: n.active && n.active.isLeaf() ? 'select' : 'cancel',\n selection: n.active,\n }))\n );\n\n return merge(moves$, end$).pipe(share());\n};\n\nexport const menuSelection = (\n move$,\n { subMenuOpeningDelay, movementsThreshold, minMenuSelectionDist }\n) =>\n // Wait for a pause in the movements.\n dwellings(move$, subMenuOpeningDelay, movementsThreshold).pipe(\n // Filter dwellings occurring outside of the selection area.\n filter(\n (n) => n.active && n.radius > minMenuSelectionDist && !n.active.isLeaf()\n )\n );\n\nexport const subMenuNavigation = (menuSelection$, drag$, subNav, navOptions) =>\n menuSelection$.pipe(\n map((n) =>\n subNav(drag$, n.active, { menuCenter: n.position, ...navOptions })\n )\n );\n\n/**\n * @param {Observable} drag$ - An observable of drag movements.\n * @param {MMItem} menu - The model of the menu.\n * @param {object} options - Configuration options.\n * @return {Observable} An observable on the menu navigation events.\n */\nconst noviceNavigation = (\n drag$,\n menu,\n {\n minSelectionDist,\n minMenuSelectionDist,\n movementsThreshold,\n subMenuOpeningDelay,\n menuCenter,\n noviceMoves: noviceMoves_ = noviceMoves,\n menuSelection: menuSelection_ = menuSelection,\n subMenuNavigation: subMenuNavigation_ = subMenuNavigation,\n }\n) => {\n // Observe the local navigation.\n const move$ = noviceMoves_(drag$, menu, {\n menuCenter,\n minSelectionDist,\n }).pipe(share());\n\n // Look for (sub)menu selection.\n const menuSelection$ = menuSelection_(move$, {\n subMenuOpeningDelay,\n movementsThreshold,\n minMenuSelectionDist,\n });\n\n // Higher order observable on navigation inside sub-menus.\n const subMenuNavigation$ = subMenuNavigation_(\n menuSelection$,\n drag$,\n noviceNavigation,\n {\n minSelectionDist,\n minMenuSelectionDist,\n movementsThreshold,\n subMenuOpeningDelay,\n noviceMoves: noviceMoves_,\n menuSelection: menuSelection_,\n subMenuNavigation: subMenuNavigation_,\n }\n );\n\n // Start with local navigation but switch to the first sub-menu navigation\n // (if any).\n return subMenuNavigation$.pipe(take(1), startWith(move$), switchAll());\n};\n\nexport default noviceNavigation;\n","import { dist, angle } from '../utils';\n\n/**\n * @param {Array.} pointList - The list of points.\n * @param {number} minDist - A distance.\n * @param {object} options - Options.\n * @param {number} [options.direction=1] - The direction of the lookup: negative values means\n * descending lookup.\n * @param {number} [options.startIndex] - The index of the first point to investigate inside\n * pointList. If not provided, the lookup will start\n * from the start or the end of pointList depending\n * on `direction`.\n * @param {number[]} [options.refPoint=pointList[startIndex]] - The reference point.\n * @return {number} The index of the first point inside pointList that it at least `minDist` from\n * `refPoint`.\n */\nexport const findNextPointFurtherThan = (\n pointList,\n minDist,\n {\n direction = 1,\n startIndex = direction > 0 ? 0 : pointList.length - 1,\n refPoint = pointList[startIndex],\n } = {}\n) => {\n const step = direction / Math.abs(direction);\n const n = pointList.length;\n for (let i = startIndex; i < n && i >= 0; i += step) {\n if (dist(refPoint, pointList[i]) >= minDist) {\n return i;\n }\n }\n return -1;\n};\n\n/**\n * @param {number[]} pointA - The point a.\n * @param {number[]} pointC - The point b.\n * @param {List.} pointList - A list of points.\n * @param {number[]} options - Options.\n * @param {number} [options.startIndex=0] - The index of the first point to investigate inside\n * pointList.\n * @param {number} [options.endIndex=pointList.length - 1] - The index of the first point to\n * investigate inside pointList.\n * @return {{index, angle}} The index of the point b of pointList that maximizes the angle abc and\n * the angle abc.\n */\nexport const findMiddlePointForMinAngle = (\n pointA,\n pointC,\n pointList,\n { startIndex = 0, endIndex = pointList.length - 1 } = {}\n) => {\n let minAngle = Infinity;\n let maxAngleIndex = -1;\n for (let i = startIndex; i <= endIndex; i += 1) {\n const thisAngle = angle(pointA, pointList[i], pointC);\n if (thisAngle < minAngle) {\n minAngle = thisAngle;\n maxAngleIndex = i;\n }\n }\n return { index: maxAngleIndex, angle: minAngle };\n};\n","import {\n findNextPointFurtherThan,\n findMiddlePointForMinAngle,\n} from './find-points';\n\n/**\n * @typedef {number[]} Point\n */\n\n/**\n * A segment.\n * @typedef {Point[2]} Segment\n */\n\n/**\n * @param {Point[]} stroke - The points of a stroke.\n * @param {number} expectedSegmentLength - The expected length of a segment\n * (usually strokeLength / maxMenuDepth).\n * @param {number} angleThreshold - The min angle threshold in a point required for it to be\n * considered an articulation points.\n * @return {Point[]} The list of articulation points.\n */\nconst getStrokeArticulationPoints = (\n stroke,\n expectedSegmentLength,\n angleThreshold\n) => {\n const n = stroke.length;\n if (n === 0) return [];\n const w = expectedSegmentLength * 0.3;\n\n // Add the first point of the stroke.\n const articulationPoints = [stroke[0]];\n\n let ai = 0;\n let a = stroke[ai];\n while (ai < n) {\n const ci = findNextPointFurtherThan(stroke, w, {\n startIndex: ai + 2,\n refPoint: a,\n });\n if (ci < 0) break;\n const c = stroke[ci];\n const labi = findNextPointFurtherThan(stroke, w / 8, {\n startIndex: ai + 1,\n refPoint: a,\n });\n const lbci = findNextPointFurtherThan(stroke, w / 8, {\n startIndex: ci - 1,\n refPoint: c,\n direction: -1,\n });\n const { index: bi, angle: angleABC } = findMiddlePointForMinAngle(\n a,\n stroke[ci],\n stroke,\n {\n startIndex: labi,\n endIndex: lbci,\n }\n );\n if (bi > 0 && Math.abs(180 - angleABC) > angleThreshold) {\n const b = stroke[bi];\n articulationPoints.push(b);\n a = b;\n ai = bi;\n } else {\n ai += 1;\n a = stroke[ai];\n }\n }\n\n // Add the last point of the stroke.\n articulationPoints.push(stroke[stroke.length - 1]);\n return articulationPoints;\n};\n\nexport default getStrokeArticulationPoints;\n","import { dist } from '../utils';\n\n/**\n * @param {List>} stroke - A stroke.\n * @return {number} The length of the stroke `stroke`.\n */\nexport default (stroke) =>\n stroke.reduce(\n (res, current) => {\n const prev = res.prev || current;\n return {\n prev: current,\n length: res.length + dist(prev, current),\n };\n },\n { length: 0 }\n ).length;\n","import getStrokeArticulationPoints from './articulation-points';\nimport { dist, findMaxEntry, radiansToDegrees } from '../utils';\nimport strokeLength from './stroke-length';\n\n/**\n * @param {Point[]} points - A list of points.\n * @return {Segment[]} The list of segments joining the points of `points`.\n */\nexport const pointsToSegments = (points) =>\n points.slice(1).reduce(\n ({ segments, last }, current) => {\n segments.push([last, current]);\n return { segments, last: current };\n },\n { last: points[0], segments: [] }\n ).segments;\n\n/**\n * @param {Item} model - The marking menu model.\n * @param {{ angle }[]} segments - A list of segments to walk the model.\n * @param {number} [startIndex=0] - The start index in the angle list.\n * @return {Item} The corresponding item found by walking the model.\n */\nexport const walkMMModel = (model, segments, startIndex = 0) => {\n if (!model || segments.length === 0 || model.isLeaf()) return null;\n const item = model.getNearestChild(segments[startIndex].angle);\n if (startIndex + 1 >= segments.length) {\n return item;\n }\n return walkMMModel(item, segments, startIndex + 1);\n};\n\nexport const segmentAngle = (a, b) =>\n radiansToDegrees(Math.atan2(b[1] - a[1], b[0] - a[0]));\n\n/**\n * @param {{angle, length}[]} segments - A list of segments.\n * @return {{angle, length}[]} A new list of segments with the longest segments divided in two.\n */\nexport const divideLongestSegment = (segments) => {\n const [longestI, longest] = findMaxEntry(\n segments,\n (s1, s2) => s2.length - s1.length\n );\n return [\n ...segments.slice(0, longestI),\n { length: longest.length / 2, angle: longest.angle },\n { length: longest.length / 2, angle: longest.angle },\n ...segments.slice(longestI + 1),\n ];\n};\n\n/**\n * @param {Item} model - The marking menu model.\n * @param {{length, angle}[]} segments - A list of segments.\n * @param {number} [maxDepth=model.getMaxDepth()] - The maximum depth of the item.\n * @return {Item} The selected item.\n */\nexport const findMMItem = (model, segments, maxDepth = model.getMaxDepth()) => {\n // If there is not segments, there is no selection to find.\n if (!segments.length) return null;\n // While we haven't found a leaf item, divide the longest segment and walk the model.\n let currentSegments = segments;\n let currentItem = null;\n while (currentSegments.length <= maxDepth) {\n currentItem = walkMMModel(model, currentSegments);\n if (currentItem && currentItem.isLeaf()) return currentItem;\n currentSegments = divideLongestSegment(currentSegments);\n }\n return currentItem;\n};\n\n/**\n * @param {List.} stroke - A list of points.\n * @param {Item} model - The marking menu model.\n * @param {object} [options] - Additional options.\n * @param {number} [maxDepth] - The maximum menu depth to walk. If negative,\n * start from the maximum depth of the model.\n * @param {boolean} [requireMenu=false] - Look for a menu item. This\n * works best with a negative value for maxDepth.\n * @param {boolean} [requireLeaf=!requireMenu] - Look for a leaf.\n * @return {Item} The item recognized by the stroke.\n */\nconst recognizeMMStroke = (\n stroke,\n model,\n {\n maxDepth: maxDepth_ = model.getMaxDepth(),\n requireMenu = false,\n requireLeaf = !requireMenu,\n } = {}\n) => {\n if (requireLeaf && requireMenu) {\n throw new Error('The result cannot be both a leaf and a menu');\n }\n const maxDepth = maxDepth_ < 0 ? model.getMaxDepth() + maxDepth_ : maxDepth_;\n const maxMenuBreadth = model.getMaxBreadth();\n const length = strokeLength(stroke);\n const expectedSegmentLength = length / maxDepth;\n const sensitivity = 0.75;\n const angleThreshold = 360 / maxMenuBreadth / 2 / sensitivity;\n const articulationPoints = getStrokeArticulationPoints(\n stroke,\n expectedSegmentLength,\n angleThreshold\n );\n const minSegmentSize = expectedSegmentLength / 3;\n // Get the segments of the marking menus.\n const segments = pointsToSegments(articulationPoints)\n // Change the representation of the segment to include its length.\n .map((seg) => ({ points: seg, length: dist(...seg) }))\n // Remove the segments that are too small.\n .filter((seg) => seg.length > minSegmentSize)\n // Change again the representation of the segment to include its length but not its\n // its points anymore.\n .map((seg) => ({ angle: segmentAngle(...seg.points), length: seg.length }));\n const item = findMMItem(model, segments, maxDepth);\n if (requireLeaf) {\n return item && item.isLeaf() ? item : null;\n }\n if (requireMenu) {\n return item && item.isLeaf() ? item.parent : item;\n }\n return item;\n};\n\nexport default recognizeMMStroke;\n","import { merge } from 'rxjs';\nimport { startWith, last, map, share } from 'rxjs/operators';\nimport { draw } from '../move';\nimport recognize from '../recognizer';\n\n/**\n * @param {Observable} drag$ - An observable of drag movements.\n * @param {MMItem} model - The model of the menu.\n * @param {List} initStroke - Initial stroke.\n * @return {Observable} An observable on the gesture drawing and recognition.\n */\nexport default (drag$, model, initStroke = []) => {\n // Observable on gesture drawing.\n const draw$ = draw(drag$, { initStroke, type: 'draw' }).pipe(share());\n\n // Track the end of the drawing and attempt to recognize the gesture.\n const end$ = draw$.pipe(\n startWith(null),\n last(),\n map((e) => {\n if (!e) return { type: 'cancel' };\n const selection = recognize(e.stroke, model);\n if (selection) {\n return { ...e, type: 'select', selection };\n }\n return { ...e, type: 'cancel' };\n })\n );\n return merge(draw$, end$);\n};\n","import { race, of } from 'rxjs';\nimport {\n take,\n map,\n skip,\n startWith,\n switchAll,\n mergeMap,\n exhaustMap,\n} from 'rxjs/operators';\nimport noviceNavigation from './novice-navigation';\nimport expertNavigation from './expert-navigation';\nimport { longMoves, dwellings, draw } from '../move';\nimport recognize from '../recognizer';\n\nexport const confirmedNoviceNavigationHOO = (drag$, start, model, options) =>\n dwellings(drag$, options.noviceDwellingTime, options.movementsThreshold).pipe(\n take(1),\n map(() =>\n (start != null ? of(start) : drag$).pipe(\n take(1),\n mergeMap((start_) =>\n noviceNavigation(\n // Same as before, skip the first.\n drag$.pipe(skip(1)),\n model,\n { ...options, menuCenter: start_.position }\n ).pipe(map((n) => ({ ...n, mode: 'novice' })))\n )\n )\n )\n );\n\nexport const expertToNoviceSwitchHOO = (drag$, model, initStroke, options) =>\n dwellings(\n draw(drag$, { initStroke }),\n options.noviceDwellingTime,\n options.movementsThreshold\n ).pipe(\n take(1),\n map((evt) => {\n // Look for the furthest menu (not leaf).\n const menu = recognize(evt.stroke, model, {\n maxDepth: -1,\n requireMenu: true,\n });\n if (!menu || menu.isRoot()) {\n return of({ ...evt, type: 'cancel' });\n }\n // Start a novice navigation from there.\n return noviceNavigation(drag$.pipe(skip(1)), menu, {\n ...options,\n menuCenter: evt.position,\n });\n })\n );\n\nexport const confirmedExpertNavigationHOO = (\n drag$,\n model,\n {\n expertToNoviceSwitchHOO: expertToNoviceSwitchHOO_ = expertToNoviceSwitchHOO,\n ...options\n } = {}\n) =>\n longMoves(draw(drag$, { type: 'draw' }), options.movementsThreshold).pipe(\n take(1),\n map((e) => {\n const expertNav$ = expertNavigation(\n // Drag always return the last value when observed, in this case we are\n // not interested in it as it has already been took into account.\n drag$.pipe(skip(1)),\n model,\n e.stroke\n ).pipe(map((n) => ({ ...n, mode: 'expert' })));\n return expertToNoviceSwitchHOO_(drag$, model, e.stroke, options).pipe(\n startWith(expertNav$),\n switchAll()\n );\n })\n );\n\nexport const startup = (drag$, model) =>\n expertNavigation(drag$, model).pipe(\n map((n, i) =>\n i === 0\n ? { ...n, type: 'start', mode: 'startup' }\n : { ...n, mode: 'startup' }\n )\n );\n\nexport const navigationFromDrag = (\n drag$,\n start,\n model,\n options,\n {\n confirmedExpertNavigationHOO:\n confirmedExpertNavigationHOO_ = confirmedExpertNavigationHOO,\n confirmedNoviceNavigationHOO:\n confirmedNoviceNavigationHOO_ = confirmedNoviceNavigationHOO,\n startup: startup_ = startup,\n } = {}\n) => {\n // Start up observable (while neither expert or novice are confirmed).\n const startUp$ = startup_(drag$, model);\n\n // Observable on confirmed expert navigation.\n const confirmedExpertNavigation$$ = confirmedExpertNavigationHOO_(\n drag$,\n model,\n options\n );\n\n // Observable on confirmed novice navigation.\n const confirmedNoviceNavigation$$ = confirmedNoviceNavigationHOO_(\n drag$,\n start,\n model,\n options\n );\n\n // Observable on expert or novice navigation once confirmed.\n const confirmedNavigation$$ = race(\n confirmedExpertNavigation$$,\n confirmedNoviceNavigation$$\n );\n\n // Start with startup navigation (similar to expert) but switch to the\n // confirmed navigation as soon as it is settled.\n return confirmedNavigation$$.pipe(startWith(startUp$), switchAll());\n};\n\n/**\n * @param {Observable} drags$ - A higher order observable on drag movements.\n * @param {MMItem} menu - The model of the menu.\n * @param {object} options - Configuration options (see {@link ../index.js}).\n * @param {function} [navigationFromDrag_] - function to convert a drags higher\n * order observable to a navigation\n * observable.\n * @return {Observable} An observable on the marking menu events.\n */\nexport default (\n drags$,\n menu,\n options,\n navigationFromDrag_ = navigationFromDrag\n) =>\n drags$.pipe(\n exhaustMap((drag$) =>\n drag$.pipe(\n take(1),\n mergeMap((start) => navigationFromDrag_(drag$, start, menu, options))\n )\n )\n );\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import { degreesToRadians } from '../utils';\nimport './menu.css';\n\nconst template = ({ items, center }, doc) => {\n const main = doc.createElement('div');\n main.className = 'marking-menu';\n main.style.setProperty('--center-x', `${center[0]}px`);\n main.style.setProperty('--center-y', `${center[1]}px`);\n for (let i = 0; i < items.length; i += 1) {\n const item = items[i];\n const elt = doc.createElement('div');\n elt.className = 'marking-menu-item';\n elt.dataset.itemId = item.id;\n elt.style.setProperty('--angle', `${item.angle}deg`);\n // Identify corner items as these may be styled differently.\n if (item.angle === 45) {\n elt.classList.add('bottom-right-item');\n } else if (item.angle === 135) {\n elt.classList.add('bottom-left-item');\n } else if (item.angle === 225) {\n elt.classList.add('top-left-item');\n } else if (item.angle === 315) {\n elt.classList.add('top-right-item');\n }\n const radAngle = degreesToRadians(item.angle);\n // Why -radAngle? I got the css math wrong at some point, but it works like\n // this and I could not be bothered fixing it.\n elt.style.setProperty('--cosine', Math.cos(-radAngle));\n elt.style.setProperty('--sine', Math.sin(-radAngle));\n elt.innerHTML += '
';\n elt.innerHTML += `
${item.name}
`;\n main.appendChild(elt);\n }\n\n return main;\n};\n\n/**\n * Create the Menu display.\n * @param {HTMLElement} parent - The parent node.\n * @param {ItemModel} model - The model of the menu to open.\n * @param {[int, int]} center - The center of the menu.\n * @param {String} [current] - The currently active item.\n * @param {Document} [options] - Menu options.\n * @param {Document} [options.doc=document] - The root document of the menu.\n * Mostly useful for testing purposes.\n * @return {{ setActive, remove }} - The menu controls.\n */\nconst createMenu = (\n parent,\n model,\n center,\n current,\n { doc = document } = {}\n) => {\n // Create the DOM.\n const main = template({ items: model.children, center }, doc);\n parent.appendChild(main);\n\n // Clear any active items.\n const clearActiveItems = () => {\n Array.from(main.querySelectorAll('.active')).forEach((itemDom) =>\n itemDom.classList.remove('active')\n );\n };\n\n // Return an item DOM element from its id.\n const getItemDom = (itemId) =>\n main.querySelector(`.marking-menu-item[data-item-id=\"${itemId}\"]`);\n\n // Mark an item as active.\n const setActive = (itemId) => {\n // Clear any active items.\n clearActiveItems();\n\n // Set the active class.\n if (itemId || itemId === 0) {\n getItemDom(itemId).classList.add('active');\n }\n };\n\n // Function to remove the menu.\n const remove = () => parent.removeChild(main);\n\n // Initialize the menu.\n if (current) setActive(current);\n\n // Create the interface.\n return { setActive, remove };\n};\n\nexport default createMenu;\n","/**\n * @param {HTMLElement} parent - The parent node.\n * @param {Document} options - Options.\n * @param {Document} [options.doc=document] - The root document. Mostly useful for testing purposes.\n * @param {number} [options.lineWidth=2] - The width of the stroke.\n * @param {string} [options.lineColor='black'] - CSS representation of the stroke color.\n * @param {number} [options.startPointRadius=0] - The radius of the start point.\n * @param {number} [options.startPointColor=options.lineColor] - CSS representation of the start\n * point color.\n * @param {number} [options.ptSize=1 / devicePixelRatio] - The size of the canvas points\n * (px).\n * @return {{ clear, setStroke, remove }} The canvas methods.\n */\nexport default (\n parent,\n {\n doc = document,\n lineWidth = 2,\n lineColor = 'black',\n pointRadius = 0,\n pointColor = lineColor,\n ptSize = window.devicePixelRatio ? 1 / window.devicePixelRatio : 1,\n }\n) => {\n // Create the canvas.\n const { width, height } = parent.getBoundingClientRect();\n const canvas = doc.createElement('canvas');\n canvas.width = width / ptSize;\n canvas.height = height / ptSize;\n Object.assign(canvas.style, {\n position: 'absolute',\n left: 0,\n top: 0,\n width: `${width}px`,\n height: `${height}px`,\n 'pointer-events': 'none',\n });\n parent.appendChild(canvas);\n\n // Get the canvas' context and set it up\n const ctx = canvas.getContext('2d');\n // Scale to the device pixel ratio.\n ctx.scale(1 / ptSize, 1 / ptSize);\n\n /**\n * @param {number[]} point - Position of the point to draw.\n * @return {undefined}\n */\n const drawPoint = ([x, y]) => {\n ctx.save();\n ctx.strokeStyle = 'none';\n ctx.fillStyle = pointColor;\n ctx.beginPath();\n ctx.moveTo(x + pointRadius, y);\n ctx.arc(x, y, pointRadius, 0, 360);\n ctx.fill();\n ctx.restore();\n };\n\n /**\n * Clear the canvas.\n *\n * @return {undefined}\n */\n const clear = () => {\n ctx.clearRect(0, 0, width, height);\n };\n\n /**\n * Draw the stroke.\n *\n * @param {List} stroke - The new stroke.\n * @return {undefined}\n */\n const drawStroke = (stroke) => {\n ctx.save();\n ctx.fillStyle = 'none';\n ctx.lineJoin = 'round';\n ctx.lineCap = 'round';\n ctx.strokeStyle = lineColor;\n ctx.lineWidth = lineWidth;\n ctx.beginPath();\n stroke.forEach((point, i) => {\n if (i === 0) ctx.moveTo(...point);\n else ctx.lineTo(...point);\n });\n ctx.stroke();\n ctx.restore();\n };\n\n /**\n * Destroy the canvas.\n * @return {undefined}\n */\n const remove = () => {\n canvas.remove();\n };\n\n return { clear, drawStroke, drawPoint, remove };\n};\n","var rafSchd = function rafSchd(fn) {\n var lastArgs = [];\n var frameId = null;\n\n var wrapperFn = function wrapperFn() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n lastArgs = args;\n\n if (frameId) {\n return;\n }\n\n frameId = requestAnimationFrame(function () {\n frameId = null;\n fn.apply(void 0, lastArgs);\n });\n };\n\n wrapperFn.cancel = function () {\n if (!frameId) {\n return;\n }\n\n cancelAnimationFrame(frameId);\n frameId = null;\n };\n\n return wrapperFn;\n};\n\nexport default rafSchd;\n","import { finalize, tap } from 'rxjs/operators';\nimport rafThrottle from 'raf-schd';\n\n/**\n * Connect navigation notifications to menu opening and closing.\n *\n * @param {HTMLElement} parentDOM - The element where to append the menu.\n * @param {Observable} navigation$ - Notifications of the navigation.\n * @param {Function} createMenuLayout - Menu layout factory.\n * @param {Function} createUpperStrokeCanvas - Upper stroke canvas factory. The\n * upper stroke show the user interaction on the current menu, and the movements\n * in expert mode.\n * @param {Function} createLowerStrokeCanvas - Lower stroke canvas factory. The\n * lower stroke is stroke drawn below the menu. It keeps track of the previous\n * movements.\n * @param {Function} createGestureFeedback - Create gesture feedback.\n * @param {{error}} log - Logger.\n * @return {Observable} `navigation$` with menu opening and closing side effects.\n */\nexport default (\n parentDOM,\n navigation$,\n createMenuLayout,\n createUpperStrokeCanvas,\n createLowerStrokeCanvas,\n createGestureFeedback,\n log\n) => {\n // The menu object.\n let menu = null;\n // A stroke drawn on top of the menu.\n let upperStrokeCanvas = null;\n // A stroke drawn below the menu.\n let lowerStrokeCanvas = null;\n // The points of the lower strokes.\n let lowerStroke = null;\n // The points of the upper stroke.\n let upperStroke = null;\n\n const gestureFeedback = createGestureFeedback(parentDOM);\n\n const closeMenu = () => {\n menu.remove();\n menu = null;\n };\n\n const openMenu = (model, position) => {\n const cbr = parentDOM.getBoundingClientRect();\n menu = createMenuLayout(parentDOM, model, [\n position[0] - cbr.left,\n position[1] - cbr.top,\n ]);\n };\n\n const setActive = (id) => {\n menu.setActive(id);\n };\n\n const startUpperStroke = (position) => {\n upperStrokeCanvas = createUpperStrokeCanvas(parentDOM);\n upperStroke = [position];\n upperStrokeCanvas.drawStroke(upperStroke);\n };\n\n const noviceMove = rafThrottle((position) => {\n if (upperStrokeCanvas) {\n upperStrokeCanvas.clear();\n if (position) {\n upperStroke = [upperStroke[0], position];\n upperStrokeCanvas.drawStroke(upperStroke);\n }\n upperStrokeCanvas.drawPoint(upperStroke[0]);\n }\n });\n\n const expertDraw = rafThrottle((stroke) => {\n // FIXME: Not very efficient.\n if (upperStrokeCanvas) {\n upperStrokeCanvas.clear();\n upperStroke = stroke.slice();\n upperStrokeCanvas.drawStroke(upperStroke);\n }\n });\n\n const clearUpperStroke = () => {\n upperStrokeCanvas.remove();\n upperStrokeCanvas = null;\n upperStroke = null;\n };\n\n const swapUpperStroke = () => {\n lowerStroke = lowerStroke ? [...lowerStroke, ...upperStroke] : upperStroke;\n clearUpperStroke();\n lowerStrokeCanvas = lowerStrokeCanvas || createLowerStrokeCanvas(parentDOM);\n lowerStrokeCanvas.drawStroke(lowerStroke);\n };\n\n const clearLowerStroke = () => {\n if (lowerStrokeCanvas) {\n lowerStrokeCanvas.remove();\n lowerStrokeCanvas = null;\n }\n lowerStroke = null;\n };\n\n const showGestureFeedback = (isCanceled) => {\n gestureFeedback.show(\n lowerStroke ? [...lowerStroke, ...upperStroke] : upperStroke,\n isCanceled\n );\n };\n\n const cleanUp = () => {\n // Make sure everything is cleaned upon completion.\n if (menu) closeMenu();\n if (upperStrokeCanvas) clearUpperStroke();\n if (lowerStrokeCanvas) clearLowerStroke();\n gestureFeedback.remove();\n // eslint-disable-next-line no-param-reassign\n parentDOM.style.cursor = '';\n };\n\n const onNotification = (notification) => {\n switch (notification.type) {\n case 'open': {\n // eslint-disable-next-line no-param-reassign\n parentDOM.style.cursor = 'none';\n if (menu) closeMenu();\n swapUpperStroke();\n openMenu(notification.menu, notification.center);\n startUpperStroke(notification.center);\n noviceMove(notification.position);\n break;\n }\n case 'change': {\n setActive((notification.active && notification.active.id) || null);\n break;\n }\n case 'select':\n case 'cancel':\n // eslint-disable-next-line no-param-reassign\n parentDOM.style.cursor = '';\n if (menu) closeMenu();\n showGestureFeedback(notification.type === 'cancel');\n clearUpperStroke();\n clearLowerStroke();\n break;\n case 'start':\n // eslint-disable-next-line no-param-reassign\n parentDOM.style.cursor = 'crosshair';\n startUpperStroke(notification.position);\n break;\n case 'draw':\n expertDraw(notification.stroke);\n break;\n case 'move':\n noviceMove(notification.position);\n break;\n default:\n throw new Error(\n `Invalid navigation notification type: ${notification.type}`\n );\n }\n };\n\n return navigation$.pipe(\n tap({\n next(notification) {\n try {\n onNotification(notification);\n } catch (e) {\n log.error(e);\n throw e;\n }\n },\n error(e) {\n log.error(e);\n throw e;\n },\n }),\n finalize(() => {\n try {\n cleanUp();\n } catch (e) {\n log.error(e);\n throw e;\n }\n })\n );\n};\n","import createStrokeCanvas from './stroke';\n\nexport default (\n parentDOM,\n { duration, strokeOptions = {}, canceledStrokeOptions = {} }\n) => {\n let strokeTimeoutEntries = [];\n\n const show = (stroke, isCanceled = false) => {\n const canvas = createStrokeCanvas(parentDOM, {\n ...strokeOptions,\n ...(isCanceled ? canceledStrokeOptions : {}),\n });\n canvas.drawStroke(stroke);\n const timeoutEntry = {\n canvas,\n timeout: setTimeout(() => {\n // Remove the entry from the strokeTimeoutEntries.\n strokeTimeoutEntries = strokeTimeoutEntries.filter(\n (x) => x !== timeoutEntry\n );\n // Clear the stroke canvas.\n canvas.remove();\n }, duration),\n };\n strokeTimeoutEntries.push(timeoutEntry);\n };\n\n const remove = () => {\n strokeTimeoutEntries.forEach(({ timeout, canvas }) => {\n clearTimeout(timeout);\n canvas.remove();\n });\n strokeTimeoutEntries = [];\n };\n\n return { show, remove };\n};\n","import { deltaAngle } from './utils';\n\nconst getAngleRange = (items) => (items.length > 4 ? 45 : 90);\n\n/**\n * Represents an item of the Marking Menu.\n */\nexport class MMItem {\n /**\n * @param {String} id - The item's id. Required except for the root item.\n * @param {String} name - The item's name. Required except for the root item.\n * @param {Integer} angle - The item's angle. Required except for the root item.\n * @param {object} [options] - Some additional options.\n * @param {ItemModel} [options.parent] - The parent menu of the item.\n * @param {List} [options.children] - The children of the item menu.\n */\n constructor(id, name, angle, { parent, children } = {}) {\n this.id = id;\n this.name = name;\n this.angle = angle;\n this.children = children;\n this.parent = parent;\n }\n\n isLeaf() {\n return !this.children || this.children.length === 0;\n }\n\n isRoot() {\n return !this.parent;\n }\n\n /**\n * @param {String} childId - The identifier of the child to look for.\n * @return {Item} the children with the id `childId`.\n */\n getChild(childId) {\n return this.children.find((child) => child.id === childId);\n }\n\n /**\n * @param {String} childName - The name of the children to look for.\n * @return {Item} the children with the name `childName`.\n */\n getChildrenByName(childName) {\n return this.children.filter((child) => child.name === childName);\n }\n\n /**\n * @param {Integer} angle - An angle.\n * @return {Item} the closest children to the angle `angle`.\n */\n getNearestChild(angle) {\n return this.children.reduce((c1, c2) => {\n const delta1 = Math.abs(deltaAngle(c1.angle, angle));\n const delta2 = Math.abs(deltaAngle(c2.angle, angle));\n return delta1 > delta2 ? c2 : c1;\n });\n }\n\n /**\n * @return {number} The maximum depth of the menu.\n */\n getMaxDepth() {\n return this.isLeaf()\n ? 0\n : Math.max(0, ...this.children.map((child) => child.getMaxDepth())) + 1;\n }\n\n /**\n * @return {number} The maximum breadth of the menu.\n */\n getMaxBreadth() {\n return this.isLeaf()\n ? 0\n : Math.max(\n this.children.length,\n ...this.children.map((child) => child.getMaxBreadth())\n );\n }\n}\n\n// Create the model item from a list of items.\nconst recursivelyCreateModelItems = (\n items,\n baseId = undefined,\n parent = undefined\n) => {\n // Calculate the angle range for each items.\n const angleRange = getAngleRange(items);\n // Create the list of model items (frozen).\n return Object.freeze(\n items.map((item, i) => {\n // Standard item id.\n const stdId = baseId ? [baseId, i].join('-') : i.toString();\n // Create the item.\n const mmItem = new MMItem(\n item.id == null ? stdId : item.id,\n typeof item === 'string' ? item : item.name,\n i * angleRange,\n { parent }\n );\n // Add its children if any.\n if (item.children) {\n mmItem.children = recursivelyCreateModelItems(\n item.children,\n stdId,\n mmItem\n );\n }\n // Return it frozen.\n return Object.freeze(mmItem);\n })\n );\n};\n\n/**\n * Create the marking menu model.\n *\n * @param {List} itemList - The list of items.\n * @return {MMItem} - The root item of the model.\n */\nconst createModel = (itemList) => {\n const menu = new MMItem(null, null, null);\n menu.children = recursivelyCreateModelItems(itemList, undefined, menu);\n return Object.freeze(menu);\n};\n\nexport default createModel;\n","import { tap, map, share, filter, pluck } from 'rxjs/operators';\nimport navigation from './navigation';\nimport {\n createMenuLayout,\n createStrokeCanvas,\n connectLayout,\n createGestureFeedback,\n} from './layout';\nimport createModel from './model';\nimport { watchDrags } from './move';\n\n// Clone a notification in a protected way so that the internal state cannot be corrupted.\nexport const exportNotification = (n) => ({\n type: n.type,\n mode: n.mode,\n position: n.position ? n.position.slice() : undefined,\n active: n.active,\n selection: n.selection,\n menuCenter: n.center ? n.center.slice() : undefined,\n timeStamp: n.timeStamp,\n});\n\n/**\n * Create a Marking Menu.\n *\n * @param {List} items - The list of items.\n * @param {HTMLElement} parentDOM - The parent node.\n * @param {Object} [options] - Configuration options for the menu.\n * @param {number} [options.minSelectionDist] - The minimum distance from the center to select an\n * item.\n * @param {number} [options.minMenuSelectionDist] - The minimum distance from the center to open a\n * sub-menu.\n * @param {number} [options.subMenuOpeningDelay] - The dwelling delay before opening a sub-menu.\n * @param {number} [options.movementsThreshold] - The minimum distance between two points to be\n * considered a significant movements and breaking\n * the sub-menu dwelling delay.\n * @param {number} [options.noviceDwellingTime] - The dwelling time required to trigger the novice\n * mode (and open the menu).\n * @param {number} [options.strokeColor] - The color of the gesture stroke.\n * @param {number} [options.strokeWidth] - The width of the gesture stroke.\n * @param {number} [options.strokeStartPointRadius] - The radius of the start point of the stroke\n * (appearing at the middle of the menu in novice\n * mode).\n * @param {number} [options.lowerStrokeColor] - The color of the lower stroke. The lower stroke is\n * the stroke drawn below the menu. It keeps track of\n * the previous movements.\n * @param {number} [options.lowerStrokeWidth] - The width of the lower stroke.\n * @param {number} [options.lowerStrokeStartPointRadius] - The radius of the start point of the\n * stroke.\n * @param {number} [options.gestureFeedbackStrokeWidth] - The width of the stroke of the gesture\n * feedback.\n * @param {number} [options.gestureFeedbackStrokeColor] - The color of the stroke of the gesture\n * feedback.\n * @param {number} [options.gestureFeedbackCanceledStrokeColor] - The color of the stroke of the\n * gesture feedback when the selection is\n * canceled.\n * @param {number} [options.gestureFeedbackDuration] - The duration of the gesture feedback.\n * @param {boolean} [options.notifySteps] - If true, every steps of the marking menu (include move)\n * events, will be notified. Useful for logging.\n * @param {{error, info, warn, debug}} [options.log] - Override the default logger to use.\n * @return {Observable} An observable on menu selections.\n */\nexport default (\n items,\n parentDOM,\n {\n minSelectionDist = 40,\n minMenuSelectionDist = 80,\n subMenuOpeningDelay = 25,\n movementsThreshold = 5,\n noviceDwellingTime = 1000 / 3,\n strokeColor = '#000',\n strokeWidth = 4,\n strokeStartPointRadius = 8,\n lowerStrokeColor = '#777',\n lowerStrokeWidth = strokeWidth,\n lowerStrokeStartPointRadius = lowerStrokeWidth,\n gestureFeedbackDuration = 1000,\n gestureFeedbackStrokeWidth = strokeWidth,\n gestureFeedbackCanceledStrokeColor = '#DE6C52',\n gestureFeedbackStrokeColor = strokeColor,\n notifySteps = false,\n log = {\n // eslint-disable-next-line no-console\n error: console.error && console.error.bind(console),\n // eslint-disable-next-line no-console\n info: console.info && console.info.bind(console),\n // eslint-disable-next-line no-console\n warn: console.warn && console.warn.bind(console),\n debug() {},\n },\n } = {}\n) => {\n // Create the display options\n const menuLayoutOptions = {};\n const strokeCanvasOptions = {\n lineColor: strokeColor,\n lineWidth: strokeWidth,\n pointRadius: strokeStartPointRadius,\n };\n const lowerStrokeCanvasOptions = {\n lineColor: lowerStrokeColor,\n lineWidth: lowerStrokeWidth,\n pointRadius: lowerStrokeStartPointRadius,\n };\n const gestureFeedbackOptions = {\n duration: gestureFeedbackDuration,\n strokeOptions: {\n lineColor: gestureFeedbackStrokeColor,\n lineWidth: gestureFeedbackStrokeWidth,\n },\n canceledStrokeOptions: {\n lineColor: gestureFeedbackCanceledStrokeColor,\n },\n };\n\n // Create model and navigation observable.\n const model = createModel(items);\n const navigation$ = navigation(watchDrags(parentDOM), model, {\n minSelectionDist,\n minMenuSelectionDist,\n subMenuOpeningDelay,\n movementsThreshold,\n noviceDwellingTime,\n }).pipe(\n tap(({ originalEvent }) => {\n // Prevent default on every notifications.\n if (originalEvent) originalEvent.preventDefault();\n })\n );\n\n // Connect the engine's notifications to menu opening/closing.\n const connectedNavigation$ = connectLayout(\n parentDOM,\n navigation$,\n (parent, menuModel, center, current) =>\n createMenuLayout(parent, menuModel, center, current, menuLayoutOptions),\n (parent) => createStrokeCanvas(parent, strokeCanvasOptions),\n (parent) => createStrokeCanvas(parent, lowerStrokeCanvasOptions),\n (parent) => createGestureFeedback(parent, gestureFeedbackOptions),\n log\n );\n\n // If every steps should be notified, just export connectedNavigation$.\n if (notifySteps) {\n return connectedNavigation$.pipe(map(exportNotification), share());\n }\n // Else, return an observable on the selections.\n return connectedNavigation$.pipe(\n filter((notification) => notification.type === 'select'),\n pluck('selection'),\n share()\n );\n};\n"],"names":["mod","a","n","radiansToDegrees","radians","Math","PI","degreesToRadians","degrees","deltaAngle","alpha","beta","dist","point1","point2","sum","reduce","acc","x1i","i","x2i","sqrt","ANGLE_ROUNDING","angle","b","c","lab","lbc","lac","cos","adjustedCos","max","min","angleABC","acos","round","findMaxEntry","list","comp","slice","result","item","index","toPolar","px","py","cx","cy","x","y","azymuth","atan2","radius","createPEventFromTouchEvent","touchEvt","touchList","Array","from","targetTouches","sumX","t","clientX","sumY","clientY","meanX","length","meanY","originalEvent","position","timeStamp","createPEventFromMouseEvent","mouseEvt","mouseDrags","rootDOM","fromEvent","pipe","map","downEvt","drag$","merge","of","takeUntil","publishBehavior","connect","o","touchDrags","filter","evt","firstEvent","startWith","watchDrags","dragObsFactories","f","movementsThreshold","scan","cur","prev","type","pass","delay","scheduler","undefined","first","longMoves","debounceTime","last","withLatestFrom","_","last_","initStroke","typeOpts","notification","stroke","noviceMoves","menu","menuCenter","minSelectionDist","moves$","active","getNearestChild","center","performance","now","Date","share","end$","isLeaf","selection","menuSelection","move$","subMenuOpeningDelay","minMenuSelectionDist","dwellings","subMenuNavigation","menuSelection$","subNav","navOptions","noviceNavigation","noviceMoves_","menuSelection_","subMenuNavigation_","subMenuNavigation$","take","switchAll","findNextPointFurtherThan","pointList","minDist","direction","startIndex","refPoint","step","abs","findMiddlePointForMinAngle","pointA","pointC","endIndex","minAngle","Infinity","maxAngleIndex","thisAngle","getStrokeArticulationPoints","expectedSegmentLength","angleThreshold","w","articulationPoints","ai","ci","labi","lbci","bi","push","res","current","pointsToSegments","points","segments","walkMMModel","model","segmentAngle","divideLongestSegment","longestI","longest","s1","s2","findMMItem","maxDepth","getMaxDepth","currentSegments","currentItem","recognizeMMStroke","maxDepth_","requireMenu","requireLeaf","Error","maxMenuBreadth","getMaxBreadth","strokeLength","sensitivity","minSegmentSize","seg","parent","draw$","draw","e","recognize","confirmedNoviceNavigationHOO","start","options","noviceDwellingTime","mergeMap","start_","skip","mode","expertToNoviceSwitchHOO","isRoot","confirmedExpertNavigationHOO","expertToNoviceSwitchHOO_","expertNav$","expertNavigation","startup","navigationFromDrag","confirmedExpertNavigationHOO_","confirmedNoviceNavigationHOO_","startup_","startUp$","confirmedExpertNavigation$$","confirmedNoviceNavigation$$","confirmedNavigation$$","race","drags$","navigationFromDrag_","exhaustMap","template","doc","items","main","createElement","className","style","setProperty","elt","dataset","itemId","id","classList","add","radAngle","sin","innerHTML","name","appendChild","createMenu","document","children","clearActiveItems","querySelectorAll","forEach","itemDom","remove","getItemDom","querySelector","setActive","removeChild","lineWidth","lineColor","pointRadius","pointColor","ptSize","window","devicePixelRatio","width","height","getBoundingClientRect","canvas","Object","assign","left","top","ctx","getContext","scale","drawPoint","save","strokeStyle","fillStyle","beginPath","moveTo","arc","fill","restore","clear","clearRect","drawStroke","lineJoin","lineCap","point","lineTo","parentDOM","navigation$","createMenuLayout","createUpperStrokeCanvas","createLowerStrokeCanvas","createGestureFeedback","log","upperStrokeCanvas","lowerStrokeCanvas","lowerStroke","upperStroke","gestureFeedback","closeMenu","openMenu","cbr","startUpperStroke","noviceMove","rafThrottle","expertDraw","clearUpperStroke","swapUpperStroke","clearLowerStroke","showGestureFeedback","isCanceled","show","cleanUp","cursor","onNotification","tap","next","error","finalize","duration","strokeOptions","canceledStrokeOptions","strokeTimeoutEntries","createStrokeCanvas","timeoutEntry","timeout","setTimeout","clearTimeout","getAngleRange","MMItem","constructor","getChild","childId","find","child","getChildrenByName","childName","c1","c2","delta1","delta2","recursivelyCreateModelItems","baseId","angleRange","freeze","stdId","join","toString","mmItem","createModel","itemList","exportNotification","strokeColor","strokeWidth","strokeStartPointRadius","lowerStrokeColor","lowerStrokeWidth","lowerStrokeStartPointRadius","gestureFeedbackDuration","gestureFeedbackStrokeWidth","gestureFeedbackCanceledStrokeColor","gestureFeedbackStrokeColor","notifySteps","console","bind","info","warn","debug","menuLayoutOptions","strokeCanvasOptions","lowerStrokeCanvasOptions","gestureFeedbackOptions","navigation","preventDefault","connectedNavigation$","connectLayout","menuModel","pluck"],"mappings":";;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACO,MAAMA,GAAG,GAAG,CAACC,CAAD,EAAIC,CAAJ,KAAU,CAAED,CAAC,GAAGC,CAAL,GAAUA,CAAX,IAAgBA,CAAtC,CAAA;EAEP;EACA;EACA;EACA;;EACO,MAAMC,gBAAgB,GAAIC,OAAD,IAAaA,OAAO,IAAI,GAAMC,GAAAA,IAAI,CAACC,EAAf,CAA7C,CAAA;EAEP;EACA;EACA;EACA;;EACO,MAAMC,gBAAgB,GAAIC,OAAD,IAAaA,OAAO,IAAIH,IAAI,CAACC,EAAL,GAAU,GAAd,CAA7C,CAAA;EAEP;EACA;EACA;EACA;EACA;;EACO,MAAMG,UAAU,GAAG,CAACC,KAAD,EAAQC,IAAR,KAAiBX,GAAG,CAACW,IAAI,GAAGD,KAAP,GAAe,GAAhB,EAAqB,GAArB,CAAH,GAA+B,GAAnE,CAAA;EAEP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EACO,MAAME,IAAI,GAAG,CAACC,MAAD,EAASC,MAAT,KAAoB;EACtC,EAAA,MAAMC,GAAG,GAAGF,MAAM,CAACG,MAAP,CAAc,CAACC,GAAD,EAAMC,GAAN,EAAWC,CAAX,KAAiB;EACzC,IAAA,MAAMC,GAAG,GAAGN,MAAM,CAACK,CAAD,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A;EACD,GAtDE;;;EAwDH,EAAOoQ,OAAAA,oBAAoB,CAACrT,IAArB,CACLW,gBAAM,CAAEyB,YAAD,IAAkBA,YAAY,CAACd,IAAb,KAAsB,QAAzC,CADD,EAELkS,eAAK,CAAC,WAAD,CAFA,EAGLvQ,eAAK,EAHA,CAAP,CAAA;EAKD,CA3FD;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"marking-menu.js","sources":["src/utils.js","src/move/pointer-events.js","src/move/linear-drag.js","src/move/long-move.js","src/move/dwelling.js","src/move/draw.js","src/navigation/novice-navigation.js","src/recognizer/find-points.js","src/recognizer/articulation-points.js","src/recognizer/stroke-length.js","src/recognizer/recognize-mm-stroke.js","src/navigation/expert-navigation.js","src/navigation/navigation.js","node_modules/style-inject/dist/style-inject.es.js","src/layout/menu.js","src/layout/stroke.js","node_modules/raf-schd/dist/raf-schd.esm.js","src/layout/connect.js","src/layout/gesture-feedback.js","src/model.js","src/main.js"],"sourcesContent":["/**\n * @param {number} a the dividend\n * @param {number} n the divisor\n * @return {number} The modulo of `a` over `n` (% is not exactly modulo but remainder).\n */\nexport const mod = (a, n) => ((a % n) + n) % n;\n\n/**\n * @param {number} radians an angle in radians\n * @return {number} The angle in degrees.\n */\nexport const radiansToDegrees = (radians) => radians * (180 / Math.PI);\n\n/**\n * @param {number} degrees an angle in degrees\n * @return {number} The angle in radians.\n */\nexport const degreesToRadians = (degrees) => degrees * (Math.PI / 180);\n\n/**\n * @param {number} alpha a first angle (in degrees)\n * @param {number} beta a second angle (in degrees)\n * @return {number} The (signed) delta between the two angles (in degrees).\n */\nexport const deltaAngle = (alpha, beta) => mod(beta - alpha + 180, 360) - 180;\n\n/**\n * Calculate the euclidean distance between two\n * points.\n *\n * @param {List} point1 - The first point\n * @param {List} point2 - The second point\n * @return {number} The distance between the two points.\n */\nexport const dist = (point1, point2) => {\n const sum = point1.reduce((acc, x1i, i) => {\n const x2i = point2[i];\n return acc + (x2i - x1i) ** 2;\n }, 0);\n return Math.sqrt(sum);\n};\n\nconst ANGLE_ROUNDING = 10e-8;\n/**\n * @param {number[]} a - The first point.\n * @param {number[]} b - The second point, center of the angle.\n * @param {number[]} c - The third point.\n * @return {number} The angle abc (in degrees) rounded at the 8th decimal.\n */\nexport const angle = (a, b, c) => {\n const lab = dist(a, b);\n const lbc = dist(b, c);\n const lac = dist(a, c);\n const cos = (lab ** 2 + lbc ** 2 - lac ** 2) / (2 * lab * lbc);\n // Due to rounding, it can happen than cos ends up being slight > 1 or slightly < -1.\n // This fixes it.\n const adjustedCos = Math.max(-1, Math.min(1, cos));\n const angleABC = radiansToDegrees(Math.acos(adjustedCos));\n // Round the angle to avoid rounding issues.\n return Math.round(angleABC / ANGLE_ROUNDING) * ANGLE_ROUNDING;\n};\n\n/**\n * @callback findMaxEntryComp\n * @param {*} item1 - A first item.\n * @param {*} item2 - A second item.\n * @return {number} A positive number if the second item should be ranked higher than the first,\n * a negative number if it should be ranked lower and 0 if they should be ranked\n * the same.\n */\n\n/**\n * @param {List} list - A list of items.\n * @param {findMaxEntryComp} comp - A function to calculate a value from an item.\n * @return {[index, item]} The found entry.\n */\nexport const findMaxEntry = (list, comp) =>\n list.slice(0).reduce(\n (result, item, index) => {\n if (comp(result[1], item) > 1) return [index, item];\n return result;\n },\n [0, list[0]]\n );\n\n/**\n * Converts the coordinates of a point in polar coordinates (angle in degrees).\n *\n * @param {number[]} point - A point.\n * @param {number[]} [pole=[0, 0]] - The pole of a polar coordinate\n * system\n * @return {{azymuth, radius}} The angle coordinate of the point in the polar\n * coordinate system in degrees.\n */\nexport const toPolar = ([px, py], [cx, cy] = [0, 0]) => {\n const x = px - cx;\n const y = py - cy;\n return {\n azymuth: radiansToDegrees(Math.atan2(y, x)),\n radius: Math.sqrt(x * x + y * y),\n };\n};\n","// Create a custom pointer event from a touch event.\nexport const createPEventFromTouchEvent = (touchEvt) => {\n const touchList = Array.from(touchEvt.targetTouches);\n const sumX = touchList.reduce((acc, t) => acc + t.clientX, 0);\n const sumY = touchList.reduce((acc, t) => acc + t.clientY, 0);\n const meanX = sumX / touchList.length;\n const meanY = sumY / touchList.length;\n return {\n originalEvent: touchEvt,\n position: [meanX, meanY],\n timeStamp: touchEvt.timeStamp,\n };\n};\n\n// Create a custom pointer from a mouse event.\nexport const createPEventFromMouseEvent = (mouseEvt) => ({\n originalEvent: mouseEvt,\n position: [mouseEvt.clientX, mouseEvt.clientY],\n timeStamp: mouseEvt.timeStamp,\n});\n","import { fromEvent, of, merge } from 'rxjs';\nimport {\n map,\n takeUntil,\n publishBehavior,\n filter,\n startWith,\n} from 'rxjs/operators';\nimport {\n createPEventFromMouseEvent,\n createPEventFromTouchEvent,\n} from './pointer-events';\n\n// Higher order observable tracking mouse drags.\nexport const mouseDrags = (rootDOM) =>\n fromEvent(rootDOM, 'mousedown').pipe(\n map((downEvt) => {\n // Make sure we include the first mouse down event.\n const drag$ = merge(of(downEvt), fromEvent(rootDOM, 'mousemove')).pipe(\n takeUntil(fromEvent(rootDOM, 'mouseup')),\n // Publish it as a behavior so that any new subscription will\n // get the last drag position.\n publishBehavior()\n );\n drag$.connect();\n return drag$;\n }),\n map((o) => o.pipe(map((...args) => createPEventFromMouseEvent(...args))))\n );\n\n// Higher order observable tracking touch drags.\nexport const touchDrags = (rootDOM) =>\n fromEvent(rootDOM, 'touchstart').pipe(\n // Menu is supposed to have pointer-events: none so we can safely rely on\n // targetTouches.\n filter((evt) => evt.targetTouches.length === 1),\n map((firstEvent) => {\n const drag$ = fromEvent(rootDOM, 'touchmove').pipe(\n startWith(firstEvent),\n takeUntil(\n merge(\n fromEvent(rootDOM, 'touchend'),\n fromEvent(rootDOM, 'touchcancel'),\n fromEvent(rootDOM, 'touchstart')\n ).pipe(filter((evt) => evt.targetTouches.length !== 1))\n ),\n publishBehavior()\n );\n // FIXME: the line below retains the subscription until next touch end.\n drag$.connect();\n return drag$;\n }),\n map((o) => o.pipe(map(createPEventFromTouchEvent)))\n );\n\n/**\n * @param {HTMLElement} rootDOM - the DOM element to observe pointer events on.\n * @return {Observable} A higher order observable that drag observables. The sub-observables are\n * published as behaviors so that any new subscription immediately get the last\n * position.\n * @param {function[]} [dragObsFactories] - factory to use to observe drags.\n */\nconst watchDrags = (rootDOM, dragObsFactories = [touchDrags, mouseDrags]) =>\n merge(...dragObsFactories.map((f) => f(rootDOM)));\n\nexport default watchDrags;\n","import { scan, filter, map } from 'rxjs/operators';\nimport { dist } from '../utils';\n\n/**\n * Filter out small movements out of a drag observable.\n * @param {Observable} drag$ - An observable on drag movements.\n * @param {number} movementsThreshold - The threshold below which movements are considered\n * static.\n * @return {Observable} An observable only emitting on long enough movements.\n */\nexport default (drag$, movementsThreshold = 0) =>\n drag$.pipe(\n scan(([prev], cur) => {\n // Initial value.\n if (prev == null) return [cur, false];\n\n // End of drag can never be a long move. Such events aren't supposed to be\n // emitted by drag observable though.\n if (cur.type === 'end' || cur.type === 'cancel') return [cur, false];\n\n // If the distance is still below the threshold, re-emit the previous\n // event. It will be filtered-out later, but will come back again as\n // prev on the next scan call.\n if (dist(prev.position, cur.position) < movementsThreshold)\n return [prev, false];\n\n // Otherwise, emit the new event.\n return [cur, true];\n }, []),\n filter(([, pass]) => pass),\n map((x) => x[0])\n );\n","import { merge } from 'rxjs';\nimport {\n debounceTime,\n takeUntil,\n first,\n withLatestFrom,\n last,\n} from 'rxjs/operators';\nimport longMoves from './long-move';\n\n/**\n * @param {Observable} drag$ - An observable on drag movements.\n * @param {number} delay - The time (in ms) to wait before considering an absence of movements\n * as a dwell.\n * @param {number} [movementsThreshold=0] - The threshold below which movements are considered\n * static.\n * @param {Scheduler} [scheduler] - The scheduler to use for managing the timers that handle the timeout\n * for each value\n * @return {Observable} An observable on dwellings in the movement.\n */\nexport default (drag$, delay, movementsThreshold = 0, scheduler = undefined) =>\n merge(drag$.pipe(first()), longMoves(drag$, movementsThreshold)).pipe(\n // Emit when no long movements happend for delay time.\n debounceTime(delay, scheduler),\n // debounceTime emits the last item when the source observable completes.\n // We don't want that here so we only take until drag is done.\n takeUntil(drag$.pipe(last())),\n // Make sure we do emit the last position.\n withLatestFrom(drag$, (_, last_) => last_)\n );\n","import { scan } from 'rxjs/operators';\n\n/**\n * Augment a drag$ observable so that events also include the stroke.\n * @param {Observable} drag$ - An observable of drag movements.\n * @param {List} initStroke - Initial stroke.\n * @return {Observable} An observable on the gesture drawing.\n */\nexport default (drag$, { initStroke = [], type = undefined }) => {\n const typeOpts = type === undefined ? {} : { type };\n return drag$.pipe(\n scan(\n (acc, notification) => ({\n stroke: [...acc.stroke, notification.position],\n ...typeOpts,\n ...notification,\n }),\n { stroke: initStroke }\n )\n );\n};\n","import { merge } from 'rxjs';\nimport {\n scan,\n startWith,\n share,\n last,\n map,\n filter,\n switchAll,\n take,\n} from 'rxjs/operators';\nimport { toPolar } from '../utils';\nimport { dwellings } from '../move';\n\nexport const noviceMoves = (drag$, menu, { menuCenter, minSelectionDist }) => {\n // Analyse local movements.\n const moves$ = drag$.pipe(\n scan(\n (last_, n) => {\n const { azymuth, radius } = toPolar(n.position, menuCenter);\n const active =\n radius < minSelectionDist ? null : menu.getNearestChild(azymuth);\n const type = last_.active === active ? 'move' : 'change';\n return { active, type, azymuth, radius, ...n };\n },\n { active: null }\n ),\n startWith({\n type: 'open',\n menu,\n center: menuCenter,\n timeStamp: performance ? performance.now() : Date.now(),\n }),\n share()\n );\n\n const end$ = moves$.pipe(\n startWith({}),\n last(),\n map((n) => ({\n ...n,\n type: n.active && n.active.isLeaf() ? 'select' : 'cancel',\n selection: n.active,\n }))\n );\n\n return merge(moves$, end$).pipe(share());\n};\n\nexport const menuSelection = (\n move$,\n { subMenuOpeningDelay, movementsThreshold, minMenuSelectionDist }\n) =>\n // Wait for a pause in the movements.\n dwellings(move$, subMenuOpeningDelay, movementsThreshold).pipe(\n // Filter dwellings occurring outside of the selection area.\n filter(\n (n) => n.active && n.radius > minMenuSelectionDist && !n.active.isLeaf()\n )\n );\n\nexport const subMenuNavigation = (menuSelection$, drag$, subNav, navOptions) =>\n menuSelection$.pipe(\n map((n) =>\n subNav(drag$, n.active, { menuCenter: n.position, ...navOptions })\n )\n );\n\n/**\n * @param {Observable} drag$ - An observable of drag movements.\n * @param {MMItem} menu - The model of the menu.\n * @param {object} options - Configuration options.\n * @return {Observable} An observable on the menu navigation events.\n */\nconst noviceNavigation = (\n drag$,\n menu,\n {\n minSelectionDist,\n minMenuSelectionDist,\n movementsThreshold,\n subMenuOpeningDelay,\n menuCenter,\n noviceMoves: noviceMoves_ = noviceMoves,\n menuSelection: menuSelection_ = menuSelection,\n subMenuNavigation: subMenuNavigation_ = subMenuNavigation,\n }\n) => {\n // Observe the local navigation.\n const move$ = noviceMoves_(drag$, menu, {\n menuCenter,\n minSelectionDist,\n }).pipe(share());\n\n // Look for (sub)menu selection.\n const menuSelection$ = menuSelection_(move$, {\n subMenuOpeningDelay,\n movementsThreshold,\n minMenuSelectionDist,\n });\n\n // Higher order observable on navigation inside sub-menus.\n const subMenuNavigation$ = subMenuNavigation_(\n menuSelection$,\n drag$,\n noviceNavigation,\n {\n minSelectionDist,\n minMenuSelectionDist,\n movementsThreshold,\n subMenuOpeningDelay,\n noviceMoves: noviceMoves_,\n menuSelection: menuSelection_,\n subMenuNavigation: subMenuNavigation_,\n }\n );\n\n // Start with local navigation but switch to the first sub-menu navigation\n // (if any).\n return subMenuNavigation$.pipe(take(1), startWith(move$), switchAll());\n};\n\nexport default noviceNavigation;\n","import { dist, angle } from '../utils';\n\n/**\n * @param {Array.} pointList - The list of points.\n * @param {number} minDist - A distance.\n * @param {object} options - Options.\n * @param {number} [options.direction=1] - The direction of the lookup: negative values means\n * descending lookup.\n * @param {number} [options.startIndex] - The index of the first point to investigate inside\n * pointList. If not provided, the lookup will start\n * from the start or the end of pointList depending\n * on `direction`.\n * @param {number[]} [options.refPoint=pointList[startIndex]] - The reference point.\n * @return {number} The index of the first point inside pointList that it at least `minDist` from\n * `refPoint`.\n */\nexport const findNextPointFurtherThan = (\n pointList,\n minDist,\n {\n direction = 1,\n startIndex = direction > 0 ? 0 : pointList.length - 1,\n refPoint = pointList[startIndex],\n } = {}\n) => {\n const step = direction / Math.abs(direction);\n const n = pointList.length;\n for (let i = startIndex; i < n && i >= 0; i += step) {\n if (dist(refPoint, pointList[i]) >= minDist) {\n return i;\n }\n }\n return -1;\n};\n\n/**\n * @param {number[]} pointA - The point a.\n * @param {number[]} pointC - The point b.\n * @param {List.} pointList - A list of points.\n * @param {number[]} options - Options.\n * @param {number} [options.startIndex=0] - The index of the first point to investigate inside\n * pointList.\n * @param {number} [options.endIndex=pointList.length - 1] - The index of the first point to\n * investigate inside pointList.\n * @return {{index, angle}} The index of the point b of pointList that maximizes the angle abc and\n * the angle abc.\n */\nexport const findMiddlePointForMinAngle = (\n pointA,\n pointC,\n pointList,\n { startIndex = 0, endIndex = pointList.length - 1 } = {}\n) => {\n let minAngle = Infinity;\n let maxAngleIndex = -1;\n for (let i = startIndex; i <= endIndex; i += 1) {\n const thisAngle = angle(pointA, pointList[i], pointC);\n if (thisAngle < minAngle) {\n minAngle = thisAngle;\n maxAngleIndex = i;\n }\n }\n return { index: maxAngleIndex, angle: minAngle };\n};\n","import {\n findNextPointFurtherThan,\n findMiddlePointForMinAngle,\n} from './find-points';\n\n/**\n * @typedef {number[]} Point\n */\n\n/**\n * A segment.\n * @typedef {Point[2]} Segment\n */\n\n/**\n * @param {Point[]} stroke - The points of a stroke.\n * @param {number} expectedSegmentLength - The expected length of a segment\n * (usually strokeLength / maxMenuDepth).\n * @param {number} angleThreshold - The min angle threshold in a point required for it to be\n * considered an articulation points.\n * @return {Point[]} The list of articulation points.\n */\nconst getStrokeArticulationPoints = (\n stroke,\n expectedSegmentLength,\n angleThreshold\n) => {\n const n = stroke.length;\n if (n === 0) return [];\n const w = expectedSegmentLength * 0.3;\n\n // Add the first point of the stroke.\n const articulationPoints = [stroke[0]];\n\n let ai = 0;\n let a = stroke[ai];\n while (ai < n) {\n const ci = findNextPointFurtherThan(stroke, w, {\n startIndex: ai + 2,\n refPoint: a,\n });\n if (ci < 0) break;\n const c = stroke[ci];\n const labi = findNextPointFurtherThan(stroke, w / 8, {\n startIndex: ai + 1,\n refPoint: a,\n });\n const lbci = findNextPointFurtherThan(stroke, w / 8, {\n startIndex: ci - 1,\n refPoint: c,\n direction: -1,\n });\n const { index: bi, angle: angleABC } = findMiddlePointForMinAngle(\n a,\n stroke[ci],\n stroke,\n {\n startIndex: labi,\n endIndex: lbci,\n }\n );\n if (bi > 0 && Math.abs(180 - angleABC) > angleThreshold) {\n const b = stroke[bi];\n articulationPoints.push(b);\n a = b;\n ai = bi;\n } else {\n ai += 1;\n a = stroke[ai];\n }\n }\n\n // Add the last point of the stroke.\n articulationPoints.push(stroke[stroke.length - 1]);\n return articulationPoints;\n};\n\nexport default getStrokeArticulationPoints;\n","import { dist } from '../utils';\n\n/**\n * @param {List>} stroke - A stroke.\n * @return {number} The length of the stroke `stroke`.\n */\nexport default (stroke) =>\n stroke.reduce(\n (res, current) => {\n const prev = res.prev || current;\n return {\n prev: current,\n length: res.length + dist(prev, current),\n };\n },\n { length: 0 }\n ).length;\n","import getStrokeArticulationPoints from './articulation-points';\nimport { dist, findMaxEntry, radiansToDegrees } from '../utils';\nimport strokeLength from './stroke-length';\n\n/**\n * @param {Point[]} points - A list of points.\n * @return {Segment[]} The list of segments joining the points of `points`.\n */\nexport const pointsToSegments = (points) =>\n points.slice(1).reduce(\n ({ segments, last }, current) => {\n segments.push([last, current]);\n return { segments, last: current };\n },\n { last: points[0], segments: [] }\n ).segments;\n\n/**\n * @param {Item} model - The marking menu model.\n * @param {{ angle }[]} segments - A list of segments to walk the model.\n * @param {number} [startIndex=0] - The start index in the angle list.\n * @return {Item} The corresponding item found by walking the model.\n */\nexport const walkMMModel = (model, segments, startIndex = 0) => {\n if (!model || segments.length === 0 || model.isLeaf()) return null;\n const item = model.getNearestChild(segments[startIndex].angle);\n if (startIndex + 1 >= segments.length) {\n return item;\n }\n return walkMMModel(item, segments, startIndex + 1);\n};\n\nexport const segmentAngle = (a, b) =>\n radiansToDegrees(Math.atan2(b[1] - a[1], b[0] - a[0]));\n\n/**\n * @param {{angle, length}[]} segments - A list of segments.\n * @return {{angle, length}[]} A new list of segments with the longest segments divided in two.\n */\nexport const divideLongestSegment = (segments) => {\n const [longestI, longest] = findMaxEntry(\n segments,\n (s1, s2) => s2.length - s1.length\n );\n return [\n ...segments.slice(0, longestI),\n { length: longest.length / 2, angle: longest.angle },\n { length: longest.length / 2, angle: longest.angle },\n ...segments.slice(longestI + 1),\n ];\n};\n\n/**\n * @param {Item} model - The marking menu model.\n * @param {{length, angle}[]} segments - A list of segments.\n * @param {number} [maxDepth=model.getMaxDepth()] - The maximum depth of the item.\n * @return {Item} The selected item.\n */\nexport const findMMItem = (model, segments, maxDepth = model.getMaxDepth()) => {\n // If there is not segments, there is no selection to find.\n if (!segments.length) return null;\n // While we haven't found a leaf item, divide the longest segment and walk the model.\n let currentSegments = segments;\n let currentItem = null;\n while (currentSegments.length <= maxDepth) {\n currentItem = walkMMModel(model, currentSegments);\n if (currentItem && currentItem.isLeaf()) return currentItem;\n currentSegments = divideLongestSegment(currentSegments);\n }\n return currentItem;\n};\n\n/**\n * @param {List.} stroke - A list of points.\n * @param {Item} model - The marking menu model.\n * @param {object} [options] - Additional options.\n * @param {number} [maxDepth] - The maximum menu depth to walk. If negative,\n * start from the maximum depth of the model.\n * @param {boolean} [requireMenu=false] - Look for a menu item. This\n * works best with a negative value for maxDepth.\n * @param {boolean} [requireLeaf=!requireMenu] - Look for a leaf.\n * @return {Item} The item recognized by the stroke.\n */\nconst recognizeMMStroke = (\n stroke,\n model,\n {\n maxDepth: maxDepth_ = model.getMaxDepth(),\n requireMenu = false,\n requireLeaf = !requireMenu,\n } = {}\n) => {\n if (requireLeaf && requireMenu) {\n throw new Error('The result cannot be both a leaf and a menu');\n }\n const maxDepth = maxDepth_ < 0 ? model.getMaxDepth() + maxDepth_ : maxDepth_;\n const maxMenuBreadth = model.getMaxBreadth();\n const length = strokeLength(stroke);\n const expectedSegmentLength = length / maxDepth;\n const sensitivity = 0.75;\n const angleThreshold = 360 / maxMenuBreadth / 2 / sensitivity;\n const articulationPoints = getStrokeArticulationPoints(\n stroke,\n expectedSegmentLength,\n angleThreshold\n );\n const minSegmentSize = expectedSegmentLength / 3;\n // Get the segments of the marking menus.\n const segments = pointsToSegments(articulationPoints)\n // Change the representation of the segment to include its length.\n .map((seg) => ({ points: seg, length: dist(...seg) }))\n // Remove the segments that are too small.\n .filter((seg) => seg.length > minSegmentSize)\n // Change again the representation of the segment to include its length but not its\n // its points anymore.\n .map((seg) => ({ angle: segmentAngle(...seg.points), length: seg.length }));\n const item = findMMItem(model, segments, maxDepth);\n if (requireLeaf) {\n return item && item.isLeaf() ? item : null;\n }\n if (requireMenu) {\n return item && item.isLeaf() ? item.parent : item;\n }\n return item;\n};\n\nexport default recognizeMMStroke;\n","import { merge } from 'rxjs';\nimport { startWith, last, map, share } from 'rxjs/operators';\nimport { draw } from '../move';\nimport recognize from '../recognizer';\n\n/**\n * @param {Observable} drag$ - An observable of drag movements.\n * @param {MMItem} model - The model of the menu.\n * @param {List} initStroke - Initial stroke.\n * @return {Observable} An observable on the gesture drawing and recognition.\n */\nexport default (drag$, model, initStroke = []) => {\n // Observable on gesture drawing.\n const draw$ = draw(drag$, { initStroke, type: 'draw' }).pipe(share());\n\n // Track the end of the drawing and attempt to recognize the gesture.\n const end$ = draw$.pipe(\n startWith(null),\n last(),\n map((e) => {\n if (!e) return { type: 'cancel' };\n const selection = recognize(e.stroke, model);\n if (selection) {\n return { ...e, type: 'select', selection };\n }\n return { ...e, type: 'cancel' };\n })\n );\n return merge(draw$, end$);\n};\n","import { race, of } from 'rxjs';\nimport {\n take,\n map,\n skip,\n startWith,\n switchAll,\n mergeMap,\n exhaustMap,\n} from 'rxjs/operators';\nimport noviceNavigation from './novice-navigation';\nimport expertNavigation from './expert-navigation';\nimport { longMoves, dwellings, draw } from '../move';\nimport recognize from '../recognizer';\n\nexport const confirmedNoviceNavigationHOO = (drag$, start, model, options) =>\n dwellings(drag$, options.noviceDwellingTime, options.movementsThreshold).pipe(\n take(1),\n map(() =>\n (start != null ? of(start) : drag$).pipe(\n take(1),\n mergeMap((start_) =>\n noviceNavigation(\n // Same as before, skip the first.\n drag$.pipe(skip(1)),\n model,\n { ...options, menuCenter: start_.position }\n ).pipe(map((n) => ({ ...n, mode: 'novice' })))\n )\n )\n )\n );\n\nexport const expertToNoviceSwitchHOO = (drag$, model, initStroke, options) =>\n dwellings(\n draw(drag$, { initStroke }),\n options.noviceDwellingTime,\n options.movementsThreshold\n ).pipe(\n take(1),\n map((evt) => {\n // Look for the furthest menu (not leaf).\n const menu = recognize(evt.stroke, model, {\n maxDepth: -1,\n requireMenu: true,\n });\n if (!menu || menu.isRoot()) {\n return of({ ...evt, type: 'cancel' });\n }\n // Start a novice navigation from there.\n return noviceNavigation(drag$.pipe(skip(1)), menu, {\n ...options,\n menuCenter: evt.position,\n });\n })\n );\n\nexport const confirmedExpertNavigationHOO = (\n drag$,\n model,\n {\n expertToNoviceSwitchHOO: expertToNoviceSwitchHOO_ = expertToNoviceSwitchHOO,\n ...options\n } = {}\n) =>\n longMoves(draw(drag$, { type: 'draw' }), options.movementsThreshold).pipe(\n take(1),\n map((e) => {\n const expertNav$ = expertNavigation(\n // Drag always return the last value when observed, in this case we are\n // not interested in it as it has already been took into account.\n drag$.pipe(skip(1)),\n model,\n e.stroke\n ).pipe(map((n) => ({ ...n, mode: 'expert' })));\n return expertToNoviceSwitchHOO_(drag$, model, e.stroke, options).pipe(\n startWith(expertNav$),\n switchAll()\n );\n })\n );\n\nexport const startup = (drag$, model) =>\n expertNavigation(drag$, model).pipe(\n map((n, i) =>\n i === 0\n ? { ...n, type: 'start', mode: 'startup' }\n : { ...n, mode: 'startup' }\n )\n );\n\nexport const navigationFromDrag = (\n drag$,\n start,\n model,\n options,\n {\n confirmedExpertNavigationHOO:\n confirmedExpertNavigationHOO_ = confirmedExpertNavigationHOO,\n confirmedNoviceNavigationHOO:\n confirmedNoviceNavigationHOO_ = confirmedNoviceNavigationHOO,\n startup: startup_ = startup,\n } = {}\n) => {\n // Start up observable (while neither expert or novice are confirmed).\n const startUp$ = startup_(drag$, model);\n\n // Observable on confirmed expert navigation.\n const confirmedExpertNavigation$$ = confirmedExpertNavigationHOO_(\n drag$,\n model,\n options\n );\n\n // Observable on confirmed novice navigation.\n const confirmedNoviceNavigation$$ = confirmedNoviceNavigationHOO_(\n drag$,\n start,\n model,\n options\n );\n\n // Observable on expert or novice navigation once confirmed.\n const confirmedNavigation$$ = race(\n confirmedExpertNavigation$$,\n confirmedNoviceNavigation$$\n );\n\n // Start with startup navigation (similar to expert) but switch to the\n // confirmed navigation as soon as it is settled.\n return confirmedNavigation$$.pipe(startWith(startUp$), switchAll());\n};\n\n/**\n * @param {Observable} drags$ - A higher order observable on drag movements.\n * @param {MMItem} menu - The model of the menu.\n * @param {object} options - Configuration options (see {@link ../index.js}).\n * @param {function} [navigationFromDrag_] - function to convert a drags higher\n * order observable to a navigation\n * observable.\n * @return {Observable} An observable on the marking menu events.\n */\nexport default (\n drags$,\n menu,\n options,\n navigationFromDrag_ = navigationFromDrag\n) =>\n drags$.pipe(\n exhaustMap((drag$) =>\n drag$.pipe(\n take(1),\n mergeMap((start) => navigationFromDrag_(drag$, start, menu, options))\n )\n )\n );\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import { degreesToRadians } from '../utils';\nimport './menu.css';\n\nconst template = ({ items, center }, doc) => {\n const main = doc.createElement('div');\n main.className = 'marking-menu';\n main.style.setProperty('--center-x', `${center[0]}px`);\n main.style.setProperty('--center-y', `${center[1]}px`);\n for (let i = 0; i < items.length; i += 1) {\n const item = items[i];\n const elt = doc.createElement('div');\n elt.className = 'marking-menu-item';\n elt.dataset.itemId = item.id;\n elt.style.setProperty('--angle', `${item.angle}deg`);\n // Identify corner items as these may be styled differently.\n if (item.angle === 45) {\n elt.classList.add('bottom-right-item');\n } else if (item.angle === 135) {\n elt.classList.add('bottom-left-item');\n } else if (item.angle === 225) {\n elt.classList.add('top-left-item');\n } else if (item.angle === 315) {\n elt.classList.add('top-right-item');\n }\n const radAngle = degreesToRadians(item.angle);\n // Why -radAngle? I got the css math wrong at some point, but it works like\n // this and I could not be bothered fixing it.\n elt.style.setProperty('--cosine', Math.cos(-radAngle));\n elt.style.setProperty('--sine', Math.sin(-radAngle));\n elt.innerHTML += '
';\n elt.innerHTML += `
${item.name}
`;\n main.appendChild(elt);\n }\n\n return main;\n};\n\n/**\n * Create the Menu display.\n * @param {HTMLElement} parent - The parent node.\n * @param {ItemModel} model - The model of the menu to open.\n * @param {[int, int]} center - The center of the menu.\n * @param {String} [current] - The currently active item.\n * @param {Document} [options] - Menu options.\n * @param {Document} [options.doc=document] - The root document of the menu.\n * Mostly useful for testing purposes.\n * @return {{ setActive, remove }} - The menu controls.\n */\nconst createMenu = (\n parent,\n model,\n center,\n current,\n { doc = document } = {}\n) => {\n // Create the DOM.\n const main = template({ items: model.children, center }, doc);\n parent.appendChild(main);\n\n // Clear any active items.\n const clearActiveItems = () => {\n Array.from(main.querySelectorAll('.active')).forEach((itemDom) =>\n itemDom.classList.remove('active')\n );\n };\n\n // Return an item DOM element from its id.\n const getItemDom = (itemId) =>\n main.querySelector(`.marking-menu-item[data-item-id=\"${itemId}\"]`);\n\n // Mark an item as active.\n const setActive = (itemId) => {\n // Clear any active items.\n clearActiveItems();\n\n // Set the active class.\n if (itemId || itemId === 0) {\n getItemDom(itemId).classList.add('active');\n }\n };\n\n // Function to remove the menu.\n const remove = () => parent.removeChild(main);\n\n // Initialize the menu.\n if (current) setActive(current);\n\n // Create the interface.\n return { setActive, remove };\n};\n\nexport default createMenu;\n","/**\n * @param {HTMLElement} parent - The parent node.\n * @param {Document} options - Options.\n * @param {Document} [options.doc=document] - The root document. Mostly useful for testing purposes.\n * @param {number} [options.lineWidth=2] - The width of the stroke.\n * @param {string} [options.lineColor='black'] - CSS representation of the stroke color.\n * @param {number} [options.startPointRadius=0] - The radius of the start point.\n * @param {number} [options.startPointColor=options.lineColor] - CSS representation of the start\n * point color.\n * @param {number} [options.ptSize=1 / devicePixelRatio] - The size of the canvas points\n * (px).\n * @return {{ clear, setStroke, remove }} The canvas methods.\n */\nexport default (\n parent,\n {\n doc = document,\n lineWidth = 2,\n lineColor = 'black',\n pointRadius = 0,\n pointColor = lineColor,\n ptSize = window.devicePixelRatio ? 1 / window.devicePixelRatio : 1,\n }\n) => {\n // Create the canvas.\n const { width, height } = parent.getBoundingClientRect();\n const canvas = doc.createElement('canvas');\n canvas.width = width / ptSize;\n canvas.height = height / ptSize;\n Object.assign(canvas.style, {\n position: 'absolute',\n left: 0,\n top: 0,\n width: `${width}px`,\n height: `${height}px`,\n 'pointer-events': 'none',\n });\n parent.appendChild(canvas);\n\n // Get the canvas' context and set it up\n const ctx = canvas.getContext('2d');\n // Scale to the device pixel ratio.\n ctx.scale(1 / ptSize, 1 / ptSize);\n\n /**\n * @param {number[]} point - Position of the point to draw.\n * @return {undefined}\n */\n const drawPoint = ([x, y]) => {\n ctx.save();\n ctx.strokeStyle = 'none';\n ctx.fillStyle = pointColor;\n ctx.beginPath();\n ctx.moveTo(x + pointRadius, y);\n ctx.arc(x, y, pointRadius, 0, 360);\n ctx.fill();\n ctx.restore();\n };\n\n /**\n * Clear the canvas.\n *\n * @return {undefined}\n */\n const clear = () => {\n ctx.clearRect(0, 0, width, height);\n };\n\n /**\n * Draw the stroke.\n *\n * @param {List} stroke - The new stroke.\n * @return {undefined}\n */\n const drawStroke = (stroke) => {\n ctx.save();\n ctx.fillStyle = 'none';\n ctx.lineJoin = 'round';\n ctx.lineCap = 'round';\n ctx.strokeStyle = lineColor;\n ctx.lineWidth = lineWidth;\n ctx.beginPath();\n stroke.forEach((point, i) => {\n if (i === 0) ctx.moveTo(...point);\n else ctx.lineTo(...point);\n });\n ctx.stroke();\n ctx.restore();\n };\n\n /**\n * Destroy the canvas.\n * @return {undefined}\n */\n const remove = () => {\n canvas.remove();\n };\n\n return { clear, drawStroke, drawPoint, remove };\n};\n","var rafSchd = function rafSchd(fn) {\n var lastArgs = [];\n var frameId = null;\n\n var wrapperFn = function wrapperFn() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n lastArgs = args;\n\n if (frameId) {\n return;\n }\n\n frameId = requestAnimationFrame(function () {\n frameId = null;\n fn.apply(void 0, lastArgs);\n });\n };\n\n wrapperFn.cancel = function () {\n if (!frameId) {\n return;\n }\n\n cancelAnimationFrame(frameId);\n frameId = null;\n };\n\n return wrapperFn;\n};\n\nexport default rafSchd;\n","import { finalize, tap } from 'rxjs/operators';\nimport rafThrottle from 'raf-schd';\n\n/**\n * Connect navigation notifications to menu opening and closing.\n *\n * @param {HTMLElement} parentDOM - The element where to append the menu.\n * @param {Observable} navigation$ - Notifications of the navigation.\n * @param {Function} createMenuLayout - Menu layout factory.\n * @param {Function} createUpperStrokeCanvas - Upper stroke canvas factory. The\n * upper stroke show the user interaction on the current menu, and the movements\n * in expert mode.\n * @param {Function} createLowerStrokeCanvas - Lower stroke canvas factory. The\n * lower stroke is stroke drawn below the menu. It keeps track of the previous\n * movements.\n * @param {Function} createGestureFeedback - Create gesture feedback.\n * @param {{error}} log - Logger.\n * @return {Observable} `navigation$` with menu opening and closing side effects.\n */\nexport default (\n parentDOM,\n navigation$,\n createMenuLayout,\n createUpperStrokeCanvas,\n createLowerStrokeCanvas,\n createGestureFeedback,\n log\n) => {\n // The menu object.\n let menu = null;\n // A stroke drawn on top of the menu.\n let upperStrokeCanvas = null;\n // A stroke drawn below the menu.\n let lowerStrokeCanvas = null;\n // The points of the lower strokes.\n let lowerStroke = null;\n // The points of the upper stroke.\n let upperStroke = null;\n\n const gestureFeedback = createGestureFeedback(parentDOM);\n\n const closeMenu = () => {\n menu.remove();\n menu = null;\n };\n\n const openMenu = (model, position) => {\n const cbr = parentDOM.getBoundingClientRect();\n menu = createMenuLayout(parentDOM, model, [\n position[0] - cbr.left,\n position[1] - cbr.top,\n ]);\n };\n\n const setActive = (id) => {\n menu.setActive(id);\n };\n\n const startUpperStroke = (position) => {\n upperStrokeCanvas = createUpperStrokeCanvas(parentDOM);\n upperStroke = [position];\n upperStrokeCanvas.drawStroke(upperStroke);\n };\n\n const noviceMove = rafThrottle((position) => {\n if (upperStrokeCanvas) {\n upperStrokeCanvas.clear();\n if (position) {\n upperStroke = [upperStroke[0], position];\n upperStrokeCanvas.drawStroke(upperStroke);\n }\n upperStrokeCanvas.drawPoint(upperStroke[0]);\n }\n });\n\n const expertDraw = rafThrottle((stroke) => {\n // FIXME: Not very efficient.\n if (upperStrokeCanvas) {\n upperStrokeCanvas.clear();\n upperStroke = stroke.slice();\n upperStrokeCanvas.drawStroke(upperStroke);\n }\n });\n\n const clearUpperStroke = () => {\n upperStrokeCanvas.remove();\n upperStrokeCanvas = null;\n upperStroke = null;\n };\n\n const swapUpperStroke = () => {\n lowerStroke = lowerStroke ? [...lowerStroke, ...upperStroke] : upperStroke;\n clearUpperStroke();\n lowerStrokeCanvas = lowerStrokeCanvas || createLowerStrokeCanvas(parentDOM);\n lowerStrokeCanvas.drawStroke(lowerStroke);\n };\n\n const clearLowerStroke = () => {\n if (lowerStrokeCanvas) {\n lowerStrokeCanvas.remove();\n lowerStrokeCanvas = null;\n }\n lowerStroke = null;\n };\n\n const showGestureFeedback = (isCanceled) => {\n gestureFeedback.show(\n lowerStroke ? [...lowerStroke, ...upperStroke] : upperStroke,\n isCanceled\n );\n };\n\n const cleanUp = () => {\n // Make sure everything is cleaned upon completion.\n if (menu) closeMenu();\n if (upperStrokeCanvas) clearUpperStroke();\n if (lowerStrokeCanvas) clearLowerStroke();\n gestureFeedback.remove();\n // eslint-disable-next-line no-param-reassign\n parentDOM.style.cursor = '';\n };\n\n const onNotification = (notification) => {\n switch (notification.type) {\n case 'open': {\n // eslint-disable-next-line no-param-reassign\n parentDOM.style.cursor = 'none';\n if (menu) closeMenu();\n swapUpperStroke();\n openMenu(notification.menu, notification.center);\n startUpperStroke(notification.center);\n noviceMove(notification.position);\n break;\n }\n case 'change': {\n setActive((notification.active && notification.active.id) || null);\n break;\n }\n case 'select':\n case 'cancel':\n // eslint-disable-next-line no-param-reassign\n parentDOM.style.cursor = '';\n if (menu) closeMenu();\n showGestureFeedback(notification.type === 'cancel');\n clearUpperStroke();\n clearLowerStroke();\n break;\n case 'start':\n // eslint-disable-next-line no-param-reassign\n parentDOM.style.cursor = 'crosshair';\n startUpperStroke(notification.position);\n break;\n case 'draw':\n expertDraw(notification.stroke);\n break;\n case 'move':\n noviceMove(notification.position);\n break;\n default:\n throw new Error(\n `Invalid navigation notification type: ${notification.type}`\n );\n }\n };\n\n return navigation$.pipe(\n tap({\n next(notification) {\n try {\n onNotification(notification);\n } catch (e) {\n log.error(e);\n throw e;\n }\n },\n error(e) {\n log.error(e);\n throw e;\n },\n }),\n finalize(() => {\n try {\n cleanUp();\n } catch (e) {\n log.error(e);\n throw e;\n }\n })\n );\n};\n","import createStrokeCanvas from './stroke';\n\nexport default (\n parentDOM,\n { duration, strokeOptions = {}, canceledStrokeOptions = {} }\n) => {\n let strokeTimeoutEntries = [];\n\n const show = (stroke, isCanceled = false) => {\n const canvas = createStrokeCanvas(parentDOM, {\n ...strokeOptions,\n ...(isCanceled ? canceledStrokeOptions : {}),\n });\n canvas.drawStroke(stroke);\n const timeoutEntry = {\n canvas,\n timeout: setTimeout(() => {\n // Remove the entry from the strokeTimeoutEntries.\n strokeTimeoutEntries = strokeTimeoutEntries.filter(\n (x) => x !== timeoutEntry\n );\n // Clear the stroke canvas.\n canvas.remove();\n }, duration),\n };\n strokeTimeoutEntries.push(timeoutEntry);\n };\n\n const remove = () => {\n strokeTimeoutEntries.forEach(({ timeout, canvas }) => {\n clearTimeout(timeout);\n canvas.remove();\n });\n strokeTimeoutEntries = [];\n };\n\n return { show, remove };\n};\n","import { deltaAngle } from './utils';\n\nconst getAngleRange = (items) => (items.length > 4 ? 45 : 90);\n\n/**\n * Represents an item of the Marking Menu.\n */\nexport class MMItem {\n /**\n * @param {String} id - The item's id. Required except for the root item.\n * @param {String} name - The item's name. Required except for the root item.\n * @param {Integer} angle - The item's angle. Required except for the root item.\n * @param {object} [options] - Some additional options.\n * @param {ItemModel} [options.parent] - The parent menu of the item.\n * @param {List} [options.children] - The children of the item menu.\n */\n constructor(id, name, angle, { parent, children } = {}) {\n this.id = id;\n this.name = name;\n this.angle = angle;\n this.children = children;\n this.parent = parent;\n }\n\n isLeaf() {\n return !this.children || this.children.length === 0;\n }\n\n isRoot() {\n return !this.parent;\n }\n\n /**\n * @param {String} childId - The identifier of the child to look for.\n * @return {Item} the children with the id `childId`.\n */\n getChild(childId) {\n return this.children.find((child) => child.id === childId);\n }\n\n /**\n * @param {String} childName - The name of the children to look for.\n * @return {Item} the children with the name `childName`.\n */\n getChildrenByName(childName) {\n return this.children.filter((child) => child.name === childName);\n }\n\n /**\n * @param {Integer} angle - An angle.\n * @return {Item} the closest children to the angle `angle`.\n */\n getNearestChild(angle) {\n return this.children.reduce((c1, c2) => {\n const delta1 = Math.abs(deltaAngle(c1.angle, angle));\n const delta2 = Math.abs(deltaAngle(c2.angle, angle));\n return delta1 > delta2 ? c2 : c1;\n });\n }\n\n /**\n * @return {number} The maximum depth of the menu.\n */\n getMaxDepth() {\n return this.isLeaf()\n ? 0\n : Math.max(0, ...this.children.map((child) => child.getMaxDepth())) + 1;\n }\n\n /**\n * @return {number} The maximum breadth of the menu.\n */\n getMaxBreadth() {\n return this.isLeaf()\n ? 0\n : Math.max(\n this.children.length,\n ...this.children.map((child) => child.getMaxBreadth())\n );\n }\n}\n\n// Create the model item from a list of items.\nconst recursivelyCreateModelItems = (\n items,\n baseId = undefined,\n parent = undefined\n) => {\n // Calculate the angle range for each items.\n const angleRange = getAngleRange(items);\n // Create the list of model items (frozen).\n return Object.freeze(\n items.map((item, i) => {\n // Standard item id.\n const stdId = baseId ? [baseId, i].join('-') : i.toString();\n // Create the item.\n const mmItem = new MMItem(\n item.id == null ? stdId : item.id,\n typeof item === 'string' ? item : item.name,\n i * angleRange,\n { parent }\n );\n // Add its children if any.\n if (item.children) {\n mmItem.children = recursivelyCreateModelItems(\n item.children,\n stdId,\n mmItem\n );\n }\n // Return it frozen.\n return Object.freeze(mmItem);\n })\n );\n};\n\n/**\n * Create the marking menu model.\n *\n * @param {List} itemList - The list of items.\n * @return {MMItem} - The root item of the model.\n */\nconst createModel = (itemList) => {\n const menu = new MMItem(null, null, null);\n menu.children = recursivelyCreateModelItems(itemList, undefined, menu);\n return Object.freeze(menu);\n};\n\nexport default createModel;\n","import { tap, map, share, filter, pluck } from 'rxjs/operators';\nimport navigation from './navigation';\nimport {\n createMenuLayout,\n createStrokeCanvas,\n connectLayout,\n createGestureFeedback,\n} from './layout';\nimport createModel from './model';\nimport { watchDrags } from './move';\n\n// Clone a notification in a protected way so that the internal state cannot be corrupted.\nexport const exportNotification = (n) => ({\n type: n.type,\n mode: n.mode,\n position: n.position ? n.position.slice() : undefined,\n active: n.active,\n selection: n.selection,\n menuCenter: n.center ? n.center.slice() : undefined,\n timeStamp: n.timeStamp,\n});\n\n/**\n * Create a Marking Menu.\n *\n * @param {List} items - The list of items.\n * @param {HTMLElement} parentDOM - The parent node.\n * @param {Object} [options] - Configuration options for the menu.\n * @param {number} [options.minSelectionDist] - The minimum distance from the center to select an\n * item.\n * @param {number} [options.minMenuSelectionDist] - The minimum distance from the center to open a\n * sub-menu.\n * @param {number} [options.subMenuOpeningDelay] - The dwelling delay before opening a sub-menu.\n * @param {number} [options.movementsThreshold] - The minimum distance between two points to be\n * considered a significant movements and breaking\n * the sub-menu dwelling delay.\n * @param {number} [options.noviceDwellingTime] - The dwelling time required to trigger the novice\n * mode (and open the menu).\n * @param {number} [options.strokeColor] - The color of the gesture stroke.\n * @param {number} [options.strokeWidth] - The width of the gesture stroke.\n * @param {number} [options.strokeStartPointRadius] - The radius of the start point of the stroke\n * (appearing at the middle of the menu in novice\n * mode).\n * @param {number} [options.lowerStrokeColor] - The color of the lower stroke. The lower stroke is\n * the stroke drawn below the menu. It keeps track of\n * the previous movements.\n * @param {number} [options.lowerStrokeWidth] - The width of the lower stroke.\n * @param {number} [options.lowerStrokeStartPointRadius] - The radius of the start point of the\n * stroke.\n * @param {number} [options.gestureFeedbackStrokeWidth] - The width of the stroke of the gesture\n * feedback.\n * @param {number} [options.gestureFeedbackStrokeColor] - The color of the stroke of the gesture\n * feedback.\n * @param {number} [options.gestureFeedbackCanceledStrokeColor] - The color of the stroke of the\n * gesture feedback when the selection is\n * canceled.\n * @param {number} [options.gestureFeedbackDuration] - The duration of the gesture feedback.\n * @param {boolean} [options.notifySteps] - If true, every steps of the marking menu (include move)\n * events, will be notified. Useful for logging.\n * @param {{error, info, warn, debug}} [options.log] - Override the default logger to use.\n * @return {Observable} An observable on menu selections.\n */\nexport default (\n items,\n parentDOM,\n {\n minSelectionDist = 40,\n minMenuSelectionDist = 80,\n subMenuOpeningDelay = 100,\n movementsThreshold = 5,\n noviceDwellingTime = 1000 / 3,\n strokeColor = '#000',\n strokeWidth = 4,\n strokeStartPointRadius = 8,\n lowerStrokeColor = '#777',\n lowerStrokeWidth = strokeWidth,\n lowerStrokeStartPointRadius = lowerStrokeWidth,\n gestureFeedbackDuration = 1000,\n gestureFeedbackStrokeWidth = strokeWidth,\n gestureFeedbackCanceledStrokeColor = '#DE6C52',\n gestureFeedbackStrokeColor = strokeColor,\n notifySteps = false,\n log = {\n // eslint-disable-next-line no-console\n error: console.error && console.error.bind(console),\n // eslint-disable-next-line no-console\n info: console.info && console.info.bind(console),\n // eslint-disable-next-line no-console\n warn: console.warn && console.warn.bind(console),\n debug() {},\n },\n } = {}\n) => {\n // Create the display options\n const menuLayoutOptions = {};\n const strokeCanvasOptions = {\n lineColor: strokeColor,\n lineWidth: strokeWidth,\n pointRadius: strokeStartPointRadius,\n };\n const lowerStrokeCanvasOptions = {\n lineColor: lowerStrokeColor,\n lineWidth: lowerStrokeWidth,\n pointRadius: lowerStrokeStartPointRadius,\n };\n const gestureFeedbackOptions = {\n duration: gestureFeedbackDuration,\n strokeOptions: {\n lineColor: gestureFeedbackStrokeColor,\n lineWidth: gestureFeedbackStrokeWidth,\n },\n canceledStrokeOptions: {\n lineColor: gestureFeedbackCanceledStrokeColor,\n },\n };\n\n // Create model and navigation observable.\n const model = createModel(items);\n const navigation$ = navigation(watchDrags(parentDOM), model, {\n minSelectionDist,\n minMenuSelectionDist,\n subMenuOpeningDelay,\n movementsThreshold,\n noviceDwellingTime,\n }).pipe(\n tap(({ originalEvent }) => {\n // Prevent default on every notifications.\n if (originalEvent) originalEvent.preventDefault();\n })\n );\n\n // Connect the engine's notifications to menu opening/closing.\n const connectedNavigation$ = connectLayout(\n parentDOM,\n navigation$,\n (parent, menuModel, center, current) =>\n createMenuLayout(parent, menuModel, center, current, menuLayoutOptions),\n (parent) => createStrokeCanvas(parent, strokeCanvasOptions),\n (parent) => createStrokeCanvas(parent, lowerStrokeCanvasOptions),\n (parent) => createGestureFeedback(parent, gestureFeedbackOptions),\n log\n );\n\n // If every steps should be notified, just export connectedNavigation$.\n if (notifySteps) {\n return connectedNavigation$.pipe(map(exportNotification), share());\n }\n // Else, return an observable on the selections.\n return connectedNavigation$.pipe(\n filter((notification) => notification.type === 'select'),\n pluck('selection'),\n share()\n );\n};\n"],"names":["mod","a","n","radiansToDegrees","radians","Math","PI","degreesToRadians","degrees","deltaAngle","alpha","beta","dist","point1","point2","sum","reduce","acc","x1i","i","x2i","sqrt","ANGLE_ROUNDING","angle","b","c","lab","lbc","lac","cos","adjustedCos","max","min","angleABC","acos","round","findMaxEntry","list","comp","slice","result","item","index","toPolar","px","py","cx","cy","x","y","azymuth","atan2","radius","createPEventFromTouchEvent","touchEvt","touchList","Array","from","targetTouches","sumX","t","clientX","sumY","clientY","meanX","length","meanY","originalEvent","position","timeStamp","createPEventFromMouseEvent","mouseEvt","mouseDrags","rootDOM","fromEvent","pipe","map","downEvt","drag$","merge","of","takeUntil","publishBehavior","connect","o","touchDrags","filter","evt","firstEvent","startWith","watchDrags","dragObsFactories","f","movementsThreshold","scan","cur","prev","type","pass","delay","scheduler","undefined","first","longMoves","debounceTime","last","withLatestFrom","_","last_","initStroke","typeOpts","notification","stroke","noviceMoves","menu","menuCenter","minSelectionDist","moves$","active","getNearestChild","center","performance","now","Date","share","end$","isLeaf","selection","menuSelection","move$","subMenuOpeningDelay","minMenuSelectionDist","dwellings","subMenuNavigation","menuSelection$","subNav","navOptions","noviceNavigation","noviceMoves_","menuSelection_","subMenuNavigation_","subMenuNavigation$","take","switchAll","findNextPointFurtherThan","pointList","minDist","direction","startIndex","refPoint","step","abs","findMiddlePointForMinAngle","pointA","pointC","endIndex","minAngle","Infinity","maxAngleIndex","thisAngle","getStrokeArticulationPoints","expectedSegmentLength","angleThreshold","w","articulationPoints","ai","ci","labi","lbci","bi","push","res","current","pointsToSegments","points","segments","walkMMModel","model","segmentAngle","divideLongestSegment","longestI","longest","s1","s2","findMMItem","maxDepth","getMaxDepth","currentSegments","currentItem","recognizeMMStroke","maxDepth_","requireMenu","requireLeaf","Error","maxMenuBreadth","getMaxBreadth","strokeLength","sensitivity","minSegmentSize","seg","parent","draw$","draw","e","recognize","confirmedNoviceNavigationHOO","start","options","noviceDwellingTime","mergeMap","start_","skip","mode","expertToNoviceSwitchHOO","isRoot","confirmedExpertNavigationHOO","expertToNoviceSwitchHOO_","expertNav$","expertNavigation","startup","navigationFromDrag","confirmedExpertNavigationHOO_","confirmedNoviceNavigationHOO_","startup_","startUp$","confirmedExpertNavigation$$","confirmedNoviceNavigation$$","confirmedNavigation$$","race","drags$","navigationFromDrag_","exhaustMap","template","doc","items","main","createElement","className","style","setProperty","elt","dataset","itemId","id","classList","add","radAngle","sin","innerHTML","name","appendChild","createMenu","document","children","clearActiveItems","querySelectorAll","forEach","itemDom","remove","getItemDom","querySelector","setActive","removeChild","lineWidth","lineColor","pointRadius","pointColor","ptSize","window","devicePixelRatio","width","height","getBoundingClientRect","canvas","Object","assign","left","top","ctx","getContext","scale","drawPoint","save","strokeStyle","fillStyle","beginPath","moveTo","arc","fill","restore","clear","clearRect","drawStroke","lineJoin","lineCap","point","lineTo","parentDOM","navigation$","createMenuLayout","createUpperStrokeCanvas","createLowerStrokeCanvas","createGestureFeedback","log","upperStrokeCanvas","lowerStrokeCanvas","lowerStroke","upperStroke","gestureFeedback","closeMenu","openMenu","cbr","startUpperStroke","noviceMove","rafThrottle","expertDraw","clearUpperStroke","swapUpperStroke","clearLowerStroke","showGestureFeedback","isCanceled","show","cleanUp","cursor","onNotification","tap","next","error","finalize","duration","strokeOptions","canceledStrokeOptions","strokeTimeoutEntries","createStrokeCanvas","timeoutEntry","timeout","setTimeout","clearTimeout","getAngleRange","MMItem","constructor","getChild","childId","find","child","getChildrenByName","childName","c1","c2","delta1","delta2","recursivelyCreateModelItems","baseId","angleRange","freeze","stdId","join","toString","mmItem","createModel","itemList","exportNotification","strokeColor","strokeWidth","strokeStartPointRadius","lowerStrokeColor","lowerStrokeWidth","lowerStrokeStartPointRadius","gestureFeedbackDuration","gestureFeedbackStrokeWidth","gestureFeedbackCanceledStrokeColor","gestureFeedbackStrokeColor","notifySteps","console","bind","info","warn","debug","menuLayoutOptions","strokeCanvasOptions","lowerStrokeCanvasOptions","gestureFeedbackOptions","navigation","preventDefault","connectedNavigation$","connectLayout","menuModel","pluck"],"mappings":";;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACO,MAAMA,GAAG,GAAG,C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AAF,KAAsB,GAAA,IAAA,CAAA;EACzB;EACA,IAAA,IAAIA,aAAJ,EAAmBA,aAAa,CAAC4T,cAAd,EAAA,CAAA;EACpB,GAHE,CAPe,CAApB,CA1BG;;EAwCH,EAAA,MAAMC,oBAAoB,GAAGC,aAAa,CACxCxF,SADwC,EAExCC,WAFwC,EAGxC,CAAClG,MAAD,EAAS0L,SAAT,EAAoB1Q,MAApB,EAA4BoD,OAA5B,KACE+H,UAAgB,CAACnG,MAAD,EAAS0L,SAAT,EAAoB1Q,MAApB,EAA4BoD,OAA5B,EAAqC8M,iBAArC,CAJsB,EAKvClL,MAAD,IAAYqI,kBAAkB,CAACrI,MAAD,EAASmL,mBAAT,CALU,EAMvCnL,MAAD,IAAYqI,kBAAkB,CAACrI,MAAD,EAASoL,wBAAT,CANU,EAOvCpL,MAAD,IAAYsG,qBAAqB,CAACtG,MAAD,EAASqL,sBAAT,CAPO,EAQxC9E,GARwC,CAA1C,CAxCG;;EAoDH,EAAA,IAAIqE,WAAJ,EAAiB;EACf,IAAOY,OAAAA,oBAAoB,CAACrT,IAArB,CAA0BC,aAAG,CAAC6R,kBAAD,CAA7B,EAAmD7O,eAAK,EAAxD,CAAP,CAAA;EACD,GAtDE;;;EAwDH,EAAOoQ,OAAAA,oBAAoB,CAACrT,IAArB,CACLW,gBAAM,CAAEyB,YAAD,IAAkBA,YAAY,CAACd,IAAb,KAAsB,QAAzC,CADD,EAELkS,eAAK,CAAC,WAAD,CAFA,EAGLvQ,eAAK,EAHA,CAAP,CAAA;EAKD,CA3FD;;;;;;;;"} \ No newline at end of file diff --git a/src/main.js b/src/main.js index a1a3062..34dd03a 100644 --- a/src/main.js +++ b/src/main.js @@ -66,7 +66,7 @@ export default ( { minSelectionDist = 40, minMenuSelectionDist = 80, - subMenuOpeningDelay = 25, + subMenuOpeningDelay = 100, movementsThreshold = 5, noviceDwellingTime = 1000 / 3, strokeColor = '#000',