Skip to content

Instantly share code, notes, and snippets.

@bhauman bhauman/arrows.js
Last active Feb 6, 2017

Embed
What would you like to do?
Google Closure Stacktrace on "use strict"
"use strict";
var position_1 = require("../../common/position");
// this value causes popover and target edges to line up on 50px targets
exports.MIN_ARROW_SPACING = 18;
function computeArrowOffset(sideLength, arrowSize, minimum) {
if (minimum === void 0) { minimum = exports.MIN_ARROW_SPACING; }
return Math.max(Math.round((sideLength - arrowSize) / 2), minimum);
}
exports.computeArrowOffset = computeArrowOffset;
function getPopoverTransformOrigin(position, arrowSize, targetDimensions) {
var offsetX = computeArrowOffset(targetDimensions.width, arrowSize);
var offsetY = computeArrowOffset(targetDimensions.height, arrowSize);
switch (position) {
case position_1.Position.TOP_LEFT:
return offsetX + "px bottom";
case position_1.Position.TOP_RIGHT:
return "calc(100% - " + offsetX + "px) bottom";
case position_1.Position.BOTTOM_LEFT:
return offsetX + "px top";
case position_1.Position.BOTTOM_RIGHT:
return "calc(100% - " + offsetX + "px) top";
case position_1.Position.LEFT_TOP:
return "right " + offsetY + "px";
case position_1.Position.LEFT_BOTTOM:
return "right calc(100% - " + offsetY + "px)";
case position_1.Position.RIGHT_TOP:
return "left " + offsetY + "px";
case position_1.Position.RIGHT_BOTTOM:
return "left calc(100% - " + offsetY + "px)";
default:
return undefined;
}
}
exports.getPopoverTransformOrigin = getPopoverTransformOrigin;
function getArrowPositionStyles(position, arrowSize, ignoreTargetDimensions, targetDimensions, inline) {
// compute the offset to center an arrow with given hypotenuse in a side of the given length
var popoverOffset = function (sideLength) {
var offset = computeArrowOffset(sideLength, arrowSize, 0);
return offset < exports.MIN_ARROW_SPACING ? exports.MIN_ARROW_SPACING - offset : 0;
};
var popoverOffsetX = popoverOffset(targetDimensions.width);
var popoverOffsetY = popoverOffset(targetDimensions.height);
// TOP, RIGHT, BOTTOM, LEFT are handled purely in CSS because of centering transforms
switch (position) {
case position_1.Position.TOP_LEFT:
case position_1.Position.BOTTOM_LEFT:
return {
arrow: ignoreTargetDimensions ? {} : { left: computeArrowOffset(targetDimensions.width, arrowSize) },
container: { marginLeft: -popoverOffsetX },
};
case position_1.Position.TOP_RIGHT:
case position_1.Position.BOTTOM_RIGHT:
return {
arrow: ignoreTargetDimensions ? {} : { right: computeArrowOffset(targetDimensions.width, arrowSize) },
container: { marginLeft: popoverOffsetX },
};
case position_1.Position.RIGHT_TOP:
case position_1.Position.LEFT_TOP:
return {
arrow: ignoreTargetDimensions ? {} : { top: computeArrowOffset(targetDimensions.height, arrowSize) },
container: inline ? { top: -popoverOffsetY } : { marginTop: -popoverOffsetY },
};
case position_1.Position.RIGHT_BOTTOM:
case position_1.Position.LEFT_BOTTOM:
return {
arrow: ignoreTargetDimensions ? {} : { bottom: computeArrowOffset(targetDimensions.height, arrowSize) },
container: inline ? { bottom: -popoverOffsetY } : { marginTop: popoverOffsetY },
};
default:
return {};
}
}
exports.getArrowPositionStyles = getArrowPositionStyles;
//# sourceMappingURL=arrows.js.map
java.lang.RuntimeException: INTERNAL COMPILER ERROR.
Please report this problem.
null
Node(SCRIPT): /Users/bhauman/workspace/temp/blueprint/node_modules/@blueprintjs/core/dist/components/popover/arrows.js:1:0
"use strict";
Parent: NULL
at com.google.javascript.jscomp.ProcessCommonJSModules$RewriteModule.visitExport(ProcessCommonJSModules.java:669)
at com.google.javascript.jscomp.ProcessCommonJSModules$RewriteModule.visit(ProcessCommonJSModules.java:549)
at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:642)
at com.google.javascript.jscomp.NodeTraversal.traverse(NodeTraversal.java:318)
at com.google.javascript.jscomp.NodeTraversal.traverseEs6(NodeTraversal.java:588)
at com.google.javascript.jscomp.ProcessCommonJSModules.process(ProcessCommonJSModules.java:122)
at com.google.javascript.jscomp.Compiler.processAMDAndCommonJSModules(Compiler.java:1789)
at com.google.javascript.jscomp.Compiler.parseInputs(Compiler.java:1497)
at com.google.javascript.jscomp.Compiler.parse(Compiler.java:795)
at cljs.closure$eval6330$fn__6331.invoke(closure.clj:1557)
at clojure.lang.MultiFn.invoke(MultiFn.java:238)
at cljs.closure$process_js_modules$fn__6523.invoke(closure.clj:1952)
at clojure.core$map$fn__6881.invoke(core.clj:2728)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.RT.seq(RT.java:525)
at clojure.core$seq__6422.invokeStatic(core.clj:137)
at clojure.core$apply.invokeStatic(core.clj:652)
at clojure.core$mapcat.invokeStatic(core.clj:2756)
at clojure.core$mapcat.doInvoke(core.clj:2756)
at clojure.lang.RestFn.invoke(RestFn.java:423)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.