scratch-paint 4.0.21 → 4.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/deploy.yml +3 -3
- package/.github/workflows/update-l10n.yml +2 -2
- package/.nvmrc +1 -1
- package/dist/scratch-paint.js +108 -122
- package/dist/scratch-paint.js.map +1 -1
- package/eslint.config.mjs +61 -0
- package/package.json +6 -8
- package/scripts/build-i18n-source.js +1 -1
- package/src/components/paint-editor/paint-editor.jsx +2 -2
- package/src/containers/mode-tools.jsx +3 -3
- package/src/helper/bit-tools/brush-tool.js +1 -1
- package/src/helper/bit-tools/fill-tool.js +1 -1
- package/src/helper/bit-tools/line-tool.js +3 -3
- package/src/helper/bit-tools/oval-tool.js +1 -1
- package/src/helper/bit-tools/rect-tool.js +1 -1
- package/src/helper/bit-tools/select-tool.js +2 -2
- package/src/helper/bitmap.js +13 -15
- package/src/helper/blob-tools/broad-brush-helper.js +1 -2
- package/src/helper/blob-tools/segment-brush-helper.js +4 -5
- package/src/helper/group.js +14 -16
- package/src/helper/hover.js +1 -1
- package/src/helper/layer.js +5 -5
- package/src/helper/math.js +1 -1
- package/src/helper/selection-tools/bounding-box-tool.js +5 -5
- package/src/helper/selection-tools/handle-tool.js +2 -2
- package/src/helper/selection-tools/move-tool.js +3 -3
- package/src/helper/selection-tools/nudge-tool.js +2 -2
- package/src/helper/selection-tools/point-tool.js +1 -1
- package/src/helper/selection-tools/reshape-tool.js +7 -7
- package/src/helper/selection-tools/rotate-tool.js +1 -1
- package/src/helper/selection-tools/scale-tool.js +3 -3
- package/src/helper/selection-tools/select-tool.js +3 -3
- package/src/helper/selection.js +19 -19
- package/src/helper/snapping.js +2 -2
- package/src/helper/style-path.js +8 -8
- package/src/helper/tools/fill-tool.js +1 -1
- package/src/helper/tools/oval-tool.js +1 -1
- package/src/helper/tools/rect-tool.js +1 -1
- package/src/helper/tools/rounded-rect-tool.js +2 -2
- package/src/helper/tools/text-tool.js +4 -4
- package/src/helper/view.js +9 -10
- package/src/playground/playground.jsx +28 -25
- package/src/playground/reducers/intl.js +1 -2
- package/src/reducers/cursor.js +1 -1
- package/src/reducers/hover.js +1 -1
- package/src/reducers/layout.js +1 -1
- package/src/reducers/selected-items.js +1 -1
- package/src/reducers/text-edit-target.js +1 -1
- package/src/reducers/undo.js +2 -2
- package/src/reducers/view-bounds.js +1 -1
- package/.eslintignore +0 -4
- package/.eslintrc.js +0 -3
- package/src/.eslintrc.js +0 -24
- package/tmp.js +0 -0
package/dist/scratch-paint.js
CHANGED
|
@@ -30102,10 +30102,10 @@ var group_isGroup = function isGroup(item) {
|
|
|
30102
30102
|
/**
|
|
30103
30103
|
* Groups the given items. Other things are then deselected and the new group is selected.
|
|
30104
30104
|
* @param {!Array<paper.Item>} items Root level items to group
|
|
30105
|
-
* @param {!
|
|
30106
|
-
* @param {!
|
|
30107
|
-
* @param {!
|
|
30108
|
-
* @
|
|
30105
|
+
* @param {!Function} clearSelectedItems Function to clear Redux state's selected items
|
|
30106
|
+
* @param {!Function} setSelectedItems Function to set Redux state with new list of selected items
|
|
30107
|
+
* @param {!Function} onUpdateImage Function to let listeners know that SVG has changed.
|
|
30108
|
+
* @returns {paper.Group} the group if one is created, otherwise false.
|
|
30109
30109
|
*/
|
|
30110
30110
|
var group_groupItems = function groupItems(items, clearSelectedItems, setSelectedItems, onUpdateImage) {
|
|
30111
30111
|
if (items.length > 0) {
|
|
@@ -30124,10 +30124,10 @@ var group_groupItems = function groupItems(items, clearSelectedItems, setSelecte
|
|
|
30124
30124
|
|
|
30125
30125
|
/**
|
|
30126
30126
|
* Groups the selected items. Other things are then deselected and the new group is selected.
|
|
30127
|
-
* @param {!
|
|
30128
|
-
* @param {!
|
|
30129
|
-
* @param {!
|
|
30130
|
-
* @
|
|
30127
|
+
* @param {!Function} clearSelectedItems Function to clear Redux state's selected items
|
|
30128
|
+
* @param {!Function} setSelectedItems Function to set Redux state with new list of selected items
|
|
30129
|
+
* @param {!Function} onUpdateImage Function to let listeners know that SVG has changed.
|
|
30130
|
+
* @returns {paper.Group} the group if one is created, otherwise false.
|
|
30131
30131
|
*/
|
|
30132
30132
|
var group_groupSelection = function groupSelection(clearSelectedItems, setSelectedItems, onUpdateImage) {
|
|
30133
30133
|
var items = selection_getSelectedRootItems();
|
|
@@ -30165,10 +30165,9 @@ var _ungroupLoop2 = function _ungroupLoop(group, recursive, setSelectedItems) {
|
|
|
30165
30165
|
* onUpdateImage is called to notify listeners of a change on the SVG only if onUpdateImage is passed in.
|
|
30166
30166
|
* The reason these arguments are optional on ungroupItems is because ungroupItems is used for parts of
|
|
30167
30167
|
* SVG import, which shouldn't change the selection or undo state.
|
|
30168
|
-
*
|
|
30169
30168
|
* @param {!Array<paper.Item>} items Items to ungroup if they are groups
|
|
30170
|
-
* @param {?
|
|
30171
|
-
* @param {?
|
|
30169
|
+
* @param {?Function} setSelectedItems Function to set Redux state with new list of selected items
|
|
30170
|
+
* @param {?Function} onUpdateImage Function to let listeners know that SVG has changed.
|
|
30172
30171
|
*/
|
|
30173
30172
|
var ungroupItems = function ungroupItems(items, setSelectedItems, onUpdateImage) {
|
|
30174
30173
|
if (items.length === 0) {
|
|
@@ -30201,10 +30200,9 @@ var ungroupItems = function ungroupItems(items, setSelectedItems, onUpdateImage)
|
|
|
30201
30200
|
|
|
30202
30201
|
/**
|
|
30203
30202
|
* Ungroups the selected items. Other items are deselected and the ungrouped items are selected.
|
|
30204
|
-
*
|
|
30205
|
-
* @param {!
|
|
30206
|
-
* @param {!
|
|
30207
|
-
* @param {!function} onUpdateImage Function to let listeners know that SVG has changed.
|
|
30203
|
+
* @param {!Function} clearSelectedItems Function to clear Redux state's selected items
|
|
30204
|
+
* @param {!Function} setSelectedItems Function to set Redux state with new list of selected items
|
|
30205
|
+
* @param {!Function} onUpdateImage Function to let listeners know that SVG has changed.
|
|
30208
30206
|
*/
|
|
30209
30207
|
var group_ungroupSelection = function ungroupSelection(clearSelectedItems, setSelectedItems, onUpdateImage) {
|
|
30210
30208
|
var items = selection_getSelectedRootItems();
|
|
@@ -30409,7 +30407,7 @@ var math_scaleWithStrokes = function scaleWithStrokes(root, factor, pivot) {
|
|
|
30409
30407
|
* for shapes like circles ("square ovals"), which fill the same dimensions.)
|
|
30410
30408
|
* @param {!paper.Point} startPos The point where the user started dragging
|
|
30411
30409
|
* @param {!paper.Point} eventPoint The point where the user has currently dragged to
|
|
30412
|
-
* @
|
|
30410
|
+
* @returns {object} Information about the size and position of how the square should be drawn
|
|
30413
30411
|
*/
|
|
30414
30412
|
var math_getSquareDimensions = function getSquareDimensions(startPos, eventPoint) {
|
|
30415
30413
|
// These variables are used for determining the relative quadrant that the shape will appear in.
|
|
@@ -30453,7 +30451,7 @@ function selection_toPrimitive(t, r) { if ("object" != selection_typeof(t) || !t
|
|
|
30453
30451
|
/**
|
|
30454
30452
|
* Wrapper for paper.project.getItems that excludes our helper items
|
|
30455
30453
|
* @param {?object} options See paper.js docs for paper.Item.getItems
|
|
30456
|
-
* @
|
|
30454
|
+
* @returns {Array<paper.Item>} items that match options
|
|
30457
30455
|
*/
|
|
30458
30456
|
var selection_getItems = function getItems(options) {
|
|
30459
30457
|
var newMatcher = function newMatcher(item) {
|
|
@@ -30468,7 +30466,7 @@ var selection_getItems = function getItems(options) {
|
|
|
30468
30466
|
/**
|
|
30469
30467
|
* @param {boolean} includeGuides True if guide layer items like the bounding box should
|
|
30470
30468
|
* be included in the returned items.
|
|
30471
|
-
* @
|
|
30469
|
+
* @returns {Array<paper.item>} all top-level (direct descendants of a paper.Layer) items
|
|
30472
30470
|
*/
|
|
30473
30471
|
var selection_getAllRootItems = function getAllRootItems(includeGuides) {
|
|
30474
30472
|
includeGuides = includeGuides || false;
|
|
@@ -30504,7 +30502,7 @@ var selection_getAllRootItems = function getAllRootItems(includeGuides) {
|
|
|
30504
30502
|
};
|
|
30505
30503
|
|
|
30506
30504
|
/**
|
|
30507
|
-
* @
|
|
30505
|
+
* @returns {Array<paper.item>} all top-level (direct descendants of a paper.Layer) items
|
|
30508
30506
|
* that aren't guide items or helper items.
|
|
30509
30507
|
*/
|
|
30510
30508
|
var getAllSelectableRootItems = function getAllSelectableRootItems() {
|
|
@@ -30578,7 +30576,7 @@ var _setItemSelection = function setItemSelection(item, state, fullySelected) {
|
|
|
30578
30576
|
}
|
|
30579
30577
|
};
|
|
30580
30578
|
|
|
30581
|
-
/** @
|
|
30579
|
+
/** @returns {boolean} true if anything was selected */
|
|
30582
30580
|
var selectAllItems = function selectAllItems() {
|
|
30583
30581
|
var items = getAllSelectableRootItems();
|
|
30584
30582
|
if (items.length === 0) return false;
|
|
@@ -30588,7 +30586,7 @@ var selectAllItems = function selectAllItems() {
|
|
|
30588
30586
|
return true;
|
|
30589
30587
|
};
|
|
30590
30588
|
|
|
30591
|
-
/** @
|
|
30589
|
+
/** @returns {boolean} true if anything was selected */
|
|
30592
30590
|
var selectAllSegments = function selectAllSegments() {
|
|
30593
30591
|
var items = getAllSelectableRootItems();
|
|
30594
30592
|
if (items.length === 0) return false;
|
|
@@ -30598,7 +30596,7 @@ var selectAllSegments = function selectAllSegments() {
|
|
|
30598
30596
|
return true;
|
|
30599
30597
|
};
|
|
30600
30598
|
|
|
30601
|
-
/** @param {!
|
|
30599
|
+
/** @param {!Function} dispatchClearSelect Function to update the Redux select state */
|
|
30602
30600
|
var selection_clearSelection = function clearSelection(dispatchClearSelect) {
|
|
30603
30601
|
paper_full_default.a.project.deselectAll();
|
|
30604
30602
|
dispatchClearSelect();
|
|
@@ -30608,7 +30606,7 @@ var selection_clearSelection = function clearSelection(dispatchClearSelect) {
|
|
|
30608
30606
|
* This gets all selected non-grouped items and groups
|
|
30609
30607
|
* (alternative to paper.project.selectedItems, which includes
|
|
30610
30608
|
* group children in addition to the group)
|
|
30611
|
-
* @
|
|
30609
|
+
* @returns {Array<paper.Item>} in increasing Z order.
|
|
30612
30610
|
*/
|
|
30613
30611
|
var selection_getSelectedRootItems = function getSelectedRootItems() {
|
|
30614
30612
|
var allItems = getAllSelectableRootItems();
|
|
@@ -30655,7 +30653,7 @@ var selection_getSelectedRootItems = function getSelectedRootItems() {
|
|
|
30655
30653
|
/**
|
|
30656
30654
|
* This gets all selected items that are as deeply nested as possible. Does not
|
|
30657
30655
|
* return the parent groups.
|
|
30658
|
-
* @
|
|
30656
|
+
* @returns {Array<paper.Item>} in increasing Z order.
|
|
30659
30657
|
*/
|
|
30660
30658
|
var selection_getSelectedLeafItems = function getSelectedLeafItems() {
|
|
30661
30659
|
var allItems = paper_full_default.a.project.selectedItems;
|
|
@@ -30672,7 +30670,7 @@ var selection_getSelectedLeafItems = function getSelectedLeafItems() {
|
|
|
30672
30670
|
|
|
30673
30671
|
/**
|
|
30674
30672
|
* This gets all selected path segments.
|
|
30675
|
-
* @
|
|
30673
|
+
* @returns {Array<paper.Segment>} selected segments
|
|
30676
30674
|
*/
|
|
30677
30675
|
var getSelectedSegments = function getSelectedSegments() {
|
|
30678
30676
|
var selected = selection_getSelectedLeafItems();
|
|
@@ -31100,7 +31098,7 @@ var forEachLinePoint = function forEachLinePoint(point1, point2, callback) {
|
|
|
31100
31098
|
* @param {!number} a Coefficient in ax^2 + bx + c = 0
|
|
31101
31099
|
* @param {!number} b Coefficient in ax^2 + bx + c = 0
|
|
31102
31100
|
* @param {!number} c Coefficient in ax^2 + bx + c = 0
|
|
31103
|
-
* @
|
|
31101
|
+
* @returns {Array<number>} Array of 2 solutions, with the larger solution first
|
|
31104
31102
|
*/
|
|
31105
31103
|
var solveQuadratic_ = function solveQuadratic_(a, b, c) {
|
|
31106
31104
|
var soln1 = (-b + Math.sqrt(b * b - 4 * a * c)) / 2 / a;
|
|
@@ -31116,10 +31114,10 @@ var solveQuadratic_ = function solveQuadratic_(a, b, c) {
|
|
|
31116
31114
|
* @param {!number} options.radiusY minor radius of ellipse
|
|
31117
31115
|
* @param {!number} options.shearSlope slope of the sheared x axis
|
|
31118
31116
|
* @param {?boolean} options.isFilled true if isFilled
|
|
31119
|
-
* @param {?
|
|
31117
|
+
* @param {?Function} options.drawFn The function called on each point in the outline, used only
|
|
31120
31118
|
* if isFilled is false.
|
|
31121
31119
|
* @param {!CanvasRenderingContext2D} context for drawing
|
|
31122
|
-
* @
|
|
31120
|
+
* @returns {boolean} true if anything was drawn, false if not
|
|
31123
31121
|
*/
|
|
31124
31122
|
var drawShearedEllipse_ = function drawShearedEllipse_(options, context) {
|
|
31125
31123
|
var centerX = ~~options.centerX;
|
|
@@ -31145,8 +31143,8 @@ var drawShearedEllipse_ = function drawShearedEllipse_(options, context) {
|
|
|
31145
31143
|
/**
|
|
31146
31144
|
* Vertical stepping portion of ellipse drawing algorithm
|
|
31147
31145
|
* @param {!number} startY y to start drawing from
|
|
31148
|
-
* @param {!
|
|
31149
|
-
* @
|
|
31146
|
+
* @param {!Function} conditionFn function which should become true when we should stop stepping
|
|
31147
|
+
* @returns {object} last point drawn to the canvas, or null if no points drawn
|
|
31150
31148
|
*/
|
|
31151
31149
|
var drawEllipseStepVertical_ = function drawEllipseStepVertical_(startY, conditionFn) {
|
|
31152
31150
|
// Points on the ellipse
|
|
@@ -31179,8 +31177,8 @@ var drawShearedEllipse_ = function drawShearedEllipse_(options, context) {
|
|
|
31179
31177
|
/**
|
|
31180
31178
|
* Horizontal stepping portion of ellipse drawing algorithm
|
|
31181
31179
|
* @param {!number} startX x to start drawing from
|
|
31182
|
-
* @param {!
|
|
31183
|
-
* @
|
|
31180
|
+
* @param {!Function} conditionFn function which should become false when we should stop stepping
|
|
31181
|
+
* @returns {object} last point drawn to the canvas, or null if no points drawn
|
|
31184
31182
|
*/
|
|
31185
31183
|
var drawEllipseStepHorizontal_ = function drawEllipseStepHorizontal_(startX, conditionFn) {
|
|
31186
31184
|
// Points on the ellipse
|
|
@@ -31257,7 +31255,7 @@ var drawShearedEllipse_ = function drawShearedEllipse_(options, context) {
|
|
|
31257
31255
|
* @param {!number} size The diameter of the brush
|
|
31258
31256
|
* @param {!string} color The css color of the brush
|
|
31259
31257
|
* @param {?boolean} isEraser True if we want the brush mark for the eraser
|
|
31260
|
-
* @
|
|
31258
|
+
* @returns {HTMLCanvasElement} a canvas with the brush mark printed on it
|
|
31261
31259
|
*/
|
|
31262
31260
|
var bitmap_getBrushMark = function getBrushMark(size, color, isEraser) {
|
|
31263
31261
|
size = ~~size;
|
|
@@ -31312,7 +31310,6 @@ var bitmap_getBrushMark = function getBrushMark(size, color, isEraser) {
|
|
|
31312
31310
|
* Draw an ellipse, given the original axis-aligned radii and
|
|
31313
31311
|
* an affine transformation. Returns false if the ellipse could
|
|
31314
31312
|
* not be drawn; for instance, the matrix is non-invertible.
|
|
31315
|
-
*
|
|
31316
31313
|
* @param {!options} options Parameters for the ellipse
|
|
31317
31314
|
* @param {!paper.Point} options.position Center of ellipse
|
|
31318
31315
|
* @param {!number} options.radiusX x-aligned radius of ellipse
|
|
@@ -31321,7 +31318,7 @@ var bitmap_getBrushMark = function getBrushMark(size, color, isEraser) {
|
|
|
31321
31318
|
* @param {?boolean} options.isFilled true if isFilled
|
|
31322
31319
|
* @param {?number} options.thickness Thickness of outline, used only if isFilled is false.
|
|
31323
31320
|
* @param {!CanvasRenderingContext2D} context for drawing
|
|
31324
|
-
* @
|
|
31321
|
+
* @returns {boolean} true if anything was drawn, false if not
|
|
31325
31322
|
*/
|
|
31326
31323
|
var bitmap_drawEllipse = function drawEllipse(options, context) {
|
|
31327
31324
|
var positionX = options.position.x;
|
|
@@ -31556,7 +31553,6 @@ var colorPixel_ = function colorPixel_(x, y, imageData, newColor) {
|
|
|
31556
31553
|
/**
|
|
31557
31554
|
* Flood fill beginning at the given point.
|
|
31558
31555
|
* Based on http://www.williammalone.com/articles/html5-canvas-javascript-paint-bucket-tool/
|
|
31559
|
-
*
|
|
31560
31556
|
* @param {!int} x The x coordinate on the context at which to begin
|
|
31561
31557
|
* @param {!int} y The y coordinate on the context at which to begin
|
|
31562
31558
|
* @param {!ImageData} sourceImageData The image data to sample from. This is edited by the function.
|
|
@@ -31603,7 +31599,7 @@ var floodFillInternal_ = function floodFillInternal_(x, y, sourceImageData, dest
|
|
|
31603
31599
|
/**
|
|
31604
31600
|
* Given a fill style string, get the color
|
|
31605
31601
|
* @param {string} fillStyleString the fill style
|
|
31606
|
-
* @
|
|
31602
|
+
* @returns {Array<int>} Color, a length 4 array
|
|
31607
31603
|
*/
|
|
31608
31604
|
var fillStyleToColor_ = function fillStyleToColor_(fillStyleString) {
|
|
31609
31605
|
var tmpCanvas = document.createElement('canvas');
|
|
@@ -31623,7 +31619,7 @@ var fillStyleToColor_ = function fillStyleToColor_(fillStyleString) {
|
|
|
31623
31619
|
* @param {!HTMLCanvas2DContext} sourceContext The context from which to sample to determine where to flood fill
|
|
31624
31620
|
* @param {!HTMLCanvas2DContext} destContext The context to which to draw. May match sourceContext. Should match
|
|
31625
31621
|
* the size of sourceContext.
|
|
31626
|
-
* @
|
|
31622
|
+
* @returns {boolean} True if image changed, false otherwise
|
|
31627
31623
|
*/
|
|
31628
31624
|
var floodFill = function floodFill(x, y, color, sourceContext, destContext) {
|
|
31629
31625
|
x = ~~x;
|
|
@@ -31655,7 +31651,7 @@ var floodFill = function floodFill(x, y, color, sourceContext, destContext) {
|
|
|
31655
31651
|
* @param {!string} color A color string, which would go into context.fillStyle
|
|
31656
31652
|
* @param {!HTMLCanvas2DContext} sourceContext The context from which to sample to determine where to flood fill
|
|
31657
31653
|
* @param {!HTMLCanvas2DContext} destContext The context to which to draw. May match sourceContext. Should match
|
|
31658
|
-
* @
|
|
31654
|
+
* @returns {boolean} True if image changed, false otherwise
|
|
31659
31655
|
*/
|
|
31660
31656
|
var floodFillAll = function floodFillAll(x, y, color, sourceContext, destContext) {
|
|
31661
31657
|
x = ~~x;
|
|
@@ -31905,7 +31901,7 @@ var _paperColorToCanvasStyle = function _paperColorToCanvasStyle(color, context)
|
|
|
31905
31901
|
/**
|
|
31906
31902
|
* @param {paper.Shape.Ellipse} oval Vector oval to convert
|
|
31907
31903
|
* @param {paper.Raster} bitmap raster to draw selection
|
|
31908
|
-
* @
|
|
31904
|
+
* @returns {bool} true if the oval was drawn
|
|
31909
31905
|
*/
|
|
31910
31906
|
var bitmap_commitOvalToBitmap = function commitOvalToBitmap(oval, bitmap) {
|
|
31911
31907
|
var radiusX = Math.abs(oval.size.width / 2);
|
|
@@ -31992,16 +31988,15 @@ var getWorkspaceBounds = function getWorkspaceBounds() {
|
|
|
31992
31988
|
};
|
|
31993
31989
|
|
|
31994
31990
|
/**
|
|
31995
|
-
* The workspace bounds define the areas that the scroll bars can access.
|
|
31996
|
-
* They include at minimum the artboard, and extend to a bit beyond the
|
|
31997
|
-
* farthest item off
|
|
31998
|
-
* "lost" off the edge)
|
|
31999
|
-
*
|
|
32000
|
-
*
|
|
32001
|
-
*
|
|
32002
|
-
*
|
|
32003
|
-
|
|
32004
|
-
*/
|
|
31991
|
+
* The workspace bounds define the areas that the scroll bars can access.
|
|
31992
|
+
* They include at minimum the artboard, and extend to a bit beyond the
|
|
31993
|
+
* farthest item off the edge in any given direction (so items can't be
|
|
31994
|
+
* "lost" off the edge)
|
|
31995
|
+
* @param {boolean} clipEmpty Clip empty space from bounds, even if it
|
|
31996
|
+
* means discontinuously jumping the viewport. This should probably be
|
|
31997
|
+
* false unless the viewport is going to move discontinuously anyway
|
|
31998
|
+
* (such as in a zoom button click)
|
|
31999
|
+
*/
|
|
32005
32000
|
var view_setWorkspaceBounds = function setWorkspaceBounds(clipEmpty) {
|
|
32006
32001
|
var items = selection_getAllRootItems();
|
|
32007
32002
|
// Include the artboard and what's visible in the viewport
|
|
@@ -32216,7 +32211,7 @@ var _getPaintingLayer = function _getPaintingLayer() {
|
|
|
32216
32211
|
* Creates a canvas with width and height matching the art board size.
|
|
32217
32212
|
* @param {?number} width Width of the canvas. Defaults to ART_BOARD_WIDTH.
|
|
32218
32213
|
* @param {?number} height Height of the canvas. Defaults to ART_BOARD_HEIGHT.
|
|
32219
|
-
* @
|
|
32214
|
+
* @returns {HTMLCanvasElement} the canvas
|
|
32220
32215
|
*/
|
|
32221
32216
|
var layer_createCanvas = function createCanvas(width, height) {
|
|
32222
32217
|
var canvas = document.createElement('canvas');
|
|
@@ -32284,7 +32279,7 @@ var _setGuideItem = function setGuideItem(item) {
|
|
|
32284
32279
|
/**
|
|
32285
32280
|
* Removes the guide layers, e.g. for purposes of exporting the image. Must call showGuideLayers to re-add them.
|
|
32286
32281
|
* @param {boolean} includeRaster true if the raster layer should also be hidden
|
|
32287
|
-
* @
|
|
32282
|
+
* @returns {object} an object of the removed layers, which should be passed to showGuideLayers to re-add them.
|
|
32288
32283
|
*/
|
|
32289
32284
|
var hideGuideLayers = function hideGuideLayers(includeRaster) {
|
|
32290
32285
|
var backgroundGuideLayer = getBackgroundGuideLayer();
|
|
@@ -32654,7 +32649,7 @@ var undo_undoSnapshot = function undoSnapshot(snapshot) {
|
|
|
32654
32649
|
};
|
|
32655
32650
|
/**
|
|
32656
32651
|
* @param {Format} format Either VECTOR_SKIP_CONVERT or BITMAP_SKIP_CONVERT
|
|
32657
|
-
* @
|
|
32652
|
+
* @returns {Action} undo action
|
|
32658
32653
|
*/
|
|
32659
32654
|
var undo = function undo(format) {
|
|
32660
32655
|
return {
|
|
@@ -32664,7 +32659,7 @@ var undo = function undo(format) {
|
|
|
32664
32659
|
};
|
|
32665
32660
|
/**
|
|
32666
32661
|
* @param {Format} format Either VECTOR_SKIP_CONVERT or BITMAP_SKIP_CONVERT
|
|
32667
|
-
* @
|
|
32662
|
+
* @returns {Action} undo action
|
|
32668
32663
|
*/
|
|
32669
32664
|
var redo = function redo(format) {
|
|
32670
32665
|
return {
|
|
@@ -32713,7 +32708,7 @@ var selected_items_reducer = function reducer(state, action) {
|
|
|
32713
32708
|
* Set the selected item state to the given array of items
|
|
32714
32709
|
* @param {Array<paper.Item>} selectedItems from paper.project.selectedItems
|
|
32715
32710
|
* @param {?boolean} bitmapMode True if the items are being selected in bitmap mode
|
|
32716
|
-
* @
|
|
32711
|
+
* @returns {object} Redux action to change the selected items.
|
|
32717
32712
|
*/
|
|
32718
32713
|
var selected_items_setSelectedItems = function setSelectedItems(selectedItems, bitmapMode) {
|
|
32719
32714
|
return {
|
|
@@ -32759,7 +32754,7 @@ var hover_reducer = function reducer(state, action) {
|
|
|
32759
32754
|
/**
|
|
32760
32755
|
* Set the hovered item state to the given item ID
|
|
32761
32756
|
* @param {number} hoveredItemId The paper.Item ID of the hover indicator item.
|
|
32762
|
-
* @
|
|
32757
|
+
* @returns {object} Redux action to change the hovered item.
|
|
32763
32758
|
*/
|
|
32764
32759
|
var hover_setHoveredItem = function setHoveredItem(hoveredItemId) {
|
|
32765
32760
|
return {
|
|
@@ -32885,7 +32880,7 @@ var view_bounds_reducer = function reducer(state, action) {
|
|
|
32885
32880
|
/**
|
|
32886
32881
|
* Set the view bounds, which defines the zoom and scroll of the paper canvas.
|
|
32887
32882
|
* @param {paper.Matrix} matrix The matrix applied to the view
|
|
32888
|
-
* @
|
|
32883
|
+
* @returns {object} Redux action to set the view bounds
|
|
32889
32884
|
*/
|
|
32890
32885
|
var view_bounds_updateViewBounds = function updateViewBounds(matrix) {
|
|
32891
32886
|
return {
|
|
@@ -33879,7 +33874,7 @@ var style_path_getColorStateListeners = function _getColorStateListeners(textEdi
|
|
|
33879
33874
|
* in order to form a smooth gradient, otherwise it fades through black. This
|
|
33880
33875
|
* function gets the transparent color for a given color string.
|
|
33881
33876
|
* @param {?string} colorToMatch CSS string of other color of gradient, or null for transparent
|
|
33882
|
-
* @
|
|
33877
|
+
* @returns {string} CSS string for matching color of transparent
|
|
33883
33878
|
*/
|
|
33884
33879
|
var style_path_getColorStringForTransparent = function getColorStringForTransparent(colorToMatch) {
|
|
33885
33880
|
var color = new paper_full_default.a.Color(colorToMatch);
|
|
@@ -33890,7 +33885,7 @@ var style_path_getColorStringForTransparent = function getColorStringForTranspar
|
|
|
33890
33885
|
/**
|
|
33891
33886
|
* Generate a color that contrasts well with the passed-in color.
|
|
33892
33887
|
* @param {string} firstColor The "primary" color
|
|
33893
|
-
* @
|
|
33888
|
+
* @returns {string} CSS string for generated color
|
|
33894
33889
|
*/
|
|
33895
33890
|
var style_path_generateSecondaryColor = function generateSecondaryColor(firstColor) {
|
|
33896
33891
|
if (firstColor === MIXED) return null;
|
|
@@ -33924,7 +33919,7 @@ var style_path_generateSecondaryColor = function generateSecondaryColor(firstCol
|
|
|
33924
33919
|
* @param {?paper.Point} [radialCenter] Where the center of a radial gradient should be, if the gradient is radial.
|
|
33925
33920
|
* Defaults to center of bounds.
|
|
33926
33921
|
* @param {number} [minSize] The minimum width/height of the gradient object.
|
|
33927
|
-
* @
|
|
33922
|
+
* @returns {paper.Color} Color object with gradient, may be null or color string if the gradient type is solid
|
|
33928
33923
|
*/
|
|
33929
33924
|
var style_path_createGradientObject = function createGradientObject(color1, color2, gradientType, bounds, radialCenter, minSize) {
|
|
33930
33925
|
if (gradientType === gradient_types.SOLID) return color1;
|
|
@@ -33994,7 +33989,7 @@ var style_path_createGradientObject = function createGradientObject(color1, colo
|
|
|
33994
33989
|
* When changing the color in this case, the solid gradient should override the existing gradient on the item.
|
|
33995
33990
|
* @param {?boolean} applyToStroke True if changing the selection's stroke, false if changing its fill.
|
|
33996
33991
|
* @param {?string} textEditTargetId paper.Item.id of text editing target, if any
|
|
33997
|
-
* @
|
|
33992
|
+
* @returns {boolean} Whether the color application actually changed visibly.
|
|
33998
33993
|
*/
|
|
33999
33994
|
var style_path_applyColorToSelection = function applyColorToSelection(colorString, colorIndex, isSolidGradient, applyToStroke, textEditTargetId) {
|
|
34000
33995
|
var items = style_path_getColorStateListeners(textEditTargetId);
|
|
@@ -34054,7 +34049,7 @@ var style_path_applyColorToSelection = function applyColorToSelection(colorStrin
|
|
|
34054
34049
|
* Called to swap gradient colors
|
|
34055
34050
|
* @param {?boolean} applyToStroke True if changing the selection's stroke, false if changing its fill.
|
|
34056
34051
|
* @param {?string} textEditTargetId paper.Item.id of text editing target, if any
|
|
34057
|
-
* @
|
|
34052
|
+
* @returns {boolean} Whether the color application actually changed visibly.
|
|
34058
34053
|
*/
|
|
34059
34054
|
var style_path_swapColorsInSelection = function swapColorsInSelection(applyToStroke, textEditTargetId) {
|
|
34060
34055
|
var items = style_path_getColorStateListeners(textEditTargetId);
|
|
@@ -34096,7 +34091,7 @@ var style_path_swapColorsInSelection = function swapColorsInSelection(applyToStr
|
|
|
34096
34091
|
* @param {GradientType} gradientType gradient type
|
|
34097
34092
|
* @param {?boolean} applyToStroke True if changing the selection's stroke, false if changing its fill.
|
|
34098
34093
|
* @param {?string} textEditTargetId paper.Item.id of text editing target, if any
|
|
34099
|
-
* @
|
|
34094
|
+
* @returns {boolean} Whether the color application actually changed visibly.
|
|
34100
34095
|
*/
|
|
34101
34096
|
var style_path_applyGradientTypeToSelection = function applyGradientTypeToSelection(gradientType, applyToStroke, textEditTargetId) {
|
|
34102
34097
|
var items = style_path_getColorStateListeners(textEditTargetId);
|
|
@@ -34210,7 +34205,7 @@ var style_path_applyGradientTypeToSelection = function applyGradientTypeToSelect
|
|
|
34210
34205
|
* Called when setting stroke width
|
|
34211
34206
|
* @param {number} value New stroke width
|
|
34212
34207
|
* @param {?string} textEditTargetId paper.Item.id of text editing target, if any
|
|
34213
|
-
* @
|
|
34208
|
+
* @returns {boolean} Whether the color application actually changed visibly.
|
|
34214
34209
|
*/
|
|
34215
34210
|
var style_path_applyStrokeWidthToSelection = function applyStrokeWidthToSelection(value, textEditTargetId) {
|
|
34216
34211
|
var changed = false;
|
|
@@ -34262,7 +34257,7 @@ var style_path_colorStateFromGradient = function _colorStateFromGradient(gradien
|
|
|
34262
34257
|
* Get state of colors and stroke width for selection
|
|
34263
34258
|
* @param {!Array<paper.Item>} selectedItems Selected paper items
|
|
34264
34259
|
* @param {?boolean} bitmapMode True if the item is being selected in bitmap mode
|
|
34265
|
-
* @
|
|
34260
|
+
* @returns {?object} Object of strokeColor, strokeWidth, fillColor, thickness of the selection.
|
|
34266
34261
|
* Gives MIXED when there are mixed values for a color, and null for transparent.
|
|
34267
34262
|
* Gives null when there are mixed values for stroke width.
|
|
34268
34263
|
* Thickness is line thickness, used in the bitmap editor
|
|
@@ -34693,7 +34688,7 @@ function brush_tool_setPrototypeOf(t, e) { return brush_tool_setPrototypeOf = Ob
|
|
|
34693
34688
|
*/
|
|
34694
34689
|
var brush_tool_BrushTool = /*#__PURE__*/function (_paper$Tool) {
|
|
34695
34690
|
/**
|
|
34696
|
-
* @param {!
|
|
34691
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
34697
34692
|
* @param {boolean} isEraser True if brush should erase
|
|
34698
34693
|
*/
|
|
34699
34694
|
function BrushTool(onUpdateImage, isEraser) {
|
|
@@ -35001,7 +34996,7 @@ function line_tool_setPrototypeOf(t, e) { return line_tool_setPrototypeOf = Obje
|
|
|
35001
34996
|
*/
|
|
35002
34997
|
var line_tool_LineTool = /*#__PURE__*/function (_paper$Tool) {
|
|
35003
34998
|
/**
|
|
35004
|
-
* @param {!
|
|
34999
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
35005
35000
|
*/
|
|
35006
35001
|
function LineTool(onUpdateImage) {
|
|
35007
35002
|
var _this;
|
|
@@ -35354,7 +35349,7 @@ var cursor_reducer = function reducer(state, action) {
|
|
|
35354
35349
|
/**
|
|
35355
35350
|
* Set the mouse cursor state to the given string
|
|
35356
35351
|
* @param {string} cursorString The CSS cursor string.
|
|
35357
|
-
* @
|
|
35352
|
+
* @returns {object} Redux action to change the cursor.
|
|
35358
35353
|
*/
|
|
35359
35354
|
var cursor_setCursor = function setCursor(cursorString) {
|
|
35360
35355
|
return {
|
|
@@ -35386,7 +35381,7 @@ var MIN_SCALE_FACTOR = 0.0001;
|
|
|
35386
35381
|
var scale_tool_ScaleTool = /*#__PURE__*/function () {
|
|
35387
35382
|
/**
|
|
35388
35383
|
* @param {Mode} mode Paint editor mode
|
|
35389
|
-
* @param {!
|
|
35384
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
35390
35385
|
*/
|
|
35391
35386
|
function ScaleTool(mode, onUpdateImage) {
|
|
35392
35387
|
scale_tool_classCallCheck(this, ScaleTool);
|
|
@@ -35630,7 +35625,7 @@ function rotate_tool_toPrimitive(t, r) { if ("object" != rotate_tool_typeof(t) |
|
|
|
35630
35625
|
*/
|
|
35631
35626
|
var rotate_tool_RotateTool = /*#__PURE__*/function () {
|
|
35632
35627
|
/**
|
|
35633
|
-
* @param {!
|
|
35628
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
35634
35629
|
*/
|
|
35635
35630
|
function RotateTool(onUpdateImage) {
|
|
35636
35631
|
rotate_tool_classCallCheck(this, RotateTool);
|
|
@@ -35723,8 +35718,8 @@ var move_tool_MoveTool = /*#__PURE__*/function () {
|
|
|
35723
35718
|
* @param {Modes} mode Paint editor mode
|
|
35724
35719
|
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
|
|
35725
35720
|
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
|
|
35726
|
-
* @param {!
|
|
35727
|
-
* @param {?
|
|
35721
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
35722
|
+
* @param {?Function} switchToTextTool A callback to call to switch to the text tool
|
|
35728
35723
|
*/
|
|
35729
35724
|
function MoveTool(mode, setSelectedItems, clearSelectedItems, onUpdateImage, switchToTextTool) {
|
|
35730
35725
|
move_tool_classCallCheck(this, MoveTool);
|
|
@@ -35744,7 +35739,7 @@ var move_tool_MoveTool = /*#__PURE__*/function () {
|
|
|
35744
35739
|
* @param {!paper.HitResult} hitProperties.hitResult Data about the location of the mouse click
|
|
35745
35740
|
* @param {?boolean} hitProperties.clone Whether to clone on mouse down (e.g. alt key held)
|
|
35746
35741
|
* @param {?boolean} hitProperties.multiselect Whether to multiselect on mouse down (e.g. shift key held)
|
|
35747
|
-
* @param {?boolean} hitProperties.doubleClicked True if this is the second click in a short
|
|
35742
|
+
* @param {?boolean} hitProperties.doubleClicked True if this is the second click in a short amount of time
|
|
35748
35743
|
* @param {?boolean} hitProperties.subselect True if we allow selection of subgroups, false if we should
|
|
35749
35744
|
* select the whole group.
|
|
35750
35745
|
*/
|
|
@@ -35976,7 +35971,7 @@ var BoundingBoxModes = keymirror_default()({
|
|
|
35976
35971
|
* On mouse down, the type of function (move, scale, rotate) is determined based on what is clicked
|
|
35977
35972
|
* (scale handle, rotate handle, the object itself). This determines the mode of the tool, which then
|
|
35978
35973
|
* delegates actions to the MoveTool, RotateTool or ScaleTool accordingly.
|
|
35979
|
-
* @param {!
|
|
35974
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
35980
35975
|
*/
|
|
35981
35976
|
var bounding_box_tool_BoundingBoxTool = /*#__PURE__*/function () {
|
|
35982
35977
|
/**
|
|
@@ -35984,8 +35979,8 @@ var bounding_box_tool_BoundingBoxTool = /*#__PURE__*/function () {
|
|
|
35984
35979
|
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
|
|
35985
35980
|
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
|
|
35986
35981
|
* @param {function} setCursor Callback to set the visible mouse cursor
|
|
35987
|
-
* @param {!
|
|
35988
|
-
* @param {?
|
|
35982
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
35983
|
+
* @param {?Function} switchToTextTool A callback to call to switch to the text tool
|
|
35989
35984
|
*/
|
|
35990
35985
|
function BoundingBoxTool(mode, setSelectedItems, clearSelectedItems, setCursor, onUpdateImage, switchToTextTool) {
|
|
35991
35986
|
bounding_box_tool_classCallCheck(this, BoundingBoxTool);
|
|
@@ -36020,10 +36015,10 @@ var bounding_box_tool_BoundingBoxTool = /*#__PURE__*/function () {
|
|
|
36020
36015
|
* @param {!MouseEvent} event The mouse event
|
|
36021
36016
|
* @param {boolean} clone Whether to clone on mouse down (e.g. alt key held)
|
|
36022
36017
|
* @param {boolean} multiselect Whether to multiselect on mouse down (e.g. shift key held)
|
|
36023
|
-
* @param {?boolean} doubleClicked True if this is the second click in a short
|
|
36018
|
+
* @param {?boolean} doubleClicked True if this is the second click in a short amount of time
|
|
36024
36019
|
* @param {paper.hitOptions} hitOptions The options with which to detect whether mouse down has hit
|
|
36025
36020
|
* anything editable
|
|
36026
|
-
* @
|
|
36021
|
+
* @returns {boolean} True if there was a hit, false otherwise
|
|
36027
36022
|
*/
|
|
36028
36023
|
}, {
|
|
36029
36024
|
key: "onMouseDown",
|
|
@@ -36337,7 +36332,7 @@ var nudge_tool_NudgeTool = /*#__PURE__*/function () {
|
|
|
36337
36332
|
/**
|
|
36338
36333
|
* @param {Mode} mode Paint editor mode
|
|
36339
36334
|
* @param {function} boundingBoxTool to control the bounding box
|
|
36340
|
-
* @param {!
|
|
36335
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
36341
36336
|
*/
|
|
36342
36337
|
function NudgeTool(mode, boundingBoxTool, onUpdateImage) {
|
|
36343
36338
|
nudge_tool_classCallCheck(this, NudgeTool);
|
|
@@ -36451,7 +36446,7 @@ var oval_tool_OvalTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
36451
36446
|
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
|
|
36452
36447
|
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
|
|
36453
36448
|
* @param {function} setCursor Callback to set the visible mouse cursor
|
|
36454
|
-
* @param {!
|
|
36449
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
36455
36450
|
*/
|
|
36456
36451
|
function OvalTool(setSelectedItems, clearSelectedItems, setCursor, onUpdateImage) {
|
|
36457
36452
|
var _this;
|
|
@@ -36867,7 +36862,7 @@ var rect_tool_RectTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
36867
36862
|
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
|
|
36868
36863
|
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
|
|
36869
36864
|
* @param {function} setCursor Callback to set the visible mouse cursor
|
|
36870
|
-
* @param {!
|
|
36865
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
36871
36866
|
*/
|
|
36872
36867
|
function RectTool(setSelectedItems, clearSelectedItems, setCursor, onUpdateImage) {
|
|
36873
36868
|
var _this;
|
|
@@ -37324,7 +37319,7 @@ var TRANSPARENT = 'rgba(0,0,0,0)';
|
|
|
37324
37319
|
*/
|
|
37325
37320
|
var fill_tool_FillTool = /*#__PURE__*/function (_paper$Tool) {
|
|
37326
37321
|
/**
|
|
37327
|
-
* @param {!
|
|
37322
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
37328
37323
|
*/
|
|
37329
37324
|
function FillTool(onUpdateImage) {
|
|
37330
37325
|
var _this;
|
|
@@ -37867,7 +37862,7 @@ var select_tool_SelectTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
37867
37862
|
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
|
|
37868
37863
|
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
|
|
37869
37864
|
* @param {function} setCursor Callback to set the visible mouse cursor
|
|
37870
|
-
* @param {!
|
|
37865
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
37871
37866
|
*/
|
|
37872
37867
|
function SelectTool(setSelectedItems, clearSelectedItems, setCursor, onUpdateImage) {
|
|
37873
37868
|
var _this;
|
|
@@ -37912,7 +37907,7 @@ var select_tool_SelectTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
37912
37907
|
}
|
|
37913
37908
|
/**
|
|
37914
37909
|
* Returns the hit options to use when conducting hit tests.
|
|
37915
|
-
* @
|
|
37910
|
+
* @returns {object} See paper.Item.hitTest for definition of options
|
|
37916
37911
|
*/
|
|
37917
37912
|
}, {
|
|
37918
37913
|
key: "getHitOptions",
|
|
@@ -38196,7 +38191,6 @@ function broad_brush_helper_toPrimitive(t, r) { if ("object" != broad_brush_help
|
|
|
38196
38191
|
* Broad brush draws strokes by drawing points equidistant from the mouse event, perpendicular to the
|
|
38197
38192
|
* direction of motion. Shortcomings are that this path can cross itself, and 180 degree turns result
|
|
38198
38193
|
* in a flat edge.
|
|
38199
|
-
*
|
|
38200
38194
|
* @param {!Tool} tool paper.js mouse object
|
|
38201
38195
|
*/
|
|
38202
38196
|
var broad_brush_helper_BroadBrushHelper = /*#__PURE__*/function () {
|
|
@@ -38354,7 +38348,7 @@ var broad_brush_helper_BroadBrushHelper = /*#__PURE__*/function () {
|
|
|
38354
38348
|
* Like paper.Path.unite, but it removes the original 2 paths
|
|
38355
38349
|
* @param {paper.Path} path1 to merge
|
|
38356
38350
|
* @param {paper.Path} path2 to merge
|
|
38357
|
-
* @
|
|
38351
|
+
* @returns {paper.Path} merged path. Original paths 1 and 2 will be removed from the view.
|
|
38358
38352
|
*/
|
|
38359
38353
|
}, {
|
|
38360
38354
|
key: "union",
|
|
@@ -38458,7 +38452,6 @@ function segment_brush_helper_toPrimitive(t, r) { if ("object" != segment_brush_
|
|
|
38458
38452
|
* worse, especially as the number of segments to join increase, and that there are problems in paper.js
|
|
38459
38453
|
* with union on shapes with curves, so that chunks of the union tend to disappear.
|
|
38460
38454
|
* (https://github.com/paperjs/paper.js/issues/1321)
|
|
38461
|
-
*
|
|
38462
38455
|
* @param {!Tool} tool paper.js mouse object
|
|
38463
38456
|
*/
|
|
38464
38457
|
var segment_brush_helper_SegmentBrushHelper = /*#__PURE__*/function () {
|
|
@@ -40575,7 +40568,7 @@ function hover_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.le
|
|
|
40575
40568
|
* @param {?object} hitOptions hit options to use
|
|
40576
40569
|
* @param {?boolean} subselect Whether items within groups can be hovered. If false, the
|
|
40577
40570
|
* entire group should be hovered.
|
|
40578
|
-
* @
|
|
40571
|
+
* @returns {paper.Item} the hovered item or null if there is none
|
|
40579
40572
|
*/
|
|
40580
40573
|
var hover_getHoveredItem = function getHoveredItem(event, hitOptions, subselect) {
|
|
40581
40574
|
var oldMatch = hitOptions.match;
|
|
@@ -40644,7 +40637,7 @@ var tools_fill_tool_FillTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
40644
40637
|
/**
|
|
40645
40638
|
* @param {function} setHoveredItem Callback to set the hovered item
|
|
40646
40639
|
* @param {function} clearHoveredItem Callback to clear the hovered item
|
|
40647
|
-
* @param {!
|
|
40640
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
40648
40641
|
*/
|
|
40649
40642
|
function FillTool(setHoveredItem, clearHoveredItem, onUpdateImage) {
|
|
40650
40643
|
var _this;
|
|
@@ -41115,7 +41108,7 @@ var fill_mode_mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
41115
41108
|
* @param {paper.Point} point1 point 1
|
|
41116
41109
|
* @param {paper.Point} point2 point 2
|
|
41117
41110
|
* @param {number} tolerance Distance allowed between points that are "touching"
|
|
41118
|
-
* @
|
|
41111
|
+
* @returns {boolean} true if points are within the tolerance distance.
|
|
41119
41112
|
*/
|
|
41120
41113
|
var snapping_touching = function touching(point1, point2, tolerance) {
|
|
41121
41114
|
return point1.getDistance(point2, true) < Math.pow(tolerance / paper_full_default.a.view.zoom, 2);
|
|
@@ -41126,7 +41119,7 @@ var snapping_touching = function touching(point1, point2, tolerance) {
|
|
|
41126
41119
|
* @param {!number} tolerance Distance within which it counts as a hit
|
|
41127
41120
|
* @param {?paper.Path} excludePath Path to exclude from hit test, if any. For instance, you
|
|
41128
41121
|
* are drawing a line and don't want it to snap to its own start point.
|
|
41129
|
-
* @
|
|
41122
|
+
* @returns {object} data about the end point of an unclosed path, if any such point is within the
|
|
41130
41123
|
* tolerance distance of the given point, or null if none exists.
|
|
41131
41124
|
*/
|
|
41132
41125
|
var snapping_endPointHit = function endPointHit(point, tolerance, excludePath) {
|
|
@@ -42478,7 +42471,7 @@ var text_edit_target_reducer = function reducer(state, action) {
|
|
|
42478
42471
|
* Set the currently-being-edited text field to the given item ID
|
|
42479
42472
|
* @param {?number} textEditTargetId The paper.Item ID of the active text field.
|
|
42480
42473
|
* Leave empty if there is no text editing target.
|
|
42481
|
-
* @
|
|
42474
|
+
* @returns {object} Redux action to change the text edit target.
|
|
42482
42475
|
*/
|
|
42483
42476
|
var text_edit_target_setTextEditTarget = function setTextEditTarget(textEditTargetId) {
|
|
42484
42477
|
return {
|
|
@@ -42514,7 +42507,7 @@ var layout_reducer = function reducer(state, action) {
|
|
|
42514
42507
|
/**
|
|
42515
42508
|
* Change the layout to the new layout
|
|
42516
42509
|
* @param {string} layout either 'ltr' or 'rtl'
|
|
42517
|
-
* @
|
|
42510
|
+
* @returns {object} Redux action to change the selected items.
|
|
42518
42511
|
*/
|
|
42519
42512
|
var layout_setLayout = function setLayout(layout) {
|
|
42520
42513
|
return {
|
|
@@ -43919,14 +43912,14 @@ var mode_tools_ModeTools = /*#__PURE__*/function (_React$Component) {
|
|
|
43919
43912
|
// Point is end point
|
|
43920
43913
|
// Direction is average of normal at the point and direction to prev point, using the
|
|
43921
43914
|
// normal that points out from the convex side
|
|
43922
|
-
//
|
|
43915
|
+
// Length is curve length * HANDLE_RATIO
|
|
43923
43916
|
var convexity = prev.getCurve().getCurvatureAtTime(.5) < 0 ? -1 : 1;
|
|
43924
43917
|
point.handleIn = prev.getCurve().getNormalAtTime(1).multiply(convexity).add(prev.point.subtract(point.point).normalize()).normalize().multiply(prev.getCurve().length * HANDLE_RATIO);
|
|
43925
43918
|
} else if (next && !prev && point.handleOut.length === 0) {
|
|
43926
43919
|
// Point is start point
|
|
43927
43920
|
// Direction is average of normal at the point and direction to prev point, using the
|
|
43928
43921
|
// normal that points out from the convex side
|
|
43929
|
-
//
|
|
43922
|
+
// Length is curve length * HANDLE_RATIO
|
|
43930
43923
|
var _convexity = point.getCurve().getCurvatureAtTime(.5) < 0 ? -1 : 1;
|
|
43931
43924
|
point.handleOut = point.getCurve().getNormalAtTime(0).multiply(_convexity).add(next.point.subtract(point.point).normalize()).normalize().multiply(point.getCurve().length * HANDLE_RATIO);
|
|
43932
43925
|
}
|
|
@@ -44084,7 +44077,6 @@ mode_tools_ModeTools.propTypes = {
|
|
|
44084
44077
|
onUpdateImage: external_prop_types_default.a.func.isRequired,
|
|
44085
44078
|
// Listen on selected items to update hasSelectedPoints
|
|
44086
44079
|
selectedItems: external_prop_types_default.a.arrayOf(external_prop_types_default.a.instanceOf(paper_full_default.a.Item)),
|
|
44087
|
-
// eslint-disable-line react/no-unused-prop-types
|
|
44088
44080
|
setSelectedItems: external_prop_types_default.a.func.isRequired
|
|
44089
44081
|
};
|
|
44090
44082
|
var containers_mode_tools_mapStateToProps = function mapStateToProps(state) {
|
|
@@ -44135,7 +44127,7 @@ var tools_oval_tool_OvalTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
44135
44127
|
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
|
|
44136
44128
|
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
|
|
44137
44129
|
* @param {function} setCursor Callback to set the visible mouse cursor
|
|
44138
|
-
* @param {!
|
|
44130
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
44139
44131
|
*/
|
|
44140
44132
|
function OvalTool(setSelectedItems, clearSelectedItems, setCursor, onUpdateImage) {
|
|
44141
44133
|
var _this;
|
|
@@ -44524,7 +44516,7 @@ var tools_rect_tool_RectTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
44524
44516
|
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
|
|
44525
44517
|
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
|
|
44526
44518
|
* @param {function} setCursor Callback to set the visible mouse cursor
|
|
44527
|
-
* @param {!
|
|
44519
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
44528
44520
|
*/
|
|
44529
44521
|
function RectTool(setSelectedItems, clearSelectedItems, setCursor, onUpdateImage) {
|
|
44530
44522
|
var _this;
|
|
@@ -44898,7 +44890,7 @@ var point_tool_PointTool = /*#__PURE__*/function () {
|
|
|
44898
44890
|
/**
|
|
44899
44891
|
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
|
|
44900
44892
|
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
|
|
44901
|
-
* @param {!
|
|
44893
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
44902
44894
|
*/
|
|
44903
44895
|
function PointTool(setSelectedItems, clearSelectedItems, onUpdateImage) {
|
|
44904
44896
|
point_tool_classCallCheck(this, PointTool);
|
|
@@ -45101,7 +45093,7 @@ var handle_tool_HandleTool = /*#__PURE__*/function () {
|
|
|
45101
45093
|
/**
|
|
45102
45094
|
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
|
|
45103
45095
|
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
|
|
45104
|
-
* @param {!
|
|
45096
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
45105
45097
|
*/
|
|
45106
45098
|
function HandleTool(setSelectedItems, clearSelectedItems, onUpdateImage) {
|
|
45107
45099
|
handle_tool_classCallCheck(this, HandleTool);
|
|
@@ -45274,8 +45266,8 @@ var reshape_tool_ReshapeTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
45274
45266
|
* @param {function} clearHoveredItem Callback to clear the hovered item
|
|
45275
45267
|
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
|
|
45276
45268
|
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
|
|
45277
|
-
* @param {!
|
|
45278
|
-
* @param {!
|
|
45269
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
45270
|
+
* @param {!Function} switchToTextTool A callback to call to switch to the text tool
|
|
45279
45271
|
*/
|
|
45280
45272
|
function ReshapeTool(setHoveredItem, clearHoveredItem, setSelectedItems, clearSelectedItems, onUpdateImage, switchToTextTool) {
|
|
45281
45273
|
var _this;
|
|
@@ -45313,7 +45305,7 @@ var reshape_tool_ReshapeTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
45313
45305
|
* Returns the hit options for segments to use when conducting hit tests. Segments are only visible
|
|
45314
45306
|
* when the shape is selected. Segments take precedence, since they are always over curves and need
|
|
45315
45307
|
* to be grabbable. (Segments are the little circles)
|
|
45316
|
-
* @
|
|
45308
|
+
* @returns {object} See paper.Item.hitTest for definition of options
|
|
45317
45309
|
*/
|
|
45318
45310
|
reshape_tool_inherits(ReshapeTool, _paper$Tool);
|
|
45319
45311
|
return reshape_tool_createClass(ReshapeTool, [{
|
|
@@ -45335,7 +45327,7 @@ var reshape_tool_ReshapeTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
45335
45327
|
* Returns the hit options for handles to use when conducting hit tests. Handles need to be done
|
|
45336
45328
|
* separately because we want to ignore hidden handles, but we don't want hidden handles to negate
|
|
45337
45329
|
* legitimate hits on other things (like if the handle is over part of the fill). (Handles are the diamonds)
|
|
45338
|
-
* @
|
|
45330
|
+
* @returns {object} See paper.Item.hitTest for definition of options
|
|
45339
45331
|
*/
|
|
45340
45332
|
}, {
|
|
45341
45333
|
key: "getHandleHitOptions",
|
|
@@ -45358,7 +45350,7 @@ var reshape_tool_ReshapeTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
45358
45350
|
/**
|
|
45359
45351
|
* Returns the hit options for curves of selected objects, which take precedence over
|
|
45360
45352
|
* unselected things and fills.
|
|
45361
|
-
* @
|
|
45353
|
+
* @returns {object} See paper.Item.hitTest for definition of options
|
|
45362
45354
|
*/
|
|
45363
45355
|
}, {
|
|
45364
45356
|
key: "getSelectedStrokeHitOptions",
|
|
@@ -45384,7 +45376,7 @@ var reshape_tool_ReshapeTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
45384
45376
|
* Returns the hit options for fills and unselected strokes/curves to use when conducting hit tests.
|
|
45385
45377
|
* @param {boolean} preselectedOnly True if we should only return results that are already
|
|
45386
45378
|
* selected.
|
|
45387
|
-
* @
|
|
45379
|
+
* @returns {object} See paper.Item.hitTest for definition of options
|
|
45388
45380
|
*/
|
|
45389
45381
|
}, {
|
|
45390
45382
|
key: "getUnselectedAndFillHitOptions",
|
|
@@ -45416,7 +45408,7 @@ var reshape_tool_ReshapeTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
45416
45408
|
/**
|
|
45417
45409
|
* Given the point at which the mouse is, return the prioritized hit result, or null if nothing was hit.
|
|
45418
45410
|
* @param {paper.Point} point Point to hit test on canvas
|
|
45419
|
-
* @
|
|
45411
|
+
* @returns {?paper.HitResult} hitResult
|
|
45420
45412
|
*/
|
|
45421
45413
|
}, {
|
|
45422
45414
|
key: "getHitResult",
|
|
@@ -45840,8 +45832,8 @@ var selection_tools_select_tool_SelectTool = /*#__PURE__*/function (_paper$Tool)
|
|
|
45840
45832
|
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
|
|
45841
45833
|
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
|
|
45842
45834
|
* @param {function} setCursor Callback to set the visible mouse cursor
|
|
45843
|
-
* @param {!
|
|
45844
|
-
* @param {!
|
|
45835
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
45836
|
+
* @param {!Function} switchToTextTool A callback to call to switch to the text tool
|
|
45845
45837
|
*/
|
|
45846
45838
|
function SelectTool(setHoveredItem, clearHoveredItem, setSelectedItems, clearSelectedItems, setCursor, onUpdateImage, switchToTextTool) {
|
|
45847
45839
|
var _this;
|
|
@@ -45896,7 +45888,7 @@ var selection_tools_select_tool_SelectTool = /*#__PURE__*/function (_paper$Tool)
|
|
|
45896
45888
|
* Returns the hit options to use when conducting hit tests.
|
|
45897
45889
|
* @param {boolean} preselectedOnly True if we should only return results that are already
|
|
45898
45890
|
* selected.
|
|
45899
|
-
* @
|
|
45891
|
+
* @returns {object} See paper.Item.hitTest for definition of options
|
|
45900
45892
|
*/
|
|
45901
45893
|
}, {
|
|
45902
45894
|
key: "getHitOptions",
|
|
@@ -46415,9 +46407,9 @@ var text_tool_TextTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
46415
46407
|
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
|
|
46416
46408
|
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
|
|
46417
46409
|
* @param {function} setCursor Callback to set the visible mouse cursor
|
|
46418
|
-
* @param {!
|
|
46419
|
-
* @param {!
|
|
46420
|
-
* @param {!
|
|
46410
|
+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
|
|
46411
|
+
* @param {!Function} setTextEditTarget Call to set text editing target whenever text editing is active
|
|
46412
|
+
* @param {!Function} changeFont Call to change the font in the dropdown
|
|
46421
46413
|
* @param {?boolean} isBitmap True if text should be rasterized once it's deselected
|
|
46422
46414
|
*/
|
|
46423
46415
|
function TextTool(textAreaElement, setSelectedItems, clearSelectedItems, setCursor, onUpdateImage, setTextEditTarget, changeFont, isBitmap) {
|
|
@@ -46571,7 +46563,7 @@ var text_tool_TextTool = /*#__PURE__*/function (_paper$Tool) {
|
|
|
46571
46563
|
calculated.translate(tx, this.textBox.internalBounds.y);
|
|
46572
46564
|
calculated.append(viewMtx);
|
|
46573
46565
|
calculated.append(textBoxMtx);
|
|
46574
|
-
this.element.style.transform = "matrix(".concat(calculated.a, ", ").concat(calculated.b, ", ").concat(calculated.c, ", ").concat(calculated.d, ",\n
|
|
46566
|
+
this.element.style.transform = "matrix(".concat(calculated.a, ", ").concat(calculated.b, ", ").concat(calculated.c, ", ").concat(calculated.d, ",\n ").concat(calculated.tx, ", ").concat(calculated.ty, ")");
|
|
46575
46567
|
}
|
|
46576
46568
|
}, {
|
|
46577
46569
|
key: "setColorState",
|
|
@@ -47258,10 +47250,7 @@ var paint_editor_PaintEditorComponent = function PaintEditorComponent(props) {
|
|
|
47258
47250
|
onUpdateImage: props.onUpdateImage
|
|
47259
47251
|
}))) : null) : null, /*#__PURE__*/external_react_default.a.createElement("div", {
|
|
47260
47252
|
className: paint_editor_default.a.topAlignRow
|
|
47261
|
-
}, props.canvas !== null && isVector(props.format) ?
|
|
47262
|
-
/*#__PURE__*/
|
|
47263
|
-
// eslint-disable-line no-negated-condition
|
|
47264
|
-
external_react_default.a.createElement("div", {
|
|
47253
|
+
}, props.canvas !== null && isVector(props.format) ? /*#__PURE__*/external_react_default.a.createElement("div", {
|
|
47265
47254
|
className: paint_editor_default.a.modeSelector
|
|
47266
47255
|
}, /*#__PURE__*/external_react_default.a.createElement(containers_select_mode, {
|
|
47267
47256
|
onUpdateImage: props.onUpdateImage
|
|
@@ -47282,10 +47271,7 @@ var paint_editor_PaintEditorComponent = function PaintEditorComponent(props) {
|
|
|
47282
47271
|
onUpdateImage: props.onUpdateImage
|
|
47283
47272
|
}), /*#__PURE__*/external_react_default.a.createElement(containers_rect_mode, {
|
|
47284
47273
|
onUpdateImage: props.onUpdateImage
|
|
47285
|
-
})) : null, props.canvas !== null && format_isBitmap(props.format) ?
|
|
47286
|
-
/*#__PURE__*/
|
|
47287
|
-
// eslint-disable-line no-negated-condition
|
|
47288
|
-
external_react_default.a.createElement("div", {
|
|
47274
|
+
})) : null, props.canvas !== null && format_isBitmap(props.format) ? /*#__PURE__*/external_react_default.a.createElement("div", {
|
|
47289
47275
|
className: paint_editor_default.a.modeSelector
|
|
47290
47276
|
}, /*#__PURE__*/external_react_default.a.createElement(containers_bit_brush_mode, {
|
|
47291
47277
|
onUpdateImage: props.onUpdateImage
|