bodleian / archiox-mirador-plugin

An experimental plugin to display depth information captured with Lucida or Selene scanners from FactumARTE. However, the plug-in can present any normal map/albedo map combination produced from any technique.
MIT License
1 stars 0 forks source link

Add resource doesn't work in Mirador #57

Closed BeebBenjamin closed 11 months ago

BeebBenjamin commented 1 year ago

If we load another resource into Mirador via the add button, the 3D overlay doesn't work for the second window, it's black. Which suggests to me something is wrong with the camera coordinates, i.e. incorrect scoping.

If the resource is the same there are conflicts over the resources so I think I need to re-think the way we id them or apply ids to our components.

BeebBenjamin commented 1 year ago

The second issue here is actually the lighting, the second windows light direction needs either separating or synchronising, this would be important when considering bodleian/archiox#11

BeebBenjamin commented 1 year ago

This is blocked until we get more items up on PRD. Mirador won't let you add duplicate resources.

BeebBenjamin commented 1 year ago

Above not true, can duplicate and object by clicking on the existing resource!

Symptoms are that the controls work with the first window but not the second. If you play with controls in the second window it affects the appearance of the controls in the first window, but doesn't update anything other than the colour gradient of the direction control.

Todo

BeebBenjamin commented 1 year ago

The second overlay does spawn, but it spawns in the first window...

BeebBenjamin commented 1 year ago

I've gotten this working, kind of. If you click the torch button in the second window first the add-overlay event is triggered with the correct window-id for the location of the event. But if you click off and activate the first window then the event is triggered from the first window, even if you use the torch button in the second window.

BeebBenjamin commented 1 year ago

Need to trigger the event always from the window the button lives in...

BeebBenjamin commented 1 year ago

ThreeCanvas needed it's own unique id...

BeebBenjamin commented 1 year ago

Nearly working. Just need to fix a problem with layers not switching back on when windows resetting after adding a resource.

BeebBenjamin commented 1 year ago

image

BeebBenjamin commented 1 year ago

Need to find out how to implement redux-sagas in adding a event handler for Mirador's ADD_RESOURCE action. Otherwise our composite layer is switched off after having the relight tool active but pressing Add Resource.

BeebBenjamin commented 1 year ago

I've figured out how to use sagas to trigger code on Mirador viewer events. In the main plug-in, you feed in reducers (if you need them) and sagas as follows:


function resourceAdded(action) {
  console.log(action);
  console.log("This is happening!")
  if (action.type === ActionTypes.ADD_RESOURCE) {
    try { console.log("Resource Added"); } catch (error) {
      console.log(error);

    }
  }
}

// Worker saga will be fired on ADD_RESOURCE actions
function* rootSaga() {
  yield takeEvery(
      [
        ActionTypes.ADD_RESOURCE
      ],
      resourceAdded
  )
}

export default [
  {
    saga: rootSaga,
    target: 'OpenSeadragonViewer',
    mapDispatchToProps: {
      updateLayers: actions.updateLayers,
    },
    mapStateToProps: function mapStateToProps(state, _ref) {
      const windowId = _ref.windowId;
      return {
        canvas: getCurrentCanvas(state, { windowId }),
        window: getWindow(state, _ref),
      };
    },
    mode: 'add',
    component: Relight,
  },
];
BeebBenjamin commented 1 year ago

resourceAdded is the wrong event trigger to use because canvas is not available. I have changed this to setCanvas.

BeebBenjamin commented 1 year ago

Need to figure out how to yield selectors from a loop...

BeebBenjamin commented 1 year ago

Fixed. Waiting for PR #83

BeebBenjamin commented 1 year ago

On QA

BeebBenjamin commented 11 months ago

Still broken due to #84

BeebBenjamin commented 11 months ago

Fixed