Skip to content

Commit

Permalink
🥕 v0.17.0-b20 🌱 ThreeD: Home Design
Browse files Browse the repository at this point in the history
  • Loading branch information
marty-mcgee committed Jan 12, 2025
1 parent 0b94e61 commit 23553fa
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 141 deletions.
93 changes: 58 additions & 35 deletions src/lib/threed/HomeDesign.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ const PaperCanvas = (props: any) => {

initThreeDPaperPlanView(planCanvas)
initPaperOrbitControls()
drawFreestyle()
// drawFreestyle()
// **
// console.debug('%c PaperCanvas THREED PAPER JS: initThreeDPaperPlanView(planCanvasRef)', ccm.darkorangeAlert, planCanvasRef.current)
// console.debug(`%c PaperCanvas planCanvas`, ccm.darkgreenAlert, planCanvas)
Expand Down Expand Up @@ -6521,8 +6521,6 @@ export default function ThreeDHomeDesign({
// console.debug('PAPERprojectToView', PAPERprojectToView)
threedDragDiv.style.left = PAPERprojectToView.x + planView.offsetLeft - widthT / 2 + 'px'
threedDragDiv.style.top = PAPERprojectToView.y + planView.offsetTop - heightOh / 2 + 'px'
// [MM]
// threedDragDiv.style.display = 'block'
}

// if (draggingNewGuide) {
Expand All @@ -6543,39 +6541,64 @@ export default function ThreeDHomeDesign({
}
// END: document.onmousemove = function (e: any) {}

paper.tool.onMouseUp = function (e: any) {
console.debug('PAPER threedTool', threedTool)
console.debug('PAPER tool', paper.tool)

// // ** HEY HEY HEY [MM] NEEDS ATTENTION [MM]
// // ** CAN WE DO THIS WITHIN A SUB "TOOL" MODE? Yes please.
// document.onmouseup = function (e: any) {
// // ** MOVED TO threedTool.pointer
// draggingThreedIcon = false

// // **
// if (verticalSliderDragging) {
// verticalSliderDragging = false
// }
// if (horizontalSliderLeftDragging) {
// horizontalSliderLeftDragging = false
// }
// if (horizontalSliderRightDragging) {
// horizontalSliderRightDragging = false
// }

// // ** [MM] CLOSER.. NOT EVEN CLOSE -- DON't DO THIS UNTIL YOU HAVE IT AS A threedTool.pointer
// if (draggingThreedItem) {
// // @ ts-expect-error
// // addThreed(e, draggingThreedItem, canvasStateThreeDVar().state.scene)
// // addThreed(e, draggingThreedItem, useCanvasStateThreeDVar.state.scene)
// void (draggingNewGuide && (draggingNewGuide = false))
// }

// // ** RETURN ???
// // return (
// // null
// // )
// return
// }
// // END: document.onmouseup = function (e: any) {}
// ** RETURN
return
}

// ** [MM] NEEDS ATTENTION [MM]
// ** CAN WE DO THIS WITHIN A SUB "TOOL" MODE? Yes please.
document.onmouseup = function (e: any) {

// var PAPERscript = paper.PaperScript
// console.debug('PAPERscript', PAPERscript)

// console.debug('PAPER threedTool', threedTool)
// console.debug('PAPER tool', paper.tool)

// ** MOVE TO threedTool.pointer
draggingThreedIcon = false

// **
if (verticalSliderDragging) {
verticalSliderDragging = false
}
if (horizontalSliderLeftDragging) {
horizontalSliderLeftDragging = false
}
if (horizontalSliderRightDragging) {
horizontalSliderRightDragging = false
}

// ** [MM] CLOSER...
// -- DON'T DO THIS UNTIL YOU HAVE IT AS A threedTool.pointer
if (draggingThreedItem) {

var PAPERa = paper.view.viewToProject(
new paper.Point(
e.pageX - planView.offsetLeft,
e.pageY - planView.offsetTop
)
)
console.debug('PAPERa', PAPERa)
var PAPERprojectToView = paper.view.projectToView(PAPERa)
console.debug('PAPERprojectToView', PAPERprojectToView)
var PAPERb = paper.view.bounds
console.debug('PAPERb', PAPERb)

// @ts-expect-error
addThreed(e, draggingThreedItem, canvasStateThreeDVar().state.scene)
// addThreed(e, draggingThreedItem, useCanvasStateThreeDVar.state.scene)
void (draggingNewGuide && (draggingNewGuide = false))
}

// ** RETURN
return
}
// END: document.onmouseup = function (e: any) {}


}, []) // end load data useEffect (client)
Expand Down
159 changes: 53 additions & 106 deletions src/lib/threed/NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,120 +2,67 @@

initThreeDPaperPlanView: tools.onMouseUp
Object { tool: {…}, type: "mouseup", event: mouseup }
event: mouseup { target: canvas#planCanvas, clientX: 448, clientY: 745, … }
tool: Object { _index: 0, _moveCount: 51, _downCount: 5, … }
​​
_callbacks: Object { mousedown: (1) […], mouseup: (1) […], mousedrag: (1) […], … }
​​
_downCount: 5
​​
_downPoint: Object { x: 167.65618148439705, y: 387.69804816667505 }
​​
_index: 0
​​
_lastPoint: Object { x: 1053.35252054596, y: 286.6378248634967 }
​​
_moveCount: 51
​​
_onMouseDown: function onMouseDown(e)
​​
_onMouseDrag: function onMouseDrag(e)
​​
_onMouseMove: function onMouseMove(e)
​​
_onMouseUp: function onMouseUp(e)
​​
_point: Object { x: 1258.879491533323, y: 317.2965442925508 }
​​
_scope: Object { settings: {…}, project: {…}, _id: 0, … }
​​
<prototype>: Object { _class: "Tool", _list: "tools", _reference: "tool", … }
type: "mouseup"
<prototype>: Object { _class: "ToolEvent", _item: null, initialize: ToolEvent(tool, type, event), … }
​event: mouseup { target: canvas#planCanvas, clientX: 448, clientY: 745, … }
​tool: Object { _index: 0, _moveCount: 51, _downCount: 5, … }
​​_callbacks: Object { mousedown: (1) […], mouseup: (1) […], mousedrag: (1) […], … }
​​_downCount: 5
​​_downPoint: Object { x: 167.65618148439705, y: 387.69804816667505 }
​​_index: 0
​​_lastPoint: Object { x: 1053.35252054596, y: 286.6378248634967 }
​​_moveCount: 51
​​_onMouseDown: function onMouseDown(e)
​​_onMouseDrag: function onMouseDrag(e)
​​_onMouseMove: function onMouseMove(e)
​​_onMouseUp: function onMouseUp(e)
​​_point: Object { x: 1258.879491533323, y: 317.2965442925508 }
​​_scope: Object { settings: {…}, project: {…}, _id: 0, … }
​​<prototype>: Object { _class: "Tool", _list: "tools", _reference: "tool", … }
​type: "mouseup"
​<prototype>: Object { _class: "ToolEvent", _item: null, initialize: ToolEvent(tool, type, event), … }
HomeDesign.tsx:1821:12

--

_scope: Object { settings: {…}, project: {…}, _id: 0, … }
​​​
_id: 0
​​​
project: Object { _index: 0, _selectionCount: 0, _updateVersion: 86, … }
​​​​
_activeLayer: Object { _id: 2, _index: 0, _applyMatrix: true, … }
​​​​
_children: Array [ {…} ]
​​​​
_currentStyle: Object { _values: {}, _owner: null, _project: {…}, … }
​​​​
_index: 0
​​​​
_namedChildren: Object { level_0: (1) […] }
​​​​
_scope: Object { settings: {…}, project: {…}, _id: 0, … }
​​​​
_selectionCount: 0
​​​​
_selectionItems: Object { }
​​​​
_updateVersion: 86
​​​​
_view: Object { _pixelRatio: 1, _id: "planCanvas", _frameItemCount: 0, … }
​​​​
<prototype>: Object { _class: "Project", _list: "projects", _reference: "project", … }
​​​
projects: Array [ {…} ]
​​​​
0: Object { _index: 0, _selectionCount: 0, _updateVersion: 86, … }
​​​​
length: 1
​​​​
<prototype>: Array []
​​​
settings: Object { applyMatrix: true, insertItems: true, handleSize: 4, … }
​​​
tool: Object { _index: 0, _moveCount: 51, _downCount: 5, … }
​​​
tools: Array [ {…} ]
​​​_id: 0
​​​project: Object { _index: 0, _selectionCount: 0, _updateVersion: 86, … }
​​​​_activeLayer: Object { _id: 2, _index: 0, _applyMatrix: true, … }
​​​​_children: Array [ {…} ]
​​​​_currentStyle: Object { _values: {}, _owner: null, _project: {…}, … }
​​​​_index: 0
​​​​_namedChildren: Object { level_0: (1) […] }
​​​​_scope: Object { settings: {…}, project: {…}, _id: 0, … }
​​​​_selectionCount: 0
​​​​_selectionItems: Object { }
​​​​_updateVersion: 86
​​​​_view: Object { _pixelRatio: 1, _id: "planCanvas", _frameItemCount: 0, … }
​​​​<prototype>: Object { _class: "Project", _list: "projects", _reference: "project", … }
​​​projects: Array [ {…} ]
​​​​0: Object { _index: 0, _selectionCount: 0, _updateVersion: 86, … }
​​​​length: 1
​​​​<prototype>: Array []
​​​settings: Object { applyMatrix: true, insertItems: true, handleSize: 4, … }
​​​tool: Object { _index: 0, _moveCount: 51, _downCount: 5, … }
​​​tools: Array [ {…} ]

--

_view: Object { _pixelRatio: 1, _id: "planCanvas", _frameItemCount: 0, … }
​​​​​
_autoUpdate: true
​​​​​
_bounds: Object { x: 63.6625852884355, y: -22.542103742910175, width: 1105.984915699952, … }
​​​​​
_context: CanvasRenderingContext2D { globalAlpha: 1, globalCompositeOperation: "source-over", strokeStyle: "#000000", … }
​​​​​
_decomposed: Object { translation: {…}, rotation: -0, scaling: {…}, … }
​​​​​
_element: <canvas id="planCanvas" width="974" height="391" style="user-select: none;">
​​​​​
_frameItemCount: 0
​​​​​
_frameItems: Object { }
​​​​​
_id: "planCanvas"
​​​​​
_itemEvents: Object { native: {…}, virtual: {…} }
​​​​​
_matrix: Object { _d: 0.8806630055922402, _a: 0.8806630055922402, _ty: 19.851996834603362, … }
​​​​​
_needsUpdate: false
​​​​​
_pixelRatio: 1
​​​​​
_project: Object { _index: 0, _selectionCount: 0, _updateVersion: 86, … }
​​​​​
_requested: false
​​​​​
_scope: Object { settings: {…}, project: {…}, _id: 0, … }
​​​​​
_viewSize: Object { _width: 974, _height: 491, _setter: "setSize", … }
​​​​​_autoUpdate: true
​​​​​_bounds: Object { x: 63.6625852884355, y: -22.542103742910175, width: 1105.984915699952, … }
​​​​​_context: CanvasRenderingContext2D { globalAlpha: 1, globalCompositeOperation: "source-over", strokeStyle: "#000000", … }
​​​​​_decomposed: Object { translation: {…}, rotation: -0, scaling: {…}, … }
​​​​​_element: <canvas id="planCanvas" width="974" height="391" style="user-select: none;">
​​​​​_frameItemCount: 0
​​​​​_frameItems: Object { }
​​​​​_id: "planCanvas"
​​​​​_itemEvents: Object { native: {…}, virtual: {…} }
​​​​​_matrix: Object { _d: 0.8806630055922402, _a: 0.8806630055922402, _ty: 19.851996834603362, … }
​​​​​_needsUpdate: false
​​​​​_pixelRatio: 1
​​​​​_project: Object { _index: 0, _selectionCount: 0, _updateVersion: 86, … }
​​​​​_requested: false
​​​​​_scope: Object { settings: {…}, project: {…}, _id: 0, … }
​​​​​_viewSize: Object { _width: 974, _height: 491, _setter: "setSize", … }

---

1 comment on commit 23553fa

@vercel
Copy link

@vercel vercel bot commented on 23553fa Jan 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.