Prebuilt module for commit 3b71de9544

This commit is contained in:
Paper.js Bot 2016-03-17 13:19:37 +00:00
parent ab87fd5eca
commit 7663949656
7 changed files with 211 additions and 45 deletions

View file

@ -9,7 +9,7 @@
*
* All rights reserved.
*
* Date: Thu Mar 17 13:36:02 2016 +0100
* Date: Thu Mar 17 14:15:28 2016 +0100
*
***
*
@ -1463,6 +1463,18 @@ var LinkedPoint = Point.extend({
setY: function(y) {
this._y = y;
this._owner[this._setter](this);
},
isSelected: function() {
return !!(this._owner._selection & this._getSelection());
},
setSelected: function(selected) {
this._owner.changeSelection(this._getSelection(), selected);
},
_getSelection: function() {
return this._setter === 'setPosition' ? 4 : 0;
}
});
@ -4340,21 +4352,42 @@ new function() {
var selection = this._selection,
itemSelected = selection & 1,
boundsSelected = selection & 2
|| itemSelected && this._selectBounds;
|| itemSelected && this._selectBounds,
positionSelected = selection & 4;
if (!this._drawSelected)
itemSelected = false;
if ((itemSelected || boundsSelected) && this._isUpdated(updateVersion)) {
if ((itemSelected || boundsSelected || positionSelected)
&& this._isUpdated(updateVersion)) {
var layer,
color = this.getSelectedColor(true) || (layer = this.getLayer())
&& layer.getSelectedColor(true),
mx = matrix.appended(this.getGlobalMatrix(true));
mx = matrix.appended(this.getGlobalMatrix(true)),
half = size / 2;
ctx.strokeStyle = ctx.fillStyle = color
? color.toCanvasStyle(ctx) : '#009dec';
if (itemSelected)
this._drawSelected(ctx, mx, selectionItems);
if (positionSelected) {
var point = this.getPosition(true),
x = point.x,
y = point.y;
ctx.beginPath();
ctx.arc(x, y, half, 0, Math.PI * 2, true);
ctx.stroke();
var deltas = [[0, -1], [1, 0], [0, 1], [-1, 0]],
start = half,
end = size + 1;
for (var i = 0; i < 4; i++) {
var delta = deltas[i],
dx = delta[0],
dy = delta[1];
ctx.moveTo(x + dx * start, y + dy * start);
ctx.lineTo(x + dx * end, y + dy * end);
ctx.stroke();
}
}
if (boundsSelected) {
var half = size / 2,
coords = mx._transformCorners(this.getInternalBounds());
var coords = mx._transformCorners(this.getInternalBounds());
ctx.beginPath();
for (var i = 0; i < 8; i++) {
ctx[i === 0 ? 'moveTo' : 'lineTo'](coords[i], coords[++i]);

View file

@ -913,6 +913,53 @@ console.log(point.quadrant); // 4</code></pre>
</div>
<div class="member-description hidden">
<div class="member-text">
<p>This property is only valid if the point is an anchor or handle point of a <a href="../classes/Segment.html"><tt>Segment</tt></a> or a <a href="../classes/Curve.html"><tt>Curve</tt></a>, or the position of an <a href="../classes/Item.html"><tt>Item</tt></a>, as returned by <a href="../classes/Item.html#position"><tt>item.position</tt></a>, <a href="../classes/Segment.html#point"><tt>segment.point</tt></a>, <a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a>, <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>, <a href="../classes/Curve.html#point1"><tt>curve.point1</tt></a>, <a href="../classes/Curve.html#point2"><tt>curve.point2</tt></a>, <a href="../classes/Curve.html#handle1"><tt>curve.handle1</tt></a>, <a href="../classes/Curve.html#handle2"><tt>curve.handle2</tt></a>.</p>
<p>In those cases, it returns <tt>true</tt> if it the point is selected, <tt>false</tt> otherwise.</p>
<p>Paper.js renders selected points on top of your project. This is very useful when debugging.</p>
<ul class="member-list">
<h4>Default:</h4>
<li><tt>false</tt></li>
</ul>
<ul class="member-list">
<h4>Type:</h4>
<li>
<tt>Boolean</tt>
</li>
</ul>
<h4>Example:</h4>
<div class="paperscript split">
<div class="buttons">
<div class="button run">Run</div>
</div>
<script type="text/paperscript" canvas="canvas-0">
var path = new Path.Circle({
center: [80, 50],
radius: 40
});
// Select the third segment point:
path.segments[2].point.selected = true;
// Select the item's position, which is the pivot point
// around which it is trasnformed:
path.position.selected = true;
</script>
<div class="canvas"><canvas width="516" height="100" id="canvas-0"></canvas></div>
</div>
</div>
</div>
</div>

View file

@ -809,8 +809,8 @@
<div class="member-description hidden">
<div class="member-text">
<p>Specifies whether an item&rsquo;s bounds are selected and will also mark the item as selected.</p>
<p>Paper.js draws the visual bounds of selected items on top of your project. This can be useful for debugging.</p>
<p>Specifies whether an item&rsquo;s bounds are to appear as selected.</p>
<p>Paper.js draws the bounds of items with selected bounds on top of your project. This is very useful when debugging.</p>
@ -822,7 +822,27 @@
</ul>
<h4>Example:</h4>
<div class="paperscript split">
<div class="buttons">
<div class="button run">Run</div>
</div>
<script type="text/paperscript" canvas="canvas-0">
var path = new Path.Circle({
center: [80, 50],
radius: 40,
selected: true
});
path.bounds.selected = true;
</script>
<div class="canvas"><canvas width="516" height="100" id="canvas-0"></canvas></div>
</div>
</div>
</div>
@ -988,7 +1008,7 @@
<div class="button run">Run</div>
</div>
<script type="text/paperscript" canvas="canvas-0">
<script type="text/paperscript" canvas="canvas-1">
// Create a circle shaped path at {x: 80, y: 50}
// with a radius of 30.
var circle = new Path.Circle(new Point(80, 50), 30);
@ -1006,7 +1026,7 @@ function onMouseMove(event) {
}
}
</script>
<div class="canvas"><canvas width="516" height="100" id="canvas-0"></canvas></div>
<div class="canvas"><canvas width="516" height="100" id="canvas-1"></canvas></div>
</div>
@ -1055,7 +1075,7 @@ function onMouseMove(event) {
<div class="button run">Run</div>
</div>
<script type="text/paperscript" canvas="canvas-1">
<script type="text/paperscript" canvas="canvas-2">
// All newly created paths will inherit these styles:
project.currentStyle = {
fillColor: 'green',
@ -1087,7 +1107,7 @@ function onMouseMove(event) {
}
}
</script>
<div class="canvas"><canvas width="516" height="100" id="canvas-1"></canvas></div>
<div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
</div>
@ -1136,7 +1156,7 @@ function onMouseMove(event) {
<div class="button run">Run</div>
</div>
<script type="text/paperscript" canvas="canvas-2">
<script type="text/paperscript" canvas="canvas-3">
// All newly created paths will inherit these styles:
project.currentStyle = {
fillColor: 'green',
@ -1168,7 +1188,7 @@ function onMouseMove(event) {
}
}
</script>
<div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
<div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
</div>
@ -1219,7 +1239,7 @@ function onMouseMove(event) {
<div class="button run">Run</div>
</div>
<script type="text/paperscript" canvas="canvas-3">
<script type="text/paperscript" canvas="canvas-4">
// Create two rectangles that overlap each other
var size = new Size(50, 50);
var rectangle1 = new Rectangle(new Point(25, 15), size);
@ -1246,7 +1266,7 @@ new Path.Rectangle(rectangle2);
var intersectionPath = new Path.Rectangle(intersected);
intersectionPath.fillColor = 'red';
</script>
<div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
<div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
</div>

45
dist/paper-core.js vendored
View file

@ -9,7 +9,7 @@
*
* All rights reserved.
*
* Date: Thu Mar 17 13:36:02 2016 +0100
* Date: Thu Mar 17 14:15:28 2016 +0100
*
***
*
@ -1463,6 +1463,18 @@ var LinkedPoint = Point.extend({
setY: function(y) {
this._y = y;
this._owner[this._setter](this);
},
isSelected: function() {
return !!(this._owner._selection & this._getSelection());
},
setSelected: function(selected) {
this._owner.changeSelection(this._getSelection(), selected);
},
_getSelection: function() {
return this._setter === 'setPosition' ? 4 : 0;
}
});
@ -4340,21 +4352,42 @@ new function() {
var selection = this._selection,
itemSelected = selection & 1,
boundsSelected = selection & 2
|| itemSelected && this._selectBounds;
|| itemSelected && this._selectBounds,
positionSelected = selection & 4;
if (!this._drawSelected)
itemSelected = false;
if ((itemSelected || boundsSelected) && this._isUpdated(updateVersion)) {
if ((itemSelected || boundsSelected || positionSelected)
&& this._isUpdated(updateVersion)) {
var layer,
color = this.getSelectedColor(true) || (layer = this.getLayer())
&& layer.getSelectedColor(true),
mx = matrix.appended(this.getGlobalMatrix(true));
mx = matrix.appended(this.getGlobalMatrix(true)),
half = size / 2;
ctx.strokeStyle = ctx.fillStyle = color
? color.toCanvasStyle(ctx) : '#009dec';
if (itemSelected)
this._drawSelected(ctx, mx, selectionItems);
if (positionSelected) {
var point = this.getPosition(true),
x = point.x,
y = point.y;
ctx.beginPath();
ctx.arc(x, y, half, 0, Math.PI * 2, true);
ctx.stroke();
var deltas = [[0, -1], [1, 0], [0, 1], [-1, 0]],
start = half,
end = size + 1;
for (var i = 0; i < 4; i++) {
var delta = deltas[i],
dx = delta[0],
dy = delta[1];
ctx.moveTo(x + dx * start, y + dy * start);
ctx.lineTo(x + dx * end, y + dy * end);
ctx.stroke();
}
}
if (boundsSelected) {
var half = size / 2,
coords = mx._transformCorners(this.getInternalBounds());
var coords = mx._transformCorners(this.getInternalBounds());
ctx.beginPath();
for (var i = 0; i < 8; i++) {
ctx[i === 0 ? 'moveTo' : 'lineTo'](coords[i], coords[++i]);

File diff suppressed because one or more lines are too long

45
dist/paper-full.js vendored
View file

@ -9,7 +9,7 @@
*
* All rights reserved.
*
* Date: Thu Mar 17 13:36:02 2016 +0100
* Date: Thu Mar 17 14:15:28 2016 +0100
*
***
*
@ -1463,6 +1463,18 @@ var LinkedPoint = Point.extend({
setY: function(y) {
this._y = y;
this._owner[this._setter](this);
},
isSelected: function() {
return !!(this._owner._selection & this._getSelection());
},
setSelected: function(selected) {
this._owner.changeSelection(this._getSelection(), selected);
},
_getSelection: function() {
return this._setter === 'setPosition' ? 4 : 0;
}
});
@ -4340,21 +4352,42 @@ new function() {
var selection = this._selection,
itemSelected = selection & 1,
boundsSelected = selection & 2
|| itemSelected && this._selectBounds;
|| itemSelected && this._selectBounds,
positionSelected = selection & 4;
if (!this._drawSelected)
itemSelected = false;
if ((itemSelected || boundsSelected) && this._isUpdated(updateVersion)) {
if ((itemSelected || boundsSelected || positionSelected)
&& this._isUpdated(updateVersion)) {
var layer,
color = this.getSelectedColor(true) || (layer = this.getLayer())
&& layer.getSelectedColor(true),
mx = matrix.appended(this.getGlobalMatrix(true));
mx = matrix.appended(this.getGlobalMatrix(true)),
half = size / 2;
ctx.strokeStyle = ctx.fillStyle = color
? color.toCanvasStyle(ctx) : '#009dec';
if (itemSelected)
this._drawSelected(ctx, mx, selectionItems);
if (positionSelected) {
var point = this.getPosition(true),
x = point.x,
y = point.y;
ctx.beginPath();
ctx.arc(x, y, half, 0, Math.PI * 2, true);
ctx.stroke();
var deltas = [[0, -1], [1, 0], [0, 1], [-1, 0]],
start = half,
end = size + 1;
for (var i = 0; i < 4; i++) {
var delta = deltas[i],
dx = delta[0],
dy = delta[1];
ctx.moveTo(x + dx * start, y + dy * start);
ctx.lineTo(x + dx * end, y + dy * end);
ctx.stroke();
}
}
if (boundsSelected) {
var half = size / 2,
coords = mx._transformCorners(this.getInternalBounds());
var coords = mx._transformCorners(this.getInternalBounds());
ctx.beginPath();
for (var i = 0; i < 8; i++) {
ctx[i === 0 ? 'moveTo' : 'lineTo'](coords[i], coords[++i]);

File diff suppressed because one or more lines are too long