MCPcopy Index your code
hub / github.com/microsoft/SandDance / extension

Function extension

docs/app/js/sanddance-app.js:141792–141823  ·  view source on GitHub ↗
(view, item1, point)

Source from the content-addressed store, hash-verified

141790 return event2;
141791}
141792function extension(view, item1, point) {
141793 const itemGroup = item1 ? item1.mark.marktype === "group" ? item1 : item1.mark.group : null;
141794 function group(name) {
141795 var g = itemGroup, i;
141796 if (name) {
141797 for(i = item1; i; i = i.mark.group)if (i.mark.name === name) {
141798 g = i;
141799 break;
141800 }
141801 }
141802 return g && g.mark && g.mark.interactive ? g : {};
141803 }
141804 function xy(item) {
141805 if (!item) return point;
141806 if ((0, _vegaUtil.isString)(item)) item = group(item);
141807 const p = point.slice();
141808 while(item){
141809 p[0] -= item.x || 0;
141810 p[1] -= item.y || 0;
141811 item = item.mark && item.mark.group;
141812 }
141813 return p;
141814 }
141815 return {
141816 view: (0, _vegaUtil.constant)(view),
141817 item: (0, _vegaUtil.constant)(item1 || {}),
141818 group: group,
141819 xy: xy,
141820 x: (item)=>xy(item)[0],
141821 y: (item)=>xy(item)[1]
141822 };
141823}
141824const VIEW = "view", TIMER = "timer", WINDOW = "window", NO_TRAP = {
141825 trap: false
141826};

Callers 1

eventExtendFunction · 0.70

Calls 1

xyFunction · 0.70

Tested by

no test coverage detected