|
624 | 624 | this.canvas = args.canvas
|
625 | 625 | delete args.canvas
|
626 | 626 | } else if (args.display !== undefined) {
|
627 |
| - obj.canvas = obj.display = args.display |
| 627 | + this.canvas = args.display |
628 | 628 | delete args.display
|
629 | 629 | } else {
|
630 | 630 | this.canvas = canvas.selected
|
|
669 | 669 | this.__opacity = value
|
670 | 670 | this.canvas.__vertex_changed[this.__id] = this
|
671 | 671 | }
|
672 |
| - |
| 672 | + }, |
| 673 | + display: { |
| 674 | + get: function() { return this.canvas }, |
| 675 | + set: function(value) { throw new Error('Cannot change display of existing object')} |
673 | 676 | },
|
674 | 677 | texpos: new attributeVector(null, 0,0,0),
|
675 | 678 | bumpaxis: new attributeVector(null, 1,0,0),
|
|
741 | 744 | this.__change()
|
742 | 745 | }
|
743 | 746 | },
|
| 747 | + display: { |
| 748 | + get: function() { return this.canvas }, |
| 749 | + set: function(value) { throw new Error('Cannot change display of existing object')} |
| 750 | + }, |
744 | 751 | pos: {
|
745 | 752 | get: function() { tri_quad_error('triangle', 'pos') },
|
746 | 753 | set: function(value) { tri_quad_error('triangle', 'pos') }
|
|
857 | 864 | get: function() { tri_quad_error('quad', 'shininess') },
|
858 | 865 | set: function(value) { tri_quad_error('quad', 'shininess') }
|
859 | 866 | },
|
| 867 | + display: { |
| 868 | + get: function() { return this.canvas }, |
| 869 | + set: function(value) { throw new Error('Cannot change display of existing object')} |
| 870 | + }, |
860 | 871 | __prev_texture: null,
|
861 | 872 | __prev_bumpmap: null,
|
862 | 873 | __update: function () { this.__model.id_object[this.__id] = this },
|
|
1038 | 1049 | },
|
1039 | 1050 | origin: new attributeVector(null, 0,0,0),
|
1040 | 1051 | radius: 0,
|
| 1052 | + display: { |
| 1053 | + get: function() { return this.canvas }, |
| 1054 | + set: function(value) { throw new Error('Cannot change display of existing object')} |
| 1055 | + }, |
| 1056 | + display: { |
| 1057 | + get: function() { return this.canvas }, |
| 1058 | + set: function(value) { throw new Error('Cannot change display of existing object')} |
| 1059 | + }, |
1041 | 1060 | __no_autoscale: false,
|
1042 | 1061 | __get_extent: function (ext) {
|
1043 | 1062 | if (this.__no_autoscale) return
|
|
1335 | 1354 | if (this.__curve !== undefined) {
|
1336 | 1355 | this.__curve.clear()
|
1337 | 1356 | } else {
|
1338 |
| - this.__curve = curve({__no_autoscale:true}) |
| 1357 | + this.__curve = curve({canvas:this.canvas, __no_autoscale:true}) |
1339 | 1358 | }
|
1340 | 1359 | }
|
1341 | 1360 |
|
|
1376 | 1395 | property.declare( vp_helix.prototype, {
|
1377 | 1396 | axis: new attributeVectorAxis(null, 1,0,0),
|
1378 | 1397 | size: new attributeVectorSize(null, 1,2,2),
|
| 1398 | + display: { |
| 1399 | + get: function() { return this.canvas }, |
| 1400 | + set: function(value) { throw new Error('Cannot change display of existing object')} |
| 1401 | + }, |
1379 | 1402 | radius: {
|
1380 | 1403 | get: function() { return this.__size.__y/2 },
|
1381 | 1404 | set: function(value) {
|
|
1493 | 1516 | }
|
1494 | 1517 |
|
1495 | 1518 | function make_extrusion(args) {
|
1496 |
| - var center, pos, shapelist, col, up, opacity |
| 1519 | + var center, pos, shapelist, col, up, opacity, can |
| 1520 | + can = args.canvas |
1497 | 1521 | pos = (args.pos === undefined) ? vec(0,0,0) : args.pos
|
1498 | 1522 | if (args.shape === undefined) {
|
1499 | 1523 | throw new Error('An extrusion object needs a shape attribute.')
|
1500 | 1524 | } else shapelist = args.shape
|
1501 |
| - up = (args.up === undefined) ? canvas.selected.up : args.up |
| 1525 | + up = (args.up === undefined) ? can.up : args.up |
1502 | 1526 | col = (args.color === undefined) ? color.white : args.color
|
1503 | 1527 | opacity = (args.opacity === undefined) ? 1 : args.opacity
|
1504 | 1528 |
|
|
1612 | 1636 | }
|
1613 | 1637 | i++
|
1614 | 1638 | }
|
1615 |
| - return compound(quads) |
| 1639 | + var current = canvas.selected |
| 1640 | + canvas.selected = can |
| 1641 | + var comp = compound(quads) |
| 1642 | + canvas.selected = current |
| 1643 | + return comp |
1616 | 1644 | }
|
1617 | 1645 |
|
1618 | 1646 | function extrusion(args) {return initObject(this, extrusion, args) }
|
|
1626 | 1654 | get: function() {throw new Error("An extrusion has no radius.")},
|
1627 | 1655 | set: function(val) {throw new Error("An extrusion has no radius.")}
|
1628 | 1656 | },
|
| 1657 | + display: { |
| 1658 | + get: function() { return this.canvas }, |
| 1659 | + set: function(value) { throw new Error('Cannot change display of existing object')} |
| 1660 | + }, |
1629 | 1661 | origin: new attributeVector(null, 0,0,0),
|
1630 | 1662 | __initialize: true,
|
1631 | 1663 | pos: {
|
|
1684 | 1716 | }
|
1685 | 1717 |
|
1686 | 1718 | if (this.__initialize) {
|
1687 |
| - this.__comp = make_extrusion({pos:this.__pos, shape:this.__shape, color:this.__color, opacity:this.__opacity}) |
| 1719 | + this.__comp = make_extrusion({canvas:this.canvas, pos:this.__pos, shape:this.__shape, color:this.__color, opacity:this.__opacity}) |
1688 | 1720 | this.__lastsize = this.__size
|
1689 | 1721 | this.__lastcolor = this.__color
|
1690 | 1722 | this.__lastopacity = this.__opacity
|
|
1735 | 1767 | }
|
1736 | 1768 |
|
1737 | 1769 | if (this.__initialize) {
|
1738 |
| - this.__comp = make_extrusion( {pos:paths.circle({make_ring:true, radius:0.5*(this.__size.y-this.__size.x)}), |
| 1770 | + this.__comp = make_extrusion( {canvas:this.canvas, pos:paths.circle({make_ring:true, radius:0.5*(this.__size.y-this.__size.x)}), |
1739 | 1771 | shape:shapes.circle({radius:0.5*this.__size.x}), color:this.__color, opacity:this.__opacity} )
|
1740 | 1772 | this.__lastsize = this.__size
|
1741 | 1773 | this.__lastcolor = this.__color
|
|
1755 | 1787 | function vp_ring(args) { return initObject(this, vp_ring, args) }
|
1756 | 1788 | subclass(vp_ring, ring)
|
1757 | 1789 | property.declare( vp_ring.prototype, {
|
| 1790 | + display: { |
| 1791 | + get: function() { return this.canvas }, |
| 1792 | + set: function(value) { throw new Error('Cannot change display of existing object')} |
| 1793 | + }, |
1758 | 1794 | size: new attributeVector(null, 0.2,2,2),
|
1759 | 1795 | thickness: {
|
1760 | 1796 | get: function() { return this.__size.__x/2 },
|
|
0 commit comments